mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-09 16:18:00 -05:00
added created_by scroller to start page
This commit is contained in:
@@ -70,7 +70,6 @@ class RecipeSearch():
|
|||||||
}
|
}
|
||||||
self._steps = self._params.get('steps', None)
|
self._steps = self._params.get('steps', None)
|
||||||
self._units = self._params.get('units', None)
|
self._units = self._params.get('units', None)
|
||||||
# TODO add created by
|
|
||||||
# TODO image exists
|
# TODO image exists
|
||||||
self._sort_order = self._params.get('sort_order', None)
|
self._sort_order = self._params.get('sort_order', None)
|
||||||
self._internal = str2bool(self._params.get('internal', None))
|
self._internal = str2bool(self._params.get('internal', None))
|
||||||
@@ -82,6 +81,7 @@ class RecipeSearch():
|
|||||||
self._timescooked = self._params.get('timescooked', None)
|
self._timescooked = self._params.get('timescooked', None)
|
||||||
self._cookedon = self._params.get('cookedon', None)
|
self._cookedon = self._params.get('cookedon', None)
|
||||||
self._createdon = self._params.get('createdon', None)
|
self._createdon = self._params.get('createdon', None)
|
||||||
|
self._createdby = self._params.get('createdby', None)
|
||||||
self._updatedon = self._params.get('updatedon', None)
|
self._updatedon = self._params.get('updatedon', None)
|
||||||
self._viewedon = self._params.get('viewedon', None)
|
self._viewedon = self._params.get('viewedon', None)
|
||||||
self._makenow = self._params.get('makenow', None)
|
self._makenow = self._params.get('makenow', None)
|
||||||
@@ -132,6 +132,7 @@ class RecipeSearch():
|
|||||||
self._recently_viewed(num_recent=self._num_recent)
|
self._recently_viewed(num_recent=self._num_recent)
|
||||||
self._cooked_on_filter(cooked_date=self._cookedon)
|
self._cooked_on_filter(cooked_date=self._cookedon)
|
||||||
self._created_on_filter(created_date=self._createdon)
|
self._created_on_filter(created_date=self._createdon)
|
||||||
|
self._created_by_filter(created_by_user_id=self._createdby)
|
||||||
self._updated_on_filter(updated_date=self._updatedon)
|
self._updated_on_filter(updated_date=self._updatedon)
|
||||||
self._viewed_on_filter(viewed_date=self._viewedon)
|
self._viewed_on_filter(viewed_date=self._viewedon)
|
||||||
self._favorite_recipes(times_cooked=self._timescooked)
|
self._favorite_recipes(times_cooked=self._timescooked)
|
||||||
@@ -257,6 +258,11 @@ class RecipeSearch():
|
|||||||
else:
|
else:
|
||||||
self._queryset = self._queryset.filter(created_at__date__gte=created_date)
|
self._queryset = self._queryset.filter(created_at__date__gte=created_date)
|
||||||
|
|
||||||
|
def _created_by_filter(self, created_by_user_id=None):
|
||||||
|
if created_by_user_id is None:
|
||||||
|
return
|
||||||
|
self._queryset = self._queryset.filter(created_by__id=created_by_user_id)
|
||||||
|
|
||||||
def _updated_on_filter(self, updated_date=None):
|
def _updated_on_filter(self, updated_date=None):
|
||||||
if updated_date is None:
|
if updated_date is None:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1141,6 +1141,11 @@ class RecipePagination(PageNumberPagination):
|
|||||||
type=str,
|
type=str,
|
||||||
examples=[DateExample, BeforeDateExample]
|
examples=[DateExample, BeforeDateExample]
|
||||||
),
|
),
|
||||||
|
OpenApiParameter(
|
||||||
|
name='createdby',
|
||||||
|
description=_('Filter recipes for ones created by the given user ID'),
|
||||||
|
type=int,
|
||||||
|
),
|
||||||
OpenApiParameter(
|
OpenApiParameter(
|
||||||
name='updatedon',
|
name='updatedon',
|
||||||
description=_('Filter recipes updated on or after YYYY-MM-DD. Prepending ''-'' filters on or before date.'),
|
description=_('Filter recipes updated on or after YYYY-MM-DD. Prepending ''-'' filters on or before date.'),
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<v-window-item v-for="w in recipeWindows" class="pt-1 pb-1">
|
<v-window-item v-for="w in recipeWindows" class="pt-1 pb-1">
|
||||||
<v-row dense>
|
<v-row dense>
|
||||||
<v-col class="pr-0 pl-0" v-for="r in w" :key="r.id">
|
<v-col class="pr-0 pl-0" v-for="r in w" :key="r.id">
|
||||||
<recipe-card :recipe="r" :show_description="true" :show_keywords="true" ></recipe-card>
|
<recipe-card :recipe="r" :show_description="true" :show_keywords="true"></recipe-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-window-item>
|
</v-window-item>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
import {computed, onMounted, PropType, ref, toRefs} from 'vue'
|
import {computed, onMounted, PropType, ref, toRefs} from 'vue'
|
||||||
import RecipeCard from "@/components/display/RecipeCard.vue";
|
import RecipeCard from "@/components/display/RecipeCard.vue";
|
||||||
import {DisplayBreakpoint, useDisplay} from "vuetify";
|
import {DisplayBreakpoint, useDisplay} from "vuetify";
|
||||||
import {ApiApi, ApiRecipeListRequest, Keyword, Recipe, RecipeOverview} from "@/openapi";
|
import {ApiApi, ApiRecipeListRequest, Keyword, Recipe, RecipeOverview, User} from "@/openapi";
|
||||||
import {homePageCols} from "@/utils/breakpoint_utils";
|
import {homePageCols} from "@/utils/breakpoint_utils";
|
||||||
import {useI18n} from "vue-i18n";
|
import {useI18n} from "vue-i18n";
|
||||||
import {DateTime} from "luxon";
|
import {DateTime} from "luxon";
|
||||||
@@ -50,7 +50,7 @@ import {tr} from "vuetify/locale";
|
|||||||
//TODO mode ideas "last year/month/cooked long ago"
|
//TODO mode ideas "last year/month/cooked long ago"
|
||||||
const props = defineProps(
|
const props = defineProps(
|
||||||
{
|
{
|
||||||
mode: {type: String as PropType<'recent' | 'new' | 'keyword' | 'rating' | 'random'>, required: true},
|
mode: {type: String as PropType<'recent' | 'new' | 'keyword' | 'rating' | 'random' | 'created_by'>, required: true},
|
||||||
skeletons: {type: Number, default: 0},
|
skeletons: {type: Number, default: 0},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -61,6 +61,7 @@ const {name} = useDisplay()
|
|||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const recipes = ref([] as Recipe[] | RecipeOverview[])
|
const recipes = ref([] as Recipe[] | RecipeOverview[])
|
||||||
const keyword = ref({} as Keyword)
|
const keyword = ref({} as Keyword)
|
||||||
|
const createdByUser = ref({} as User)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* determine title based on type
|
* determine title based on type
|
||||||
@@ -80,6 +81,11 @@ const title = computed(() => {
|
|||||||
return keyword.value.label
|
return keyword.value.label
|
||||||
}
|
}
|
||||||
return t('Keyword')
|
return t('Keyword')
|
||||||
|
case 'created_by':
|
||||||
|
if (Object.keys(createdByUser.value).length > 0) {
|
||||||
|
return t('CreatedBy') + ' ' + createdByUser.value.displayName
|
||||||
|
}
|
||||||
|
return t('CreatedBy')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -98,6 +104,8 @@ const icon = computed(() => {
|
|||||||
return 'fa-solid fa-star'
|
return 'fa-solid fa-star'
|
||||||
case 'keyword':
|
case 'keyword':
|
||||||
return 'fa-solid fa-tags'
|
return 'fa-solid fa-tags'
|
||||||
|
case 'created_by':
|
||||||
|
return 'fa-solid fa-user'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -143,6 +151,18 @@ function loadRecipes() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
return;
|
return;
|
||||||
|
case 'created_by':
|
||||||
|
api.apiUserList({}).then((r) => {
|
||||||
|
if (r.length > 0) {
|
||||||
|
createdByUser.value = r[Math.floor(Math.random() * r.length)]
|
||||||
|
requestParameters.createdby = createdByUser.value.id
|
||||||
|
requestParameters.random = "true"
|
||||||
|
doRecipeRequest(requestParameters)
|
||||||
|
} else {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
doRecipeRequest(requestParameters)
|
doRecipeRequest(requestParameters)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ models/AccessToken.ts
|
|||||||
models/AuthToken.ts
|
models/AuthToken.ts
|
||||||
models/AutoMealPlan.ts
|
models/AutoMealPlan.ts
|
||||||
models/Automation.ts
|
models/Automation.ts
|
||||||
|
models/AutomationTypeEnum.ts
|
||||||
|
models/BaseUnitEnum.ts
|
||||||
models/BookmarkletImport.ts
|
models/BookmarkletImport.ts
|
||||||
models/BookmarkletImportList.ts
|
models/BookmarkletImportList.ts
|
||||||
models/ConnectorConfigConfig.ts
|
models/ConnectorConfigConfig.ts
|
||||||
@@ -31,6 +33,16 @@ models/MealPlan.ts
|
|||||||
models/MealType.ts
|
models/MealType.ts
|
||||||
models/MethodEnum.ts
|
models/MethodEnum.ts
|
||||||
models/NutritionInformation.ts
|
models/NutritionInformation.ts
|
||||||
|
models/OpenDataCategory.ts
|
||||||
|
models/OpenDataConversion.ts
|
||||||
|
models/OpenDataFood.ts
|
||||||
|
models/OpenDataFoodProperty.ts
|
||||||
|
models/OpenDataProperty.ts
|
||||||
|
models/OpenDataStore.ts
|
||||||
|
models/OpenDataStoreCategory.ts
|
||||||
|
models/OpenDataUnit.ts
|
||||||
|
models/OpenDataUnitTypeEnum.ts
|
||||||
|
models/OpenDataVersion.ts
|
||||||
models/PaginatedAutomationList.ts
|
models/PaginatedAutomationList.ts
|
||||||
models/PaginatedBookmarkletImportListList.ts
|
models/PaginatedBookmarkletImportListList.ts
|
||||||
models/PaginatedCookLogList.ts
|
models/PaginatedCookLogList.ts
|
||||||
@@ -77,6 +89,13 @@ models/PatchedInviteLink.ts
|
|||||||
models/PatchedKeyword.ts
|
models/PatchedKeyword.ts
|
||||||
models/PatchedMealPlan.ts
|
models/PatchedMealPlan.ts
|
||||||
models/PatchedMealType.ts
|
models/PatchedMealType.ts
|
||||||
|
models/PatchedOpenDataCategory.ts
|
||||||
|
models/PatchedOpenDataConversion.ts
|
||||||
|
models/PatchedOpenDataFood.ts
|
||||||
|
models/PatchedOpenDataProperty.ts
|
||||||
|
models/PatchedOpenDataStore.ts
|
||||||
|
models/PatchedOpenDataUnit.ts
|
||||||
|
models/PatchedOpenDataVersion.ts
|
||||||
models/PatchedProperty.ts
|
models/PatchedProperty.ts
|
||||||
models/PatchedPropertyType.ts
|
models/PatchedPropertyType.ts
|
||||||
models/PatchedRecipe.ts
|
models/PatchedRecipe.ts
|
||||||
@@ -136,7 +155,6 @@ models/SupermarketCategoryRelation.ts
|
|||||||
models/Sync.ts
|
models/Sync.ts
|
||||||
models/SyncLog.ts
|
models/SyncLog.ts
|
||||||
models/ThemeEnum.ts
|
models/ThemeEnum.ts
|
||||||
models/TypeEnum.ts
|
|
||||||
models/Unit.ts
|
models/Unit.ts
|
||||||
models/UnitConversion.ts
|
models/UnitConversion.ts
|
||||||
models/User.ts
|
models/User.ts
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -13,13 +13,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { mapValues } from '../runtime';
|
import { mapValues } from '../runtime';
|
||||||
import type { TypeEnum } from './TypeEnum';
|
import type { AutomationTypeEnum } from './AutomationTypeEnum';
|
||||||
import {
|
import {
|
||||||
TypeEnumFromJSON,
|
AutomationTypeEnumFromJSON,
|
||||||
TypeEnumFromJSONTyped,
|
AutomationTypeEnumFromJSONTyped,
|
||||||
TypeEnumToJSON,
|
AutomationTypeEnumToJSON,
|
||||||
TypeEnumToJSONTyped,
|
AutomationTypeEnumToJSONTyped,
|
||||||
} from './TypeEnum';
|
} from './AutomationTypeEnum';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -35,10 +35,10 @@ export interface Automation {
|
|||||||
id?: number;
|
id?: number;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {TypeEnum}
|
* @type {AutomationTypeEnum}
|
||||||
* @memberof Automation
|
* @memberof Automation
|
||||||
*/
|
*/
|
||||||
type: TypeEnum;
|
type: AutomationTypeEnum;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@@ -111,7 +111,7 @@ export function AutomationFromJSONTyped(json: any, ignoreDiscriminator: boolean)
|
|||||||
return {
|
return {
|
||||||
|
|
||||||
'id': json['id'] == null ? undefined : json['id'],
|
'id': json['id'] == null ? undefined : json['id'],
|
||||||
'type': TypeEnumFromJSON(json['type']),
|
'type': AutomationTypeEnumFromJSON(json['type']),
|
||||||
'name': json['name'] == null ? undefined : json['name'],
|
'name': json['name'] == null ? undefined : json['name'],
|
||||||
'description': json['description'] == null ? undefined : json['description'],
|
'description': json['description'] == null ? undefined : json['description'],
|
||||||
'param1': json['param_1'] == null ? undefined : json['param_1'],
|
'param1': json['param_1'] == null ? undefined : json['param_1'],
|
||||||
@@ -135,7 +135,7 @@ export function AutomationToJSONTyped(value?: Omit<Automation, 'created_by'> | n
|
|||||||
return {
|
return {
|
||||||
|
|
||||||
'id': value['id'],
|
'id': value['id'],
|
||||||
'type': TypeEnumToJSON(value['type']),
|
'type': AutomationTypeEnumToJSON(value['type']),
|
||||||
'name': value['name'],
|
'name': value['name'],
|
||||||
'description': value['description'],
|
'description': value['description'],
|
||||||
'param_1': value['param1'],
|
'param_1': value['param1'],
|
||||||
|
|||||||
@@ -13,13 +13,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { mapValues } from '../runtime';
|
import { mapValues } from '../runtime';
|
||||||
import type { TypeEnum } from './TypeEnum';
|
import type { AutomationTypeEnum } from './AutomationTypeEnum';
|
||||||
import {
|
import {
|
||||||
TypeEnumFromJSON,
|
AutomationTypeEnumFromJSON,
|
||||||
TypeEnumFromJSONTyped,
|
AutomationTypeEnumFromJSONTyped,
|
||||||
TypeEnumToJSON,
|
AutomationTypeEnumToJSON,
|
||||||
TypeEnumToJSONTyped,
|
AutomationTypeEnumToJSONTyped,
|
||||||
} from './TypeEnum';
|
} from './AutomationTypeEnum';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -35,10 +35,10 @@ export interface PatchedAutomation {
|
|||||||
id?: number;
|
id?: number;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {TypeEnum}
|
* @type {AutomationTypeEnum}
|
||||||
* @memberof PatchedAutomation
|
* @memberof PatchedAutomation
|
||||||
*/
|
*/
|
||||||
type?: TypeEnum;
|
type?: AutomationTypeEnum;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@@ -109,7 +109,7 @@ export function PatchedAutomationFromJSONTyped(json: any, ignoreDiscriminator: b
|
|||||||
return {
|
return {
|
||||||
|
|
||||||
'id': json['id'] == null ? undefined : json['id'],
|
'id': json['id'] == null ? undefined : json['id'],
|
||||||
'type': json['type'] == null ? undefined : TypeEnumFromJSON(json['type']),
|
'type': json['type'] == null ? undefined : AutomationTypeEnumFromJSON(json['type']),
|
||||||
'name': json['name'] == null ? undefined : json['name'],
|
'name': json['name'] == null ? undefined : json['name'],
|
||||||
'description': json['description'] == null ? undefined : json['description'],
|
'description': json['description'] == null ? undefined : json['description'],
|
||||||
'param1': json['param_1'] == null ? undefined : json['param_1'],
|
'param1': json['param_1'] == null ? undefined : json['param_1'],
|
||||||
@@ -133,7 +133,7 @@ export function PatchedAutomationToJSONTyped(value?: Omit<PatchedAutomation, 'cr
|
|||||||
return {
|
return {
|
||||||
|
|
||||||
'id': value['id'],
|
'id': value['id'],
|
||||||
'type': TypeEnumToJSON(value['type']),
|
'type': AutomationTypeEnumToJSON(value['type']),
|
||||||
'name': value['name'],
|
'name': value['name'],
|
||||||
'description': value['description'],
|
'description': value['description'],
|
||||||
'param_1': value['param1'],
|
'param_1': value['param1'],
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ export * from './AccessToken';
|
|||||||
export * from './AuthToken';
|
export * from './AuthToken';
|
||||||
export * from './AutoMealPlan';
|
export * from './AutoMealPlan';
|
||||||
export * from './Automation';
|
export * from './Automation';
|
||||||
|
export * from './AutomationTypeEnum';
|
||||||
|
export * from './BaseUnitEnum';
|
||||||
export * from './BookmarkletImport';
|
export * from './BookmarkletImport';
|
||||||
export * from './BookmarkletImportList';
|
export * from './BookmarkletImportList';
|
||||||
export * from './ConnectorConfigConfig';
|
export * from './ConnectorConfigConfig';
|
||||||
@@ -28,6 +30,16 @@ export * from './MealPlan';
|
|||||||
export * from './MealType';
|
export * from './MealType';
|
||||||
export * from './MethodEnum';
|
export * from './MethodEnum';
|
||||||
export * from './NutritionInformation';
|
export * from './NutritionInformation';
|
||||||
|
export * from './OpenDataCategory';
|
||||||
|
export * from './OpenDataConversion';
|
||||||
|
export * from './OpenDataFood';
|
||||||
|
export * from './OpenDataFoodProperty';
|
||||||
|
export * from './OpenDataProperty';
|
||||||
|
export * from './OpenDataStore';
|
||||||
|
export * from './OpenDataStoreCategory';
|
||||||
|
export * from './OpenDataUnit';
|
||||||
|
export * from './OpenDataUnitTypeEnum';
|
||||||
|
export * from './OpenDataVersion';
|
||||||
export * from './PaginatedAutomationList';
|
export * from './PaginatedAutomationList';
|
||||||
export * from './PaginatedBookmarkletImportListList';
|
export * from './PaginatedBookmarkletImportListList';
|
||||||
export * from './PaginatedCookLogList';
|
export * from './PaginatedCookLogList';
|
||||||
@@ -74,6 +86,13 @@ export * from './PatchedInviteLink';
|
|||||||
export * from './PatchedKeyword';
|
export * from './PatchedKeyword';
|
||||||
export * from './PatchedMealPlan';
|
export * from './PatchedMealPlan';
|
||||||
export * from './PatchedMealType';
|
export * from './PatchedMealType';
|
||||||
|
export * from './PatchedOpenDataCategory';
|
||||||
|
export * from './PatchedOpenDataConversion';
|
||||||
|
export * from './PatchedOpenDataFood';
|
||||||
|
export * from './PatchedOpenDataProperty';
|
||||||
|
export * from './PatchedOpenDataStore';
|
||||||
|
export * from './PatchedOpenDataUnit';
|
||||||
|
export * from './PatchedOpenDataVersion';
|
||||||
export * from './PatchedProperty';
|
export * from './PatchedProperty';
|
||||||
export * from './PatchedPropertyType';
|
export * from './PatchedPropertyType';
|
||||||
export * from './PatchedRecipe';
|
export * from './PatchedRecipe';
|
||||||
@@ -133,7 +152,6 @@ export * from './SupermarketCategoryRelation';
|
|||||||
export * from './Sync';
|
export * from './Sync';
|
||||||
export * from './SyncLog';
|
export * from './SyncLog';
|
||||||
export * from './ThemeEnum';
|
export * from './ThemeEnum';
|
||||||
export * from './TypeEnum';
|
|
||||||
export * from './Unit';
|
export * from './Unit';
|
||||||
export * from './UnitConversion';
|
export * from './UnitConversion';
|
||||||
export * from './User';
|
export * from './User';
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<horizontal-recipe-scroller :skeletons="4" mode="new"></horizontal-recipe-scroller>
|
<horizontal-recipe-scroller :skeletons="4" mode="new"></horizontal-recipe-scroller>
|
||||||
<horizontal-recipe-scroller :skeletons="4" mode="keyword"></horizontal-recipe-scroller>
|
<horizontal-recipe-scroller :skeletons="4" mode="keyword"></horizontal-recipe-scroller>
|
||||||
<horizontal-recipe-scroller :skeletons="4" mode="random"></horizontal-recipe-scroller>
|
<horizontal-recipe-scroller :skeletons="4" mode="random"></horizontal-recipe-scroller>
|
||||||
|
<horizontal-recipe-scroller :skeletons="4" mode="created_by"></horizontal-recipe-scroller>
|
||||||
<horizontal-recipe-scroller :skeletons="2" mode="rating"></horizontal-recipe-scroller>
|
<horizontal-recipe-scroller :skeletons="2" mode="rating"></horizontal-recipe-scroller>
|
||||||
<horizontal-recipe-scroller :skeletons="4" mode="keyword"></horizontal-recipe-scroller>
|
<horizontal-recipe-scroller :skeletons="4" mode="keyword"></horizontal-recipe-scroller>
|
||||||
<horizontal-recipe-scroller :skeletons="4" mode="random"></horizontal-recipe-scroller>
|
<horizontal-recipe-scroller :skeletons="4" mode="random"></horizontal-recipe-scroller>
|
||||||
|
|||||||
Reference in New Issue
Block a user