mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
Provide feedback for tags CRUD
This commit is contained in:
parent
9d986f0304
commit
d6f0291a27
7 changed files with 47 additions and 19 deletions
|
@ -84,28 +84,48 @@ export const tagAPI = {
|
|||
return response.data;
|
||||
},
|
||||
async create(name) {
|
||||
let response = await apiReq.post(tagURLs.getAll, { name: name });
|
||||
store.dispatch("requestTags");
|
||||
return response.data;
|
||||
const response = await apiReq.post(
|
||||
tagURLs.getAll,
|
||||
{ name: name },
|
||||
function() { return i18n.t('tag.tag-creation-failed'); },
|
||||
function() { return i18n.t('tag.tag-created'); }
|
||||
);
|
||||
if(response) {
|
||||
store.dispatch("requestTags");
|
||||
return response.data;
|
||||
}
|
||||
},
|
||||
async getRecipesInTag(tag) {
|
||||
let response = await apiReq.get(tagURLs.getTag(tag));
|
||||
return response.data;
|
||||
},
|
||||
async update(name, newName, overrideRequest = false) {
|
||||
let response = await apiReq.put(tagURLs.updateTag(name), { name: newName });
|
||||
const response = await apiReq.put(
|
||||
tagURLs.updateTag(name),
|
||||
{ name: newName },
|
||||
function() { return i18n.t('tag.tag-update-failed'); },
|
||||
function() { return i18n.t('tag.tag-updated'); }
|
||||
);
|
||||
|
||||
if (!overrideRequest) {
|
||||
store.dispatch("requestTags");
|
||||
if(response) {
|
||||
if (!overrideRequest) {
|
||||
store.dispatch("requestTags");
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
|
||||
return response.data;
|
||||
},
|
||||
async delete(tag, overrideRequest = false) {
|
||||
let response = await apiReq.delete(tagURLs.deleteTag(tag));
|
||||
if (!overrideRequest) {
|
||||
store.dispatch("requestTags");
|
||||
const response = await apiReq.delete(
|
||||
tagURLs.deleteTag(tag),
|
||||
null,
|
||||
function() { return i18n.t('tag.tag-deletion-failed'); },
|
||||
function() { return i18n.t('tag.tag-deleted'); }
|
||||
);
|
||||
if(response) {
|
||||
if (!overrideRequest) {
|
||||
store.dispatch("requestTags");
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -90,7 +90,7 @@ export default {
|
|||
computed: {
|
||||
inputLabel() {
|
||||
if (!this.showLabel) return null;
|
||||
return this.tagSelector ? this.$t('recipe.tags') : this.$t('recipe.categories');
|
||||
return this.tagSelector ? this.$t('tag.tags') : this.$t('recipe.categories');
|
||||
},
|
||||
activeItems() {
|
||||
let ItemObjects = [];
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
:show-label="false"
|
||||
/>
|
||||
|
||||
<h2 class="mt-4">{{ $t("recipe.tags") }}</h2>
|
||||
<h2 class="mt-4">{{ $t("tag.tags") }}</h2>
|
||||
<CategoryTagSelector
|
||||
:return-object="false"
|
||||
v-model="value.tags"
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
</v-card>
|
||||
<v-card class="mt-2" v-if="tags.length > 0">
|
||||
<v-card-title class="py-2">
|
||||
{{ $t("recipe.tags") }}
|
||||
{{ $t("tag.tags") }}
|
||||
</v-card-title>
|
||||
<v-divider class="mx-2"></v-divider>
|
||||
<v-card-text>
|
||||
|
@ -69,7 +69,7 @@
|
|||
</v-row>
|
||||
<div v-if="!medium">
|
||||
<RecipeChips :title="$t('recipe.categories')" :items="categories" />
|
||||
<RecipeChips :title="$t('recipe.tags')" :items="tags" />
|
||||
<RecipeChips :title="$t('tag.tags')" :items="tags" />
|
||||
<Nutrition :value="nutrition" :edit="false" />
|
||||
<Assets :value="assets" :edit="false" :slug="slug" />
|
||||
</div>
|
||||
|
|
|
@ -204,7 +204,6 @@
|
|||
"sodium-content": "Sodium",
|
||||
"step-index": "Step: {step}",
|
||||
"sugar-content": "Sugar",
|
||||
"tags": "Tags",
|
||||
"title": "Title",
|
||||
"total-time": "Total Time",
|
||||
"unable-to-delete-recipe": "Unable to Delete Recipe",
|
||||
|
@ -310,6 +309,15 @@
|
|||
"webhook-url": "Webhook URL"
|
||||
}
|
||||
},
|
||||
"tag": {
|
||||
"tag-created": "Tag created",
|
||||
"tag-creation-failed": "Tag creation failed",
|
||||
"tag-deleted": "Tag deleted",
|
||||
"tag-deletion-failed": "Tag deletion failed",
|
||||
"tag-update-failed": "Tag update failed",
|
||||
"tag-updated": "Tag updated",
|
||||
"tags": "Tags"
|
||||
},
|
||||
"user": {
|
||||
"admin": "Admin",
|
||||
"are-you-sure-you-want-to-delete-the-link": "Are you sure you want to delete the link <b>{link}<b/>?",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
:title="
|
||||
$t('general.delete') +
|
||||
' ' +
|
||||
(isTags ? $t('recipe.tags') : $t('recipe.categories'))
|
||||
(isTags ? $t('tag.tags') : $t('recipe.categories'))
|
||||
"
|
||||
:loading="loading"
|
||||
modal-width="400"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</v-tab>
|
||||
|
||||
<v-tab>
|
||||
{{ $t("recipe.tags") }}
|
||||
{{ $t("tag.tags") }}
|
||||
<v-icon>mdi-tag-multiple-outline</v-icon>
|
||||
</v-tab>
|
||||
</v-tabs>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue