diff --git a/cookbook/forms.py b/cookbook/forms.py index e2e9e2d6c..5015e0c23 100644 --- a/cookbook/forms.py +++ b/cookbook/forms.py @@ -30,7 +30,7 @@ class UserPreferenceForm(forms.ModelForm): class Meta: model = UserPreference - fields = ('default_unit', 'use_fractions', 'theme', 'nav_color', 'default_page', 'show_recent', 'search_style', 'plan_share', 'ingredient_decimals', 'shopping_auto_sync', 'comments') + fields = ('default_unit', 'use_fractions', 'theme', 'nav_color', 'sticky_navbar', 'default_page', 'show_recent', 'search_style', 'plan_share', 'ingredient_decimals', 'shopping_auto_sync', 'comments') help_texts = { 'nav_color': _('Color of the top navigation bar. Not all colors work with all themes, just try them out!'), @@ -42,7 +42,8 @@ class UserPreferenceForm(forms.ModelForm): 'comments': _('If you want to be able to create and see comments underneath recipes.'), 'shopping_auto_sync': _( 'Setting to 0 will disable auto sync. When viewing a shopping list the list is updated every set seconds to sync changes someone else might have made. Useful when shopping with multiple people but might use a little bit ' - 'of mobile data. If lower than instance limit it is reset when saving.') + 'of mobile data. If lower than instance limit it is reset when saving.'), + 'sticky_navbar': _('Makes the navbar stick to the top of the page.') } widgets = { diff --git a/cookbook/migrations/0095_auto_20210107_1804.py b/cookbook/migrations/0095_auto_20210107_1804.py new file mode 100644 index 000000000..d2b9fd2e5 --- /dev/null +++ b/cookbook/migrations/0095_auto_20210107_1804.py @@ -0,0 +1,24 @@ +# Generated by Django 3.1.5 on 2021-01-07 17:04 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cookbook', '0094_auto_20201231_1238'), + ] + + operations = [ + migrations.AddField( + model_name='userpreference', + name='sticky_navbar', + field=models.BooleanField(default=True), + ), + migrations.AlterField( + model_name='invitelink', + name='valid_until', + field=models.DateField(default=datetime.date(2021, 1, 21)), + ), + ] diff --git a/cookbook/models.py b/cookbook/models.py index 5d3b29045..f12364ab1 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -10,7 +10,7 @@ from django.utils.translation import gettext as _ from django.db import models from django_random_queryset import RandomManager -from recipes.settings import COMMENT_PREF_DEFAULT, FRACTION_PREF_DEFAULT +from recipes.settings import COMMENT_PREF_DEFAULT, FRACTION_PREF_DEFAULT, STICKY_NAV_PREF_DEFAULT def get_user_name(self): @@ -78,6 +78,7 @@ class UserPreference(models.Model): ingredient_decimals = models.IntegerField(default=2) comments = models.BooleanField(default=COMMENT_PREF_DEFAULT) shopping_auto_sync = models.IntegerField(default=5) + sticky_navbar = models.BooleanField(default=STICKY_NAV_PREF_DEFAULT) def __str__(self): return str(self.user) diff --git a/cookbook/templates/base.html b/cookbook/templates/base.html index b011b1d2b..45de3c80d 100644 --- a/cookbook/templates/base.html +++ b/cookbook/templates/base.html @@ -48,7 +48,7 @@
-