folders beta 1
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<span
|
||||
class="flag mdi"
|
||||
:class="[
|
||||
flagIsLoading(coll.id) ? 'mdi-loading mdi-spin' : flagIsActive(coll.id) ? 'mdi-close isActive' : 'mdi-plus'
|
||||
flagIsLoading(coll.id) ? 'mdi-loading mdi-spin' : flagIsActive(coll.id) ? 'mdi-close-circle isActive' : 'mdi-plus'
|
||||
]"
|
||||
:collid="coll.id"
|
||||
@click.prevent="onFlagActionCard"
|
||||
@@ -64,8 +64,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
flag: 'User/flag',
|
||||
unFlag: 'User/unFlag'
|
||||
flagUnflag: 'User/flagUnflag'
|
||||
}),
|
||||
flagIsActive(collid) {
|
||||
// console.log(this.item.uuid);
|
||||
@@ -82,22 +81,15 @@ export default {
|
||||
if (!this.loadingFlag) {
|
||||
let collid = e.target.getAttribute('collid');
|
||||
let isActive = this.flagIsActive(collid);
|
||||
let action = isActive ? 'unflag' : 'flag';
|
||||
// console.log('collid', collid);
|
||||
// console.log("this.item", this.item);
|
||||
this.loadingFlag = collid;
|
||||
if (isActive) {
|
||||
this.unFlag({uuid: this.item.uuid, collid: collid})
|
||||
.then(data => {
|
||||
console.log("onFlagActionCard then", data);
|
||||
this.loadingFlag = false;
|
||||
})
|
||||
}else{
|
||||
this.flag({uuid: this.item.uuid, collid: collid})
|
||||
.then(data => {
|
||||
console.log("onFlagActionCard then", data);
|
||||
this.loadingFlag = false;
|
||||
})
|
||||
}
|
||||
this.flagUnflag({ action: action, uuid: this.item.uuid, collid: collid})
|
||||
.then(data => {
|
||||
console.log("onFlagActionCard then", data);
|
||||
this.loadingFlag = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,13 @@
|
||||
</header>
|
||||
<nav class="tools">
|
||||
<section class="tool flags">
|
||||
<span class="mdi mdi-folder-remove-outline"/>
|
||||
<span
|
||||
class="mdi unflag"
|
||||
:class="[
|
||||
itemIsLoading() ? 'mdi-loading mdi-spin' : 'mdi-folder-remove'
|
||||
]"
|
||||
@click.prevent="onUnFlagCard"
|
||||
/>
|
||||
</section>
|
||||
</nav>
|
||||
<section class="images" v-switcher>
|
||||
@@ -32,57 +38,38 @@ import cardMixins from 'vuejs/components/cardMixins'
|
||||
|
||||
export default {
|
||||
name: "MiniCard",
|
||||
props: ['item'],
|
||||
props: ['item', 'collid'],
|
||||
mixins: [cardMixins],
|
||||
data() {
|
||||
return {
|
||||
blanksrc:`${drupalSettings.path.themePath}/assets/img/blank.gif`,
|
||||
// loadingFlag: false
|
||||
loadingItem: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// ...mapState({
|
||||
// flagcolls: state => state.User.flagcolls
|
||||
// })
|
||||
},
|
||||
methods: {
|
||||
// ...mapActions({
|
||||
// flag: 'User/flag',
|
||||
// unFlag: 'User/unFlag'
|
||||
// }),
|
||||
// flagIsActive(collid) {
|
||||
// // console.log(this.item.uuid);
|
||||
// // console.log(this.flagcolls[collid].items_uuids);
|
||||
// return this.flagcolls[collid].items_uuids.indexOf(this.item.uuid) !== -1;
|
||||
// },
|
||||
// flagIsLoading(collid) {
|
||||
// // console.log(this.item.uuid);
|
||||
// // console.log(this.flagcolls[collid].items_uuids);
|
||||
// return collid === this.loadingFlag;
|
||||
// },
|
||||
// onFlagActionCard (e) {
|
||||
// console.log("Card onFlagActionCard", e);
|
||||
// if (!this.loadingFlag) {
|
||||
// let collid = e.target.getAttribute('collid');
|
||||
// let isActive = this.flagIsActive(collid);
|
||||
// // console.log('collid', collid);
|
||||
// // console.log("this.item", this.item);
|
||||
// this.loadingFlag = collid;
|
||||
// if (isActive) {
|
||||
// this.unFlag({uuid: this.item.uuid, collid: collid})
|
||||
// .then(data => {
|
||||
// console.log("onFlagActionCard then", data);
|
||||
// this.loadingFlag = false;
|
||||
// })
|
||||
// }else{
|
||||
// this.flag({uuid: this.item.uuid, collid: collid})
|
||||
// .then(data => {
|
||||
// console.log("onFlagActionCard then", data);
|
||||
// this.loadingFlag = false;
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
...mapActions({
|
||||
flagUnflag: 'User/flagUnflag'
|
||||
}),
|
||||
itemIsLoading(id) {
|
||||
return this.loadingItem
|
||||
},
|
||||
onUnFlagCard (e) {
|
||||
console.log("Card onFlagActionCard", e);
|
||||
if (!this.loadingItem) {
|
||||
this.loadingItem = true;
|
||||
this.flagUnflag({
|
||||
action: 'unflag',
|
||||
uuid: this.item.uuid,
|
||||
collid: this.collid
|
||||
})
|
||||
.then(data => {
|
||||
console.log("onUnFlagCard then", data);
|
||||
this.loadingItem = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user