fixed old search made new search default

This commit is contained in:
vabene1111 2021-07-29 16:55:57 +02:00
parent 8642298eda
commit 12a438752b
5 changed files with 28 additions and 6 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.5 on 2021-07-29 14:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0141_auto_20210713_1042'),
]
operations = [
migrations.AlterField(
model_name='userpreference',
name='search_style',
field=models.CharField(choices=[('SMALL', 'Small'), ('LARGE', 'Large'), ('NEW', 'New')], default='NEW', max_length=64),
),
]

View File

@ -143,7 +143,7 @@ class UserPreference(models.Model, PermissionModelMixin):
choices=PAGES, max_length=64, default=SEARCH
)
search_style = models.CharField(
choices=SEARCH_STYLE, max_length=64, default=LARGE
choices=SEARCH_STYLE, max_length=64, default=NEW
)
show_recent = models.BooleanField(default=True)
plan_share = models.ManyToManyField(

View File

@ -28,7 +28,7 @@
</a>
</div>
<div class="col-md-8">
<div class="card-body">
<div class="card-body" style="padding: 16px">
<div class="d-flex">
<div class="flex-fill">
<h5 class="card-title p-0 m-0">{{ row.cells.name }}

View File

@ -133,7 +133,7 @@
:initial_selection="settings.search_keywords"
search_function="listKeywords" label="label"
style="flex-grow: 1; flex-shrink: 1; flex-basis: 0"
v-bind:placeholder="$t('Keywords')"></generic-multiselect>
v-bind:placeholder="$t('Keywords')" :limit="50"></generic-multiselect>
<b-input-group-append>
<b-input-group-text>
<b-form-checkbox v-model="settings.search_keywords_or" name="check-button"
@ -155,7 +155,7 @@
:initial_selection="settings.search_foods"
search_function="listFoods" label="name"
style="flex-grow: 1; flex-shrink: 1; flex-basis: 0"
v-bind:placeholder="$t('Ingredients')"></generic-multiselect>
v-bind:placeholder="$t('Ingredients')" :limit="20"></generic-multiselect>
<b-input-group-append>
<b-input-group-text>
<b-form-checkbox v-model="settings.search_foods_or" name="check-button"
@ -177,7 +177,7 @@
:initial_selection="settings.search_books"
search_function="listRecipeBooks" label="name"
style="flex-grow: 1; flex-shrink: 1; flex-basis: 0"
v-bind:placeholder="$t('Books')"></generic-multiselect>
v-bind:placeholder="$t('Books')" :limit="50"></generic-multiselect>
<b-input-group-append>
<b-input-group-text>
<b-form-checkbox v-model="settings.search_books_or" name="check-button"

View File

@ -37,6 +37,10 @@ export default {
label: String,
parent_variable: String,
initial_selection: Array,
limit: {
type: Number,
default: 10,
}
},
watch: {
initial_selection: function (newVal, oldVal) { // watch it
@ -50,7 +54,7 @@ export default {
search: function (query) {
let apiClient = new ApiApiFactory()
apiClient[this.search_function]({query: {query: query, limit: 10}}).then(result => {
apiClient[this.search_function]({query: {query: query, limit: this.limit}}).then(result => {
this.objects = result.data
})
},