mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-04 21:58:54 -05:00
show recently added recipes in search
This commit is contained in:
@@ -13,8 +13,7 @@
|
||||
|
||||
|
||||
<b-input-group class="mt-3">
|
||||
<b-input class="form-control" v-model="search_input" @keyup="refreshData"
|
||||
v-bind:placeholder="$t('Search')"></b-input>
|
||||
<b-input class="form-control" v-model="search_input" v-bind:placeholder="$t('Search')"></b-input>
|
||||
<b-input-group-append>
|
||||
<b-button v-b-toggle.collapse_advanced_search variant="primary" class="shadow-none"><i
|
||||
class="fas fa-caret-down" v-if="!settings.advanced_search_visible"></i><i class="fas fa-caret-up"
|
||||
@@ -224,6 +223,7 @@ import {BootstrapVue} from 'bootstrap-vue'
|
||||
|
||||
import 'bootstrap-vue/dist/bootstrap-vue.css'
|
||||
import moment from 'moment'
|
||||
import _debounce from 'lodash/debounce'
|
||||
|
||||
import VueCookies from 'vue-cookies'
|
||||
|
||||
@@ -295,6 +295,9 @@ export default {
|
||||
'settings.recently_viewed': function () {
|
||||
this.loadRecentlyViewed()
|
||||
},
|
||||
search_input: _debounce(function () {
|
||||
this.refreshData()
|
||||
}, 300),
|
||||
},
|
||||
methods: {
|
||||
refreshData: function () {
|
||||
@@ -344,7 +347,7 @@ export default {
|
||||
loadRecentlyViewed: function () {
|
||||
let apiClient = new ApiApiFactory()
|
||||
if (this.settings.recently_viewed > 0) {
|
||||
apiClient.listRecipes({query: {last_viewed: this.settings.recently_viewed}}).then(result => {
|
||||
apiClient.listRecipes({options: {query: {last_viewed: this.settings.recently_viewed}}}).then(result => {
|
||||
this.last_viewed_recipes = result.data.results
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
{{ recipe.description }}
|
||||
<keywords :recipe="recipe" style="margin-top: 4px"></keywords>
|
||||
<b-badge pill variant="info" v-if="!recipe.internal">{{ $t('External') }}</b-badge>
|
||||
<b-badge pill variant="success" v-if="Date.parse(recipe.created_at) > new Date(Date.now() - (7 * (1000 * 60 * 60 * 24)))">{{ $t('New') }}</b-badge>
|
||||
</template>
|
||||
<template v-else>{{ meal_plan.note }}</template>
|
||||
</b-card-text>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
"Rating": "Rating",
|
||||
"Close": "Close",
|
||||
"Add": "Add",
|
||||
"New": "New",
|
||||
"Ingredients": "Ingredients",
|
||||
"min": "min",
|
||||
"Servings": "Servings",
|
||||
|
||||
Reference in New Issue
Block a user