From f4bfcdab2eaf184016ee6ab0d7ad78550384fb02 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Fri, 11 Feb 2022 14:15:46 +0100 Subject: [PATCH] improved on explain and some tweaks --- .../RecipeSearchView/RecipeSearchView.vue | 164 ++++++++++-------- vue/src/locales/en.json | 3 +- 2 files changed, 94 insertions(+), 73 deletions(-) diff --git a/vue/src/apps/RecipeSearchView/RecipeSearchView.vue b/vue/src/apps/RecipeSearchView/RecipeSearchView.vue index 8a3f0a6bd..91d65fc88 100644 --- a/vue/src/apps/RecipeSearchView/RecipeSearchView.vue +++ b/vue/src/apps/RecipeSearchView/RecipeSearchView.vue @@ -112,7 +112,7 @@ + > @@ -141,42 +141,42 @@ id="popover-show_rating" size="sm"> - - - - - - - - - @@ -578,105 +571,126 @@ -
+ + +
+
+ +
+ {{ $t("explain") }} +
+
{{ $t("explain") }}
+
+ +
+ {{ $t("expert_mode") }} +
+
+ {{ $t("simple_mode") }} +
+
+ +
{{ $t("save_filter") }}
+
+
+
+ +
+
+
- Return all recipes that match {{ + Return all recipes that are matched + by {{ search.search_input }}
- Return all recipes without a search term
+ without any search term
and are internal
+ v-if="search.search_internal"> and are internal
- and you can make right now (based on the on hand flag)
+ and you can make right now (based on the on hand flag)
- and contain the following units
+ and contain anyall + of the following units: {{ + search.search_units.flatMap(x => x.name).join(', ') + }}
- and have a rating or equal to {{ + search.search_rating + }}
- and have been last cooked {{ search.lastcooked }}
- and have been cooked or equal to{{ + search.timescooked + }} times
- and order them by
+ order by + {{ search.sort_order.flatMap(x => x.text).join(', ') }} +
-
-
- - -
{{ $t("save_filter") }}
-
-
-
-
- -
{{ $t("expert_mode") }}
-
{{ $t("simple_mode") }}
-
-
-
-
@@ -694,7 +708,7 @@ refreshData(false) " > - {{ o.text }} + {{ o.text }} @@ -776,6 +790,7 @@ export default { search: { advanced_search_visible: false, + explain_visible: false, search_input: "", search_internal: false, search_keywords: [ @@ -899,7 +914,7 @@ export default { ] }, expertMode: function () { - return this.ui.enable_expert && this.search.expert_mode + return this.search.expert_mode }, keywordFields: function () { return !this.expertMode ? 1 : this.search.keywords_fields @@ -920,24 +935,24 @@ export default { let sort_order = [] let x = 1 const field = [ - [this.$t("search_rank"), "score"], - [this.$t("Name"), "name"], - [this.$t("last_cooked"), "lastcooked"], - [this.$t("Rating"), "rating"], - [this.$t("times_cooked"), "favorite"], - [this.$t("date_created"), "created_at"], - [this.$t("date_viewed"), "lastviewed"], + [this.$t("search_rank"), "score", "1-9", "9-1"], + [this.$t("Name"), "name", "A-z", "Z-a"], + [this.$t("last_cooked"), "lastcooked", "↑", "↓"], + [this.$t("Rating"), "rating", "1-5", "5-1"], + [this.$t("times_cooked"), "favorite", "*-x", "x-*"], + [this.$t("date_created"), "created_at", "↑", "↓"], + [this.$t("date_viewed"), "lastviewed", "↑", "↓"], ] field.forEach((f) => { sort_order.push( { id: x, - text: `${f[0]} ↑`, + text: `${f[0]} (${f[2]})`, value: f[1], }, { id: x + 1, - text: `${f[0]} ↓`, + text: `${f[0]} (${f[3]})`, value: `-${f[1]}`, } ) @@ -1234,7 +1249,7 @@ export default { ...this.addFields("keywords"), ...this.addFields("foods"), ...this.addFields("books"), - units: this.search.search_units, + units: this.search.search_units.flatMap(x => x.id), query: this.search.search_input, rating: rating, internal: this.search.search_internal, @@ -1303,6 +1318,11 @@ export default { }, saveSearch: function () { let filtername = window.prompt(this.$t("save_filter"), this.$t("filter_name")) + + if (filtername === null || filtername.trim() === '') { + return + } + let search = this.buildParams(false) ;["page", "pageSize"].forEach((key) => { delete search[key] diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index 0d2802264..9f89db066 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -323,9 +323,10 @@ "search_rank": "Search Rank", "make_now": "Make Now", "recipe_filter": "Recipe Filter", - "book_filter_help": "Include recipes from recipe filter instead of assigning each recipe", + "book_filter_help": "Include recipes from recipe filter in addition to manually assigned ones.", "review_shopping": "Review shopping entries before saving", "view_recipe": "View Recipe", + "explain": "Explain", "filter": "Filter", "reset_children": "Reset Child Inheritance", "reset_children_help": "Overwrite all children with values from inherited fields. Inheritted fields of children will be set to Inherit Fields unless Children Inherit Fields is set.",