search ui improvements and filter
This commit is contained in:
parent
880db58d38
commit
f78f7dfc14
@ -33,17 +33,17 @@ def search_recipes(queryset, params):
|
|||||||
|
|
||||||
if len(search_foods) > 0:
|
if len(search_foods) > 0:
|
||||||
if search_foods_or == 'true':
|
if search_foods_or == 'true':
|
||||||
queryset = queryset.filter(keywords__id__in=search_foods)
|
queryset = queryset.filter(steps__ingredients__food__id__in=search_foods)
|
||||||
else:
|
else:
|
||||||
for k in search_foods:
|
for k in search_foods:
|
||||||
queryset = queryset.filter(keywords__id=k)
|
queryset = queryset.filter(steps__ingredients__food__id=k)
|
||||||
|
|
||||||
if len(search_books) > 0:
|
if len(search_books) > 0:
|
||||||
if search_books_or == 'true':
|
if search_books_or == 'true':
|
||||||
queryset = queryset.filter(keywords__id__in=search_books)
|
queryset = queryset.filter(recipebookentry__book__id__in=search_books)
|
||||||
else:
|
else:
|
||||||
for k in search_books:
|
for k in search_books:
|
||||||
queryset = queryset.filter(keywords__id=k)
|
queryset = queryset.filter(recipebookentry__book__id=k)
|
||||||
|
|
||||||
queryset = queryset.distinct()
|
queryset = queryset.distinct()
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -29,40 +29,82 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<a class="card-link" :href="resolveDjangoUrl('new_recipe')">new Recipe</a>
|
<a class="btn btn-primary" :href="resolveDjangoUrl('new_recipe')">new Recipe</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<a class="card-link" :href="resolveDjangoUrl('data_import_url')">URL Import</a>
|
<a class="btn btn-primary" :href="resolveDjangoUrl('data_import_url')">URL Import</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<a class="card-link" href="#">Rest Search</a>
|
<a class="btn btn-primary" href="#">Rest Search</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input type="checkbox" v-model="search_internal" @change="refreshData"> Internal only
|
<b-form-checkbox v-model="search_internal" name="check-button" @change="refreshData"
|
||||||
|
class="shadow-none" switch>
|
||||||
|
{{ $t('show_only_internal') }}
|
||||||
|
</b-form-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-12">
|
||||||
<generic-multiselect @change="genericSelectChanged" parent_variable="search_keywords"
|
|
||||||
style="margin-top: 1vh"
|
|
||||||
search_function="listKeywords" label="label"
|
|
||||||
v-bind:placeholder="$t('Keywords')"></generic-multiselect>
|
|
||||||
<input type="checkbox" v-model="search_keywords_or" @change="genericSelectChanged">
|
|
||||||
|
|
||||||
<generic-multiselect @change="genericSelectChanged" parent_variable="search_foods"
|
|
||||||
style="margin-top: 1vh"
|
<b-input-group style="margin-top: 1vh">
|
||||||
search_function="listFoods" label="name"
|
|
||||||
v-bind:placeholder="$t('Ingredients')"></generic-multiselect>
|
<generic-multiselect @change="genericSelectChanged" parent_variable="search_keywords"
|
||||||
<input type="checkbox" v-model="search_foods_or" @change="genericSelectChanged">
|
search_function="listKeywords" label="label" style="width: 90%"
|
||||||
<generic-multiselect @change="genericSelectChanged" parent_variable="search_books"
|
v-bind:placeholder="$t('Keywords')"></generic-multiselect>
|
||||||
style="margin-top: 1vh"
|
|
||||||
search_function="listRecipeBooks" label="name"
|
<b-input-group-append is-text style="width: 10%">
|
||||||
v-bind:placeholder="$t('Books')"></generic-multiselect>
|
<b-form-checkbox v-model="search_keywords_or" name="check-button" @change="refreshData"
|
||||||
<input type="checkbox" v-model="search_books_or" @change="genericSelectChanged">
|
class="shadow-none" style="width: 100%" switch>
|
||||||
|
<template v-if="search_keywords_or">{{ $t('OR') }}</template>
|
||||||
|
<template v-else>{{ $t('AND') }}</template>
|
||||||
|
</b-form-checkbox>
|
||||||
|
</b-input-group-append>
|
||||||
|
</b-input-group>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
|
||||||
|
<b-input-group style="margin-top: 1vh">
|
||||||
|
<generic-multiselect @change="genericSelectChanged" parent_variable="search_foods"
|
||||||
|
|
||||||
|
search_function="listFoods" label="name" style="width: 90%"
|
||||||
|
v-bind:placeholder="$t('Ingredients')"></generic-multiselect>
|
||||||
|
<b-input-group-append is-text style="width: 10%">
|
||||||
|
<b-form-checkbox v-model="search_foods_or" name="check-button" @change="refreshData"
|
||||||
|
class="shadow-none" tyle="width: 100%" switch>
|
||||||
|
{{ $t('OR') }}
|
||||||
|
</b-form-checkbox>
|
||||||
|
</b-input-group-append>
|
||||||
|
</b-input-group>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
|
||||||
|
<b-input-group style="margin-top: 1vh">
|
||||||
|
<generic-multiselect @change="genericSelectChanged" parent_variable="search_books"
|
||||||
|
search_function="listRecipeBooks" label="name" style="width: 90%"
|
||||||
|
v-bind:placeholder="$t('Books')"></generic-multiselect>
|
||||||
|
<b-input-group-append is-text style="width: 10%">
|
||||||
|
<b-form-checkbox v-model="search_books_or" name="check-button" @change="refreshData"
|
||||||
|
class="shadow-none" tyle="width: 100%" switch>
|
||||||
|
{{ $t('OR') }}
|
||||||
|
</b-form-checkbox>
|
||||||
|
</b-input-group-append>
|
||||||
|
</b-input-group>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</b-collapse>
|
</b-collapse>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<multiselect
|
<multiselect
|
||||||
v-model="selected_objects"
|
v-model="selected_objects"
|
||||||
:options="objects"
|
:options="objects"
|
||||||
:close-on-select="false"
|
:close-on-select="true"
|
||||||
:clear-on-select="true"
|
:clear-on-select="true"
|
||||||
:hide-selected="true"
|
:hide-selected="true"
|
||||||
:preserve-search="true"
|
:preserve-search="true"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
"import_running": "Import running, please wait!",
|
"import_running": "Import running, please wait!",
|
||||||
"all_fields_optional": "All fields are optional and can be left empty.",
|
"all_fields_optional": "All fields are optional and can be left empty.",
|
||||||
"convert_internal": "Convert to internal recipe",
|
"convert_internal": "Convert to internal recipe",
|
||||||
|
"show_only_internal": "Show only internal recipes",
|
||||||
|
|
||||||
"Log_Recipe_Cooking": "Log Recipe Cooking",
|
"Log_Recipe_Cooking": "Log Recipe Cooking",
|
||||||
"External_Recipe_Image": "External Recipe Image",
|
"External_Recipe_Image": "External Recipe Image",
|
||||||
@ -41,5 +42,7 @@
|
|||||||
"Search": "Search",
|
"Search": "Search",
|
||||||
"Import": "Import",
|
"Import": "Import",
|
||||||
"Print": "Print",
|
"Print": "Print",
|
||||||
|
"OR": "OR",
|
||||||
|
"AND": "AND",
|
||||||
"Information": "Information"
|
"Information": "Information"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user