minor fixes

This commit is contained in:
vabene1111 2021-06-09 18:53:20 +02:00
parent f7d85bb4b8
commit 5e9ce955bc
11 changed files with 66 additions and 85 deletions

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -66,58 +66,25 @@
</div>
</div>
</div>
<!-- Import from Recipe Application -->
<div class=" tab-pane fade show" id="nav-app" role="tabpanel">
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-outline-info btn-sm active" @click="recipe_app='DEFAULT'">
<input type="radio" autocomplete="off" checked> Tandoor
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='PAPRIKA'">
<input type="radio" autocomplete="off"> Paprika
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='NEXTCLOUD'">
<input type="radio" autocomplete="off"> Nextcloud Cookbook
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='MEALIE'">
<input type="radio" autocomplete="off"> Mealie
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='CHOWDOWN'">
<input type="radio" autocomplete="off"> Chowdown
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='SAFRON'">
<input type="radio" autocomplete="off"> Safron
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='OPENEATS'">
<input type="radio" autocomplete="off"> Openeats
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='CHEFTAP'">
<input type="radio" autocomplete="off"> Cheftap
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='PEPPERPLATE'">
<input type="radio" autocomplete="off"> Pepperplate
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='RECIPESAGE'">
<input type="radio" autocomplete="off"> Recipesage
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='RECIPEKEEPER'">
<input type="radio" autocomplete="off"> Recipekeeper
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='DOMESTICA'">
<input type="radio" autocomplete="off"> Domestica
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='MEALMASTER'">
<input type="radio" autocomplete="off"> Mealmaster
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='REZKONV'">
<input type="radio" autocomplete="off"> Rezkonv
</label>
<label class="btn btn-outline-info btn-sm" @click="recipe_app='RECETTETEK'">
<input type="radio" autocomplete="off"> RecetteTek
</label>
<select class="form-control" v-model="recipe_app">
<option value="DEFAULT">Tandoor</option>
</div>
<option value="PAPRIKA">Paprika</option>
<option value="NEXTCLOUD">Nextcloud Cookbook</option>
<option value="MEALIE">Mealie</option>
<option value="CHOWDOWN">Chowdown</option>
<option value="SAFRON">Safron</option>
<option value="OPENEATS">Openeats</option>
<option value="CHEFTAP">Cheftap</option>
<option value="PEPPERPLATE">Pepperplate</option>
<option value="RECIPESAGE">Recipesage</option>
<option value="RECIPEKEEPER">Recipekeeper</option>
<option value="DOMESTICA">Domestica</option>
<option value="MEALMASTER">Mealmaster</option>
<option value="REZKONV">Rezkonv</option>
<option value="RECETTETEK">RecetteTek</option>
</select>
<b-form-checkbox v-model="import_duplicates" name="check-button" switch style="margin-top: 1vh">
{% trans 'To prevent duplicates recipes with the same name as existing ones are ignored. Check this box to import everything.' %}
@ -125,7 +92,6 @@
<b-form-file
class="my-2"
accept=".zip"
multiple
v-model="recipe_files"
placeholder="{% trans 'Select recipe files to import or drop them here...' %}"
@ -164,7 +130,7 @@
<div v-if="loading" class="text-center">
<br/>
{% if not request.user.is_authenticated or request.user.userpreference.theme == request.user.userpreference.TANDOOR %}
<img class="spinner-tandoor"/>
<img class="spinner-tandoor"/>
{% else %}
<i class="fas fa-spinner fa-spin fa-8x"></i>
{% endif %}

View File

@ -30,7 +30,7 @@
<div class="row">
<div class="col col-md-12">
<span>{{ $t('Import_finished') }}! </span>
<a :href="`${resolveDjangoUrl('view_search') }?keywords=${import_info.keyword.id}`"
<a :href="`${resolveDjangoUrl('view_search') }?keyword=${import_info.keyword.id}`"
v-if="import_info.keyword !== null">{{ $t('View_Recipes') }}</a>
</div>

View File

@ -42,7 +42,8 @@
</button>
</div>
<div class="col-md-2" style="position: relative; margin-top: 1vh">
<b-form-checkbox v-model="settings.search_internal" name="check-button" @change="refreshData"
<b-form-checkbox v-model="settings.search_internal" name="check-button"
@change="refreshData(false)"
class="shadow-none"
style="position:relative;top: 50%; transform: translateY(-50%);" switch>
{{ $t('show_only_internal') }}
@ -110,7 +111,7 @@
<b-input-group-append>
<b-input-group-text>
<b-form-checkbox v-model="settings.search_keywords_or" name="check-button"
@change="refreshData"
@change="refreshData(false)"
class="shadow-none" switch>
<span class="text-uppercase" v-if="settings.search_keywords_or">{{ $t('or') }}</span>
<span class="text-uppercase" v-else>{{ $t('and') }}</span>
@ -132,7 +133,7 @@
<b-input-group-append>
<b-input-group-text>
<b-form-checkbox v-model="settings.search_foods_or" name="check-button"
@change="refreshData"
@change="refreshData(false)"
class="shadow-none" switch>
<span class="text-uppercase" v-if="settings.search_foods_or">{{ $t('or') }}</span>
<span class="text-uppercase" v-else>{{ $t('and') }}</span>
@ -154,7 +155,7 @@
<b-input-group-append>
<b-input-group-text>
<b-form-checkbox v-model="settings.search_books_or" name="check-button"
@change="refreshData"
@change="refreshData(false)"
class="shadow-none" tyle="width: 100%" switch>
<span class="text-uppercase" v-if="settings.search_books_or">{{ $t('or') }}</span>
<span class="text-uppercase" v-else>{{ $t('and') }}</span>
@ -193,20 +194,13 @@
</div>
</div>
<div class="row" style="margin-top: 2vh">
<div class="row" style="margin-top: 2vh; text-align: center">
<div class="col col-md-12">
<b-pagination
v-model="pagination_page"
:total-rows="pagination_count"
per-page="25"
@change="pageChange"
align="center">
</b-pagination>
<b-button @click="loadMore()" class="btn-block btn-success" v-if="pagination_more">{{ $t('Load_More') }}
</b-button>
</div>
</div>
</div>
<div class="col-md-2 d-none d-md-block">
@ -264,7 +258,7 @@ export default {
recently_viewed: 5,
},
pagination_count: 0,
pagination_more: true,
pagination_page: 1,
}
@ -274,9 +268,24 @@ export default {
if (this.$cookies.isKey('search_settings_v2')) {
this.settings = this.$cookies.get("search_settings_v2")
}
let urlParams = new URLSearchParams(window.location.search);
let apiClient = new ApiApiFactory()
if (urlParams.has('keyword')) {
this.settings.search_keywords = []
for (let x of urlParams.getAll('keyword')) {
let keyword = {id: x, name: 'loading'}
this.settings.search_keywords.push(keyword)
apiClient.retrieveKeyword(x).then(result => {
this.$set(this.settings.search_keywords,this.settings.search_keywords.indexOf(keyword), result.data)
})
}
}
this.loadMealPlan()
this.loadRecentlyViewed()
this.refreshData()
this.refreshData(false)
})
this.$i18n.locale = window.CUSTOM_LOCALE
@ -295,11 +304,11 @@ export default {
this.loadRecentlyViewed()
},
'settings.search_input': _debounce(function () {
this.refreshData()
this.refreshData(false)
}, 300),
},
methods: {
refreshData: function () {
refreshData: function (page_load) {
let apiClient = new ApiApiFactory()
apiClient.listRecipes(
this.settings.search_input,
@ -320,8 +329,14 @@ export default {
undefined,
this.pagination_page,
).then(result => {
this.recipes = result.data.results
this.pagination_count = result.data.count
this.pagination_more = (result.data.next !== null)
if (page_load) {
for (let x of result.data.results) {
this.recipes.push(x)
}
} else {
this.recipes = result.data.results
}
})
},
loadMealPlan: function () {
@ -355,7 +370,7 @@ export default {
},
genericSelectChanged: function (obj) {
this.settings[obj.var] = obj.val
this.refreshData()
this.refreshData(false)
},
resetSearch: function () {
this.settings.search_input = ''
@ -363,11 +378,11 @@ export default {
this.settings.search_keywords = []
this.settings.search_foods = []
this.settings.search_books = []
this.refreshData()
this.refreshData(false)
},
pageChange: function (page) {
this.pagination_page = page
this.refreshData()
loadMore: function (page) {
this.pagination_page++
this.refreshData(true)
}
}
}

View File

@ -10,7 +10,6 @@
style="float:right; text-align: right; padding-top: 10px; padding-right: 5px">
<recipe-context-menu :recipe="recipe" style="float:right" v-if="recipe !== null"></recipe-context-menu>
</div>
</a>
<b-card-body>

View File

@ -32,6 +32,7 @@
"Url_Import": "Url Import",
"Reset_Search": "Reset Search",
"Recently_Viewed": "Recently Viewed",
"Load_More": "Load More",
"Keywords": "Keywords",
"Books": "Books",