mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-24 02:39:20 -05:00
fixed default page setting and made PWA respect that setting
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.10 on 2024-03-09 06:41
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cookbook', '0216_delete_shoppinglist'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='userpreference',
|
||||
name='default_page',
|
||||
field=models.CharField(choices=[('SEARCH', 'Search'), ('PLAN', 'Meal-Plan'), ('BOOKS', 'Books'), ('SHOPPING', 'Shopping')], default='SEARCH', max_length=64),
|
||||
),
|
||||
]
|
||||
@@ -449,11 +449,13 @@ class UserPreference(models.Model, PermissionModelMixin):
|
||||
SEARCH = 'SEARCH'
|
||||
PLAN = 'PLAN'
|
||||
BOOKS = 'BOOKS'
|
||||
SHOPPING = 'SHOPPING'
|
||||
|
||||
PAGES = (
|
||||
(SEARCH, _('Search')),
|
||||
(PLAN, _('Meal-Plan')),
|
||||
(BOOKS, _('Books')),
|
||||
(SHOPPING, _('Shopping')),
|
||||
)
|
||||
|
||||
user = AutoOneToOneField(User, on_delete=models.CASCADE, primary_key=True)
|
||||
|
||||
@@ -38,7 +38,7 @@ def index(request):
|
||||
return HttpResponseRedirect(reverse_lazy('view_search'))
|
||||
|
||||
try:
|
||||
page_map = {UserPreference.SEARCH: reverse_lazy('view_search'), UserPreference.PLAN: reverse_lazy('view_plan'), UserPreference.BOOKS: reverse_lazy('view_books'), }
|
||||
page_map = {UserPreference.SEARCH: reverse_lazy('view_search'), UserPreference.PLAN: reverse_lazy('view_plan'), UserPreference.BOOKS: reverse_lazy('view_books'), UserPreference.SHOPPING: reverse_lazy('view_shopping'),}
|
||||
|
||||
return HttpResponseRedirect(page_map.get(request.user.userpreference.default_page))
|
||||
except UserPreference.DoesNotExist:
|
||||
@@ -446,7 +446,7 @@ def web_manifest(request):
|
||||
theme_values['app_name'], "description":
|
||||
_("Manage recipes, shopping list, meal plans and more."), "icons":
|
||||
icons, "start_url":
|
||||
"./search", "background_color":
|
||||
"./", "background_color":
|
||||
theme_values['nav_bg_color'], "display":
|
||||
"standalone", "scope":
|
||||
".", "theme_color":
|
||||
@@ -454,7 +454,7 @@ def web_manifest(request):
|
||||
[{"name": _("Plan"), "short_name": _("Plan"), "description": _("View your meal Plan"), "url":
|
||||
"./plan"}, {"name": _("Books"), "short_name": _("Books"), "description": _("View your cookbooks"), "url": "./books"},
|
||||
{"name": _("Shopping"), "short_name": _("Shopping"), "description": _("View your shopping lists"), "url":
|
||||
"./list/shopping-list/"}], "share_target": {"action": "/data/import/url", "method": "GET", "params": {"title": "title", "url": "url", "text": "text"}}
|
||||
"./shopping/"}], "share_target": {"action": "/data/import/url", "method": "GET", "params": {"title": "title", "url": "url", "text": "text"}}
|
||||
}
|
||||
|
||||
return JsonResponse(manifest_info, json_dumps_params={'indent': 4})
|
||||
|
||||
@@ -37,6 +37,15 @@
|
||||
</b-form-checkbox>
|
||||
</b-form-group>
|
||||
|
||||
<b-form-group :label="$t('DefaultPage')">
|
||||
<b-form-select v-model="user_preferences.default_page" @change="updateSettings(true);">
|
||||
<b-form-select-option value="SEARCH">{{$t('Search')}}</b-form-select-option>
|
||||
<b-form-select-option value="SHOPPING">{{$t('Shopping')}}</b-form-select-option>
|
||||
<b-form-select-option value="PLAN">{{$t('Meal_Plan')}}</b-form-select-option>
|
||||
<b-form-select-option value="BOOKS">{{$t('Books')}}</b-form-select-option>
|
||||
</b-form-select>
|
||||
|
||||
</b-form-group>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
@@ -504,6 +504,7 @@
|
||||
"Keyword": "Keyword",
|
||||
"Advanced": "Advanced",
|
||||
"Page": "Page",
|
||||
"DefaultPage": "Default Page",
|
||||
"Single": "Single",
|
||||
"Multiple": "Multiple",
|
||||
"Reset": "Reset",
|
||||
|
||||
Reference in New Issue
Block a user