Skip to content

Commit

Permalink
[#2781] Intro text editable
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Aug 2, 2012
1 parent 7a6f00b commit 16c7c2e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
4 changes: 4 additions & 0 deletions ckan/controllers/admin.py
Expand Up @@ -48,6 +48,9 @@ def config(self):
about = data.get('about')
app_globals.set_global('ckan.site_about', about)

intro_text = data.get('intro_text')
app_globals.set_global('ckan.site_intro_text', intro_text)

if 'reset' in data:
# remove sys info items
for key in app_globals.auto_update:
Expand All @@ -68,6 +71,7 @@ def config(self):
data['style'] = g.main_css
data['tagline'] = g.site_description
data['about'] = g.site_about
data['intro_text'] = g.site_intro_text

vars = {'data': data, 'errors': {}, 'styles': styles}
return base.render('admin/config.html',
Expand Down
1 change: 1 addition & 0 deletions ckan/lib/app_globals.py
Expand Up @@ -23,6 +23,7 @@
'ckan.site_url',
'ckan.site_description',
'ckan.site_about',
'ckan.site_intro_text',
]

# A place to store the origional config options of we override them
Expand Down
2 changes: 2 additions & 0 deletions ckan/templates/admin/config.html
Expand Up @@ -18,6 +18,8 @@ <h1 class="page-heading">{{ _('Configuration Settings') }}</h1>

{{ form.markdown('about', id='field-about', label=_('About Text'), placeholder=_('About contents'), value=data.about, error=errors.about) }}

{{ form.markdown('intro_text', id='field-about', label=_('Intro Text'), placeholder=_('Intro contents'), value=data.intro_text, error=errors.intro_text) }}

<div class="form-actions">
<button type="submit" class="btn" name="reset">Reset</button>
<button type="submit" class="btn btn-primary" name="save">Update</button>
Expand Down
22 changes: 13 additions & 9 deletions ckan/templates/home/index.html
Expand Up @@ -23,16 +23,20 @@
<div class="module-content">
{% block home_primary %}
<header>
{% block home_primary_content %}
<h1 class="page-heading">{% block home_primary_heading %}{{ _("Welcome to CKAN") }}{% endblock %}</h1>
<p>
{% block home_primary_text %}
{% trans %}This is a nice introductory paragraph about CKAN or the site
in general. We don't have any copy to go here yet but soon we will
{% endtrans %}
{% if g.site_intro_text %}
{{ h.render_markdown(g.site_intro_text) }}
{% else %}
{% block home_primary_content %}
<h1 class="page-heading">{% block home_primary_heading %}{{ _("Welcome to CKAN") }}{% endblock %}</h1>
<p>
{% block home_primary_text %}
{% trans %}This is a nice introductory paragraph about CKAN or the site
in general. We don't have any copy to go here yet but soon we will
{% endtrans %}
{% endblock %}
</p>
{% endblock %}
</p>
{% endblock %}
{% endif %}
</header>
{% endblock %}

Expand Down

0 comments on commit 16c7c2e

Please sign in to comment.