Conver web app theme to new settings app
This commit is contained in:
@@ -0,0 +1 @@
|
||||
|
||||
|
||||
30
apps/web_theme/settings.py
Normal file
30
apps/web_theme/settings.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""
|
||||
Configuration options for the web_theme app
|
||||
"""
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from smart_settings import SettingsNamespace, LocalScope
|
||||
|
||||
namespace = SettingsNamespace(name='web_theme', label=_(u'Web theme'), module='web_theme.settings')
|
||||
|
||||
namespace.add_setting(
|
||||
name='THEME',
|
||||
default=u'activo',
|
||||
description=_(u'CSS theme to apply, options are: amro, bec, bec-green, blue, default, djime-cerulean, drastic-dark, kathleene, olive, orange, red, reidb-greenish and warehouse.'),
|
||||
scopes=[LocalScope()]
|
||||
)
|
||||
|
||||
namespace.add_setting(
|
||||
name='ENABLE_SCROLL_JS',
|
||||
default=True,
|
||||
hidden=True,
|
||||
scopes=[LocalScope()]
|
||||
)
|
||||
|
||||
namespace.add_setting(
|
||||
name='VERBOSE_LOGIN',
|
||||
default=True,
|
||||
description=_(u'Display extra information in the login screen.'),
|
||||
scopes=[LocalScope()]
|
||||
)
|
||||
@@ -4,7 +4,7 @@ from django.conf import settings
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from web_theme.conf import settings as web_theme_settings
|
||||
from web_theme.settings import THEME, ENABLE_SCROLL_JS
|
||||
|
||||
register = Library()
|
||||
|
||||
@@ -14,8 +14,8 @@ class GetThemeNode(Node):
|
||||
self.var_name = var_name
|
||||
|
||||
def render(self, context):
|
||||
context['web_theme'] = web_theme_settings.THEME
|
||||
context['enable_scroll_js'] = web_theme_settings.ENABLE_SCROLL_JS
|
||||
context['web_theme'] = THEME
|
||||
context['enable_scroll_js'] = ENABLE_SCROLL_JS
|
||||
return ''
|
||||
|
||||
|
||||
@@ -56,7 +56,12 @@ class SettingsNode(Node):
|
||||
self.var_name = var_name
|
||||
|
||||
def render(self, context):
|
||||
context[self.var_name] = getattr(web_theme_settings, self.format_string, '')
|
||||
#TODO: fix properly
|
||||
if self.format_string == 'THEME':
|
||||
context[self.var_name] = THEME
|
||||
else:
|
||||
context[self.var_name] = ENABLE_SCROLL_JS
|
||||
#context[self.var_name] = getattr(web_theme_settings, self.format_string, '')
|
||||
return ''
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user