Skip to content

Commit

Permalink
[#2302] config for improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Jul 27, 2012
1 parent 390a183 commit d1abd87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions ckan/controllers/admin.py
Expand Up @@ -31,15 +31,24 @@ def __before__(self, action, **params):
def config(self):
app_globals = base.pylons_globals().get('g')
data = request.POST

style = data.get('style')
if style:
style ='/base/css/%s.css' % style
app_globals.set_main_css(style)

site_title = data.get('title')
if site_title:
app_globals.set_global('site_title', site_title)
styles = ['main', 'red', 'green', 'fuchsia']

styles = [('Default', '/base/css/main.css'),
('Red', '/base/css/red.css'),
('Green', '/base/css/green.css'),
('Fuchsia', '/base/css/fuchsia.css')]
data = {}

data['title'] = app_globals.site_title
data['style'] = app_globals.main_css

vars = {'data': data, 'errors': {}, 'styles': styles}
return base.render('admin/config.html',
extra_vars = vars)
Expand Down
4 changes: 2 additions & 2 deletions ckan/templates/admin/config.html
Expand Up @@ -16,8 +16,8 @@ <h1 class="page-heading">{{ _('Configuration Settings') }}</h1>
<label for="style" class="control-label">Style</label>
<div class="controls">
<select name="style">
{% for style in styles|sort %}
<option value="{{ style }}" >{{ style }}</option>
{% for style, css in styles|sort %}
<option value="{{ css }}" {% if css == data.style %}selected="selected"{% endif %} >{{ style }}</option>
{% endfor %}
</select>
</div>
Expand Down

0 comments on commit d1abd87

Please sign in to comment.