Skip to content

Commit

Permalink
Merge pull request #51 from derilinx/master
Browse files Browse the repository at this point in the history
Upgrade to font-awesome 4 without breaking compatibility with older CKANs (FA 3)
  • Loading branch information
torfsen authored May 23, 2017
2 parents 1734f20 + 718a84d commit 4d3e401
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 9 deletions.
13 changes: 12 additions & 1 deletion ckanext/pages/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ def get_recent_blog_posts(number=5, exclude=None):
return new_list


def get_plus_icon():
ckan_version = float(h.ckan_version()[0:3])
if ckan_version >= 2.7:
icon = 'plus-square'
else:
icon = 'plus-sign-alt'

return icon


class PagesPlugin(PagesPluginBase):
p.implements(p.IConfigurer, inherit=True)
p.implements(p.ITemplateHelpers, inherit=True)
Expand Down Expand Up @@ -124,7 +134,8 @@ def get_helpers(self):
'build_nav_main': build_pages_nav_main,
'render_content': render_content,
'get_wysiwyg_editor': get_wysiwyg_editor,
'get_recent_blog_posts': get_recent_blog_posts
'get_recent_blog_posts': get_recent_blog_posts,
'pages_get_plus_icon': get_plus_icon
}

def after_map(self, map):
Expand Down
2 changes: 1 addition & 1 deletion ckanext/pages/theme/templates_main/ckanext_pages/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<div class="module module-narrow module-shallow">
<h2 class="module-heading">
<i class="icon-info-sign"></i>
<i class="fa fa-info-circle icon-info-sign"></i>
{{ _('What are Pages?') }}
</h2>
<div class="module-content">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% block secondary_content %}
<div class="module module-narrow module-shallow">
<h2 class="module-heading">
<i class="icon-info-sign"></i>
<i class="fa fa-info-circle icon-info-sign"></i>
{{ _('Blog') }}
</h2>
<div class="module-content">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block page_primary_action %}
{% if h.check_access('ckanext_pages_update', {}) %}
{% link_for _('Add Article'), controller='ckanext.pages.controller:PagesController', action='blog_edit', page='', class_='btn btn-primary', icon='plus-sign-alt' %}
{% link_for _('Add Article'), controller='ckanext.pages.controller:PagesController', action='blog_edit', page='', class_='btn btn-primary', icon=h.pages_get_plus_icon() %}
{% endif %}
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block page_primary_action %}
{% if h.check_access('package_create', {'group_id': c.group_dict.id}) %}
{% link_for _('Add page'), controller='ckanext.pages.controller:PagesController', action='group_edit', id=c.group_dict.name, page='', class_='btn btn-primary', icon='plus-sign-alt' %}
{% link_for _('Add page'), controller='ckanext.pages.controller:PagesController', action='group_edit', id=c.group_dict.name, page='', class_='btn btn-primary', icon=h.pages_get_plus_icon() %}
{% endif %}
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block page_primary_action %}
{% if h.check_access('package_create', {'group_id': c.group_dict.id}) %}
{% link_for _('Add page'), controller='ckanext.pages.controller:PagesController', action='org_edit', id=c.group_dict.name, page='', class_='btn btn-primary', icon='plus-sign-alt' %}
{% link_for _('Add page'), controller='ckanext.pages.controller:PagesController', action='org_edit', id=c.group_dict.name, page='', class_='btn btn-primary', icon=h.pages_get_plus_icon() %}
{% endif %}
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block page_primary_action %}
{% if h.check_access('ckanext_pages_update', {}) %}
{% link_for _('Add page'), controller='ckanext.pages.controller:PagesController', action='pages_edit', page='', class_='btn btn-primary', icon='plus-sign-alt' %}
{% link_for _('Add page'), controller='ckanext.pages.controller:PagesController', action='pages_edit', page='', class_='btn btn-primary', icon=h.pages_get_plus_icon() %}
{% endif %}
{% endblock %}

Expand Down
4 changes: 2 additions & 2 deletions ckanext/pages/theme/templates_main/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
{% block header_account_logged %}
<li>
<a href="{{ h.url_for('pages_index') }}" title="{{ _('Pages') }}">
<i class="icon-file"></i>
<i class="fa fa-file icon-file"></i>
</a>
</li>
<li>
<a href="{{ h.url_for('blog_index') }}" title="{{ _('Blog') }}">
<i class="icon-pencil"></i>
<i class="fa fa-pencil icon-pencil"></i>
</a>
</li>
{{ super() }}
Expand Down

0 comments on commit 4d3e401

Please sign in to comment.