Skip to content

Commit

Permalink
[#8] theme split for IC and PC
Browse files Browse the repository at this point in the history
- each has own plugin: odn_theme_ic, odn_theme_pc
- added template css for each catalog
- displaying actor name in header moved from "base" theme to IC theme plugin
- added change log file
  • Loading branch information
mvi-eea-sk committed Sep 11, 2015
1 parent 190de1f commit f0de88b
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 46 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---------
Changelog
---------

v1.2.0-SNAPSHOT 2015-9-11

Features:
* added plugins for Internal and Public Catalog themes, where the odn_theme plugin is a common base
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Installation

To enable plugin, change property in your production.ini:
```
ckan.plugins = odn_theme odn_package_extras
ckan.plugins = odn_theme odn_theme_ic odn_theme_pc odn_package_extras
# version displayed in header and About page (current version)
ckan.odn_version = 1.0.2
Expand Down
7 changes: 1 addition & 6 deletions ckanext/odn_theme/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

{%- block custom_styles %}
<link rel="stylesheet" href="{{h.url_for_static('/css/odn_theme.css')}}" />

{%- if g.site_custom_css -%}
<style>
{{ g.site_custom_css | safe }}
</style>
{%- endif %}
{{ super() }}
{% endblock %}

{% block links -%}
Expand Down
38 changes: 0 additions & 38 deletions ckanext/odn_theme/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,6 @@ <h1 id="sitetitlestring">
{% endif %}
{% endblock %}

{% block header_account_logged %}
{% if c.userobj.sysadmin %}
<li>
<a href="{{ h.url_for(controller='admin', action='index') }}" title="{{ _('Sysadmin settings') }}">
<i class="icon-legal"></i>
</a>
</li>
{% endif %}
<li>
<a href="{{ h.url_for(controller='user', action='read', id=c.userobj.name) }}" class="image" title="{{ _('View profile') }}">
{{ h.gravatar((c.userobj.email_hash if c and c.userobj else ''), size=22) }}
<span class="username">{{ h.user_display_name() }}</span>
</a>
</li>
{% set new_activities = h.new_activities() %}
<li class="notifications {% if new_activities > 0 %}notifications-important{% endif %}">
{% set notifications_tooltip = ngettext('Dashboard (%(num)d new item)', 'Dashboard (%(num)d new items)', new_activities) %}
<a href="{{ h.url_for(controller='user', action='dashboard') }}" title="{{ notifications_tooltip }}">
<i class="icon-dashboard"></i>
<span>{{ new_activities }}</span>
</a>
</li>
{% block header_account_settings_link %}
<li>
<a href="{{ h.url_for(controller='user', action='edit', id=c.userobj.name) }}" title="{{ _('Edit settings') }}">
<i class="icon-cog"></i>
</a>
</li>
{% endblock %}
{% block header_account_log_out_link %}
<li>
<a href="{{ h.url_for('/user/_logout') }}" title="{{ _('Log out') }}">
<i class="icon-signout"></i>
</a>
</li>
{% endblock %}
{% endblock %}

{% block header_site_navigation %}
<nav class="section navigation">
<ul class="nav nav-pills">
Expand Down
7 changes: 7 additions & 0 deletions ckanext/odn_theme_ic/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
16 changes: 16 additions & 0 deletions ckanext/odn_theme_ic/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'''
Created on 11.9.2015
@author: mvi
'''
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit

class OdnThemeICPlugin(plugins.SingletonPlugin):
'''ODN theme plugin for Internal Catalog
'''
plugins.implements(plugins.IConfigurer)

def update_config(self, config):
toolkit.add_template_directory(config, 'templates') # html (jinja2)
toolkit.add_public_directory(config, 'public') # css and js
Empty file.
9 changes: 9 additions & 0 deletions ckanext/odn_theme_ic/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% ckan_extends %}

{%- block custom_styles %}
<link rel="stylesheet" href="{{h.url_for_static('/css/odn_theme_ic.css')}}" />
{{ super() }}
{% endblock %}



39 changes: 39 additions & 0 deletions ckanext/odn_theme_ic/templates/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% ckan_extends %}

{% block header_account_logged %}
{% if c.userobj.sysadmin %}
<li>
<a href="{{ h.url_for(controller='admin', action='index') }}" title="{{ _('Sysadmin settings') }}">
<i class="icon-legal"></i>
</a>
</li>
{% endif %}
<li>
<a href="{{ h.url_for(controller='user', action='read', id=c.userobj.name) }}" class="image" title="{{ _('View profile') }}">
{{ h.gravatar((c.userobj.email_hash if c and c.userobj else ''), size=22) }}
<span class="username">{{ h.user_display_name() }}</span>
</a>
</li>
{% set new_activities = h.new_activities() %}
<li class="notifications {% if new_activities > 0 %}notifications-important{% endif %}">
{% set notifications_tooltip = ngettext('Dashboard (%(num)d new item)', 'Dashboard (%(num)d new items)', new_activities) %}
<a href="{{ h.url_for(controller='user', action='dashboard') }}" title="{{ notifications_tooltip }}">
<i class="icon-dashboard"></i>
<span>{{ new_activities }}</span>
</a>
</li>
{% block header_account_settings_link %}
<li>
<a href="{{ h.url_for(controller='user', action='edit', id=c.userobj.name) }}" title="{{ _('Edit settings') }}">
<i class="icon-cog"></i>
</a>
</li>
{% endblock %}
{% block header_account_log_out_link %}
<li>
<a href="{{ h.url_for('/user/_logout') }}" title="{{ _('Log out') }}">
<i class="icon-signout"></i>
</a>
</li>
{% endblock %}
{% endblock %}
7 changes: 7 additions & 0 deletions ckanext/odn_theme_pc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
16 changes: 16 additions & 0 deletions ckanext/odn_theme_pc/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'''
Created on 11.9.2015
@author: mvi
'''
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit

class OdnThemePCPlugin(plugins.SingletonPlugin):
'''ODN theme plugin for Public Catalog
'''
plugins.implements(plugins.IConfigurer)

def update_config(self, config):
toolkit.add_template_directory(config, 'templates') # html (jinja2)
toolkit.add_public_directory(config, 'public') # css and js
Empty file.
9 changes: 9 additions & 0 deletions ckanext/odn_theme_pc/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% ckan_extends %}

{%- block custom_styles %}
<link rel="stylesheet" href="{{h.url_for_static('/css/odn_theme_pc.css')}}" />
{{ super() }}
{% endblock %}



8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
url='',
license='',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
namespace_packages=['ckanext', 'ckanext.odn_theme', 'ckanext.extras'],
namespace_packages=['ckanext',
'ckanext.odn_theme',
'ckanext.odn_theme_ic',
'ckanext.odn_theme_pc',
'ckanext.extras'],
package_data={'': [
'i18n/*/LC_MESSAGES/*.po',
'i18n/*/base/images/*.jpg',
Expand Down Expand Up @@ -51,6 +55,8 @@
entry_points='''
[ckan.plugins]
odn_theme=ckanext.odn_theme.plugin:OdnThemePlugin
odn_theme_ic=ckanext.odn_theme_ic.plugin:OdnThemeICPlugin
odn_theme_pc=ckanext.odn_theme_pc.plugin:OdnThemePCPlugin
odn_package_extras=ckanext.extras.plugin:PackageExtrasPlugin
''',
)

0 comments on commit f0de88b

Please sign in to comment.