added force theme
This commit is contained in:
parent
25c8f18b79
commit
58989a96e3
@ -3,7 +3,7 @@ from django.templatetags.static import static
|
||||
from django_scopes import scopes_disabled
|
||||
|
||||
from cookbook.models import UserPreference, UserFile, Space
|
||||
from recipes.settings import STICKY_NAV_PREF_DEFAULT, UNAUTHENTICATED_THEME_FROM_SPACE
|
||||
from recipes.settings import STICKY_NAV_PREF_DEFAULT, UNAUTHENTICATED_THEME_FROM_SPACE, FORCE_THEME_FROM_SPACE
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@ -15,11 +15,14 @@ def theme_values(request):
|
||||
|
||||
def get_theming_values(request):
|
||||
space = None
|
||||
if getattr(request,'space',None):
|
||||
if getattr(request, 'space', None):
|
||||
space = request.space
|
||||
if not request.user.is_authenticated and UNAUTHENTICATED_THEME_FROM_SPACE > 0:
|
||||
if not request.user.is_authenticated and UNAUTHENTICATED_THEME_FROM_SPACE > 0 and FORCE_THEME_FROM_SPACE == 0:
|
||||
with scopes_disabled():
|
||||
space = Space.objects.filter(id=UNAUTHENTICATED_THEME_FROM_SPACE).first()
|
||||
if FORCE_THEME_FROM_SPACE:
|
||||
with scopes_disabled():
|
||||
space = Space.objects.filter(id=FORCE_THEME_FROM_SPACE).first()
|
||||
|
||||
themes = {
|
||||
UserPreference.BOOTSTRAP: 'themes/bootstrap.min.css',
|
||||
|
@ -560,6 +560,15 @@ With this setting you can specify the ID of a space of which the appearance sett
|
||||
UNAUTHENTICATED_THEME_FROM_SPACE=
|
||||
```
|
||||
|
||||
#### Force Theme
|
||||
> default `0` - options `1-X` (space ID)
|
||||
|
||||
Similar to the Default theme but forces the theme upon all users (authenticated/unauthenticated) and all spaces
|
||||
|
||||
```
|
||||
FORCE_THEME_FROM_SPACE=
|
||||
```
|
||||
|
||||
### Rate Limiting / Performance
|
||||
|
||||
#### Shopping auto sync
|
||||
|
@ -59,6 +59,7 @@ KJ_PREF_DEFAULT = bool(int(os.getenv('KJ_PREF_DEFAULT', False)))
|
||||
STICKY_NAV_PREF_DEFAULT = bool(int(os.getenv('STICKY_NAV_PREF_DEFAULT', True)))
|
||||
MAX_OWNED_SPACES_PREF_DEFAULT = int(os.getenv('MAX_OWNED_SPACES_PREF_DEFAULT', 100))
|
||||
UNAUTHENTICATED_THEME_FROM_SPACE = int(os.getenv('UNAUTHENTICATED_THEME_FROM_SPACE', 0))
|
||||
FORCE_THEME_FROM_SPACE = int(os.getenv('FORCE_THEME_FROM_SPACE', 0))
|
||||
|
||||
# minimum interval that users can set for automatic sync of shopping lists
|
||||
SHOPPING_MIN_AUTOSYNC_INTERVAL = int(
|
||||
|
Loading…
Reference in New Issue
Block a user