improvements to love,dislike buttons on list item
This commit is contained in:
parent
e9c4c4dbdf
commit
9071dbc6ab
2 changed files with 18 additions and 6 deletions
|
@ -294,6 +294,7 @@
|
||||||
"icon": "./assets/feather/heart.svg",
|
"icon": "./assets/feather/heart.svg",
|
||||||
"id": "love",
|
"id": "love",
|
||||||
"name": "Love",
|
"name": "Love",
|
||||||
|
"hidden": false,
|
||||||
"disabled": true,
|
"disabled": true,
|
||||||
"action": function () {
|
"action": function () {
|
||||||
app.love(self.item)
|
app.love(self.item)
|
||||||
|
@ -303,7 +304,7 @@
|
||||||
"icon": "./assets/feather/unheart.svg",
|
"icon": "./assets/feather/unheart.svg",
|
||||||
"id": "unlove",
|
"id": "unlove",
|
||||||
"name": "Unlove",
|
"name": "Unlove",
|
||||||
"disabled": true,
|
"hidden": true,
|
||||||
"action": function () {
|
"action": function () {
|
||||||
app.unlove(self.item)
|
app.unlove(self.item)
|
||||||
}
|
}
|
||||||
|
@ -312,6 +313,7 @@
|
||||||
"icon": "./assets/feather/thumbs-down.svg",
|
"icon": "./assets/feather/thumbs-down.svg",
|
||||||
"id": "dislike",
|
"id": "dislike",
|
||||||
"name": "Dislike",
|
"name": "Dislike",
|
||||||
|
"hidden": false,
|
||||||
"disabled": true,
|
"disabled": true,
|
||||||
"action": function () {
|
"action": function () {
|
||||||
app.dislike(self.item)
|
app.dislike(self.item)
|
||||||
|
@ -321,7 +323,7 @@
|
||||||
"icon": "./assets/feather/x-circle.svg",
|
"icon": "./assets/feather/x-circle.svg",
|
||||||
"id": "undo_dislike",
|
"id": "undo_dislike",
|
||||||
"name": "Undo dislike",
|
"name": "Undo dislike",
|
||||||
"disabled": true,
|
"hidden": true,
|
||||||
"action": function () {
|
"action": function () {
|
||||||
app.unlove(self.item)
|
app.unlove(self.item)
|
||||||
}
|
}
|
||||||
|
@ -372,9 +374,11 @@
|
||||||
menus.normal.items.find(x => x.id == 'love').disabled = false
|
menus.normal.items.find(x => x.id == 'love').disabled = false
|
||||||
menus.normal.items.find(x => x.id == 'dislike').disabled = false
|
menus.normal.items.find(x => x.id == 'dislike').disabled = false
|
||||||
} else if (rating == 1) {
|
} else if (rating == 1) {
|
||||||
menus.normal.items.find(x => x.id == 'unlove').disabled = false
|
menus.normal.items.find(x => x.id == 'unlove').hidden = false
|
||||||
|
menus.normal.items.find(x => x.id == 'love').hidden = true
|
||||||
} else if (rating == -1) {
|
} else if (rating == -1) {
|
||||||
menus.normal.items.find(x => x.id == 'undo_dislike').disabled = false
|
menus.normal.items.find(x => x.id == 'undo_dislike').hidden = false
|
||||||
|
menus.normal.items.find(x => x.id == 'dislike').hidden = true
|
||||||
}
|
}
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="menu-body">
|
<div class="menu-body">
|
||||||
<template v-for="item in content.items">
|
<template v-for="item in content.items">
|
||||||
<button class="menu-option" v-if="canDisplay(item)" @click="action(item)">
|
<button class="menu-option" v-if="canDisplay(item)" :style="getStyle(item)" @click="action(item)">
|
||||||
<div class="sidebar-icon" v-if="item.icon">
|
<div class="sidebar-icon" v-if="item.icon">
|
||||||
<div class="svg-icon" :style="{'--url': 'url(' + item.icon + ')'}"></div>
|
<div class="svg-icon" :style="{'--url': 'url(' + item.icon + ')'}"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -38,8 +38,16 @@
|
||||||
mounted() {
|
mounted() {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getStyle(item) {
|
||||||
|
if(item["disabled"]) {
|
||||||
|
return {
|
||||||
|
"pointer-events": "none",
|
||||||
|
"opacity": "0.5",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
canDisplay(item) {
|
canDisplay(item) {
|
||||||
if(!item["disabled"]) {
|
if(!item["hidden"]) {
|
||||||
return true
|
return true
|
||||||
}else{
|
}else{
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue