mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-06 14:48:02 -05:00
Unpin pin from recipe page.
This commit is contained in:
@@ -49,7 +49,7 @@
|
|||||||
<a href="javascript:void(0);">
|
<a href="javascript:void(0);">
|
||||||
<button class="dropdown-item" @click="pinRecipe()" v-if="!disabled_options.pin">
|
<button class="dropdown-item" @click="pinRecipe()" v-if="!disabled_options.pin">
|
||||||
<i class="fas fa-thumbtack fa-fw"></i>
|
<i class="fas fa-thumbtack fa-fw"></i>
|
||||||
{{ $t("Pin") }}
|
{{ isPinned ? $t("Unpin") : $t("Pin")}}
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@@ -121,6 +121,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
servings_value: 0,
|
servings_value: 0,
|
||||||
|
isPinned: false,
|
||||||
recipe_share_link: undefined,
|
recipe_share_link: undefined,
|
||||||
modal_id: Math.round(Math.random() * 100000),
|
modal_id: Math.round(Math.random() * 100000),
|
||||||
options: {
|
options: {
|
||||||
@@ -138,7 +139,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
entryEditing: {},
|
entryEditing: {},
|
||||||
mealplan: undefined,
|
mealplan: undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@@ -154,6 +155,9 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.servings_value = this.servings === -1 ? this.recipe.servings : this.servings
|
this.servings_value = this.servings === -1 ? this.recipe.servings : this.servings
|
||||||
|
|
||||||
|
let pinnedRecipes = JSON.parse(localStorage.getItem("pinned_recipes")) || []
|
||||||
|
this.isPinned = pinnedRecipes.some((r) => r.id == this.recipe.id);
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
recipe: {
|
recipe: {
|
||||||
@@ -166,9 +170,16 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
pinRecipe: function () {
|
pinRecipe () {
|
||||||
let pinnedRecipes = JSON.parse(localStorage.getItem("pinned_recipes")) || []
|
let pinnedRecipes = JSON.parse(localStorage.getItem("pinned_recipes")) || []
|
||||||
pinnedRecipes.push({id: this.recipe.id, name: this.recipe.name})
|
if(this.isPinned) {
|
||||||
|
pinnedRecipes = pinnedRecipes.filter((r) => r.id !== this.recipe.id)
|
||||||
|
makeToast(this.$t("Unpin"), this.$t("UnpinnedConfirmation", {recipe: this.recipe.name}), "info")
|
||||||
|
} else {
|
||||||
|
pinnedRecipes.push({id: this.recipe.id, name: this.recipe.name})
|
||||||
|
makeToast(this.$t("Pin"), this.$t("PinnedConfirmation", {recipe: this.recipe.name}), "info")
|
||||||
|
}
|
||||||
|
this.isPinned = !this.isPinned
|
||||||
localStorage.setItem("pinned_recipes", JSON.stringify(pinnedRecipes))
|
localStorage.setItem("pinned_recipes", JSON.stringify(pinnedRecipes))
|
||||||
},
|
},
|
||||||
saveMealPlan: function (entry) {
|
saveMealPlan: function (entry) {
|
||||||
|
|||||||
@@ -308,6 +308,9 @@
|
|||||||
"in_shopping": "In Shopping List",
|
"in_shopping": "In Shopping List",
|
||||||
"DelayUntil": "Delay Until",
|
"DelayUntil": "Delay Until",
|
||||||
"Pin": "Pin",
|
"Pin": "Pin",
|
||||||
|
"Unpin": "Unpin",
|
||||||
|
"PinnedConfirmation": "{recipe} has been pinned.",
|
||||||
|
"UnpinnedConfirmation": "{recipe} has been unpinned.",
|
||||||
"mark_complete": "Mark Complete",
|
"mark_complete": "Mark Complete",
|
||||||
"QuickEntry": "Quick Entry",
|
"QuickEntry": "Quick Entry",
|
||||||
"shopping_add_onhand_desc": "Mark food 'On Hand' when checked off shopping list.",
|
"shopping_add_onhand_desc": "Mark food 'On Hand' when checked off shopping list.",
|
||||||
|
|||||||
@@ -360,6 +360,9 @@
|
|||||||
"Page": "Pagina",
|
"Page": "Pagina",
|
||||||
"left_handed": "Linkshandige modus",
|
"left_handed": "Linkshandige modus",
|
||||||
"Pin": "Pin",
|
"Pin": "Pin",
|
||||||
|
"Unpin": "Pin losmaken",
|
||||||
|
"PinnedConfirmation": "{recipe} is vast vastgepind.",
|
||||||
|
"UnpinnedConfirmation": "{recipe} is losgemaakt.",
|
||||||
"shopping_category_help": "Supermarkten kunnen gesorteerd en gefilterd worden per boodschappencategorie conform the indeling van de gangpaden.",
|
"shopping_category_help": "Supermarkten kunnen gesorteerd en gefilterd worden per boodschappencategorie conform the indeling van de gangpaden.",
|
||||||
"Foods": "Ingrediënten",
|
"Foods": "Ingrediënten",
|
||||||
"OnHand_help": "Ingrediënt is op voorraad en wordt niet automatisch aan een boodschappenlijstje toegevoegd. Voorraadstatus is gedeeld tussen gebruikers.",
|
"OnHand_help": "Ingrediënt is op voorraad en wordt niet automatisch aan een boodschappenlijstje toegevoegd. Voorraadstatus is gedeeld tussen gebruikers.",
|
||||||
|
|||||||
Reference in New Issue
Block a user