Skip to content

Commit

Permalink
Change templates to use g not config for settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Nov 21, 2012
1 parent a885db3 commit 944970a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
16 changes: 7 additions & 9 deletions ckan/templates/base.html
Expand Up @@ -41,7 +41,7 @@
<title>
{%- block title -%}
{%- block subtitle %}{% endblock -%}
{%- if self.subtitle()|trim %} {{ config.template_title_delimiter or '-' }} {% endif -%}
{%- if self.subtitle()|trim %} {{ g.template_title_delimiter }} {% endif -%}
{{ g.site_title }}
{%- endblock -%}
</title>
Expand All @@ -51,9 +51,7 @@
such as rss feeds and favicons in the same way as the meta block.
#}
{% block links -%}
{%- with favicon = config.get('ckan.favicon') or h.url_for_static('/base/images/ckan.ico') -%}
<link rel="shortcut icon" href="{{ favicon }}" />
{% endwith -%}
<link rel="shortcut icon" href="{{ g.favicon }}" />
{% endblock -%}

{#
Expand All @@ -72,9 +70,9 @@
{% resource g.main_css[6:] %}
{% endblock %}

{# defined in the config.ini under "ckan.template_head_end" #}
{% block head_extras %}
{{ config.get('ckan.template_head_end', '') | safe }}
{# defined in the config.ini under "ckan.template_head_end" #}
{{ g.template_head_end | safe }}
{% endblock %}

{%- block custom_styles %}
Expand All @@ -87,7 +85,7 @@
</head>

{# Allows custom attributes to be added to the <body> tag #}
<body{% block bodytag %} data-site-root="{{ h.url('/', locale='default', qualified=true) }}" data-locale-root="{{ h.url('/', qualified=true) }}" data-api-root="{{ config.get('ckan.api_url', '') }}"{% endblock %}>
<body{% block bodytag %} data-site-root="{{ h.url('/', locale='default', qualified=true) }}" data-locale-root="{{ h.url('/', qualified=true) }}" data-api-root="{{ g.api_url }}"{% endblock %}>

{#
The page block allows you to add content to the page. Most of the time it is
Expand Down Expand Up @@ -119,9 +117,9 @@
{%- block scripts %}
{% endblock -%}

{# defined in the config.ini under "ckan.template_footer_end" #}
{% block body_extras -%}
{{ config.get('ckan.template_footer_end', '') | safe }}
{# defined in the config.ini under "ckan.template_footer_end" #}
{{ g.template_footer_end | safe }}
{%- endblock %}
</body>
</html>
2 changes: 1 addition & 1 deletion ckan/templates/footer.html
Expand Up @@ -29,7 +29,7 @@
</div>

{% block footer_debug %}
{% if config.debug %}
{% if g.debug %}
{% include 'snippets/debug.html' %}
{% endif %}
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/header.html
@@ -1,5 +1,5 @@
<header class="masthead">
{% if config.debug %}
{% if g.debug %}
<div class="debug">Controller : {{ c.controller }}<br/>Action : {{ c.action }}</div>
{% endif %}
<div class="container">
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/package/resource_read.html
Expand Up @@ -32,7 +32,7 @@
</li>
{% endif %}

{% if 'datastore' in config.get('ckan.plugins') %}
{% if 'datastore' in g.plugins %}
<li>{% snippet 'package/snippets/data_api_button.html', resource=res, datastore_root_url=c.datastore_api %}</li>
{% endif %}
{% endblock %}
Expand Down
4 changes: 2 additions & 2 deletions ckan/templates/package/search.html
Expand Up @@ -75,8 +75,8 @@
You can also access this registry using the {{ h.link_to(_('API'), h.url_for(controller='api', action='get_api', ver=1)) }}
<!--! FIXME the API Docs link should be for the version of ckan being used but the dev version of ckan needs to point to latest so not trivial -->
(see {{ h.link_to(_('API Docs'), 'http://docs.ckan.org/en/latest/api.html') }})
{% if config.get('ckan.dumps_url') -%}
or download a <a href="{{ config.get('ckan.dumps_url') }}">full {{ config.get('ckan.dumps_format', '') }} dump</a>
{% if g.dumps_url -%}
or download a <a href="{{ g.dumps_url }}">full {{ g.dumps_format }} dump</a>
{%- endif %}.
</small>
</section>
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/page.html
Expand Up @@ -97,7 +97,7 @@ <h2>A sidebar item</h2>
{%- block scripts %}
{% resource 'base/main' %}
{% resource 'base/ckan' %}
{% if config.get('ckan.tracking_enabled', 'false') %}
{% if g.tracking_enabled %}
{% resource 'base/tracking.js' %}
{% endif %}
{{ super() }}
Expand Down

0 comments on commit 944970a

Please sign in to comment.