diff --git a/ckanext/showcase/plugin.py b/ckanext/showcase/plugin.py index 443729fe..a64a77b1 100644 --- a/ckanext/showcase/plugin.py +++ b/ckanext/showcase/plugin.py @@ -40,7 +40,7 @@ class ShowcasePlugin(plugins.SingletonPlugin, lib_plugins.DefaultDatasetForm): def update_config(self, config): toolkit.add_template_directory(config, 'templates') - # toolkit.add_public_directory(config, 'public') + toolkit.add_public_directory(config, 'public') # toolkit.add_resource('fanstatic', 'showcase') # IConfigurable diff --git a/ckanext/showcase/public/ckanext_showcase.css b/ckanext/showcase/public/ckanext_showcase.css new file mode 100644 index 00000000..ea5e2acd --- /dev/null +++ b/ckanext/showcase/public/ckanext_showcase.css @@ -0,0 +1,25 @@ +/* Custom style rules for ckanext-showcase */ + +.context-info .module-content .smallest { + font-size: 13px; +} + +.context-info .module-content .info .btn { + margin-top: 18px; +} + +.actions { + top: 36px; +} + +.ckanext-showcase-image { + margin-bottom: 25px; +} + +.ckanext-showcase-notes { + margin-bottom: 25px; +} + +.ckanext-showcase-launch { + margin-bottom: 25px; +} diff --git a/ckanext/showcase/templates/showcase/edit_base.html b/ckanext/showcase/templates/showcase/edit_base.html index 886d93a7..83722ae1 100644 --- a/ckanext/showcase/templates/showcase/edit_base.html +++ b/ckanext/showcase/templates/showcase/edit_base.html @@ -29,5 +29,5 @@ {% endblock %} {% block secondary_content %} - {% snippet 'showcase/snippets/showcase_info.html', pkg=pkg %} + {#{% snippet 'showcase/snippets/showcase_info.html', pkg=pkg %}#} {% endblock %} diff --git a/ckanext/showcase/templates/showcase/read.html b/ckanext/showcase/templates/showcase/read.html index 13d16850..c2b5e511 100644 --- a/ckanext/showcase/templates/showcase/read.html +++ b/ckanext/showcase/templates/showcase/read.html @@ -1,22 +1,47 @@ -{% extends "showcase/read_base.html" %} +{% extends "page.html" %} {% set pkg = c.pkg_dict %} {% set name = pkg.title or pkg.name %} +{% block subtitle %}{{ pkg.title or pkg.name }} - {{ _('Showcases') }}{% endblock %} + +{% block styles %} + {{ super() }} + +{% endblock %} + +{% block links -%} + {{ super() }} + +{% endblock -%} + +{% block head_extras -%} + {{ super() }} + {% set description = h.markdown_extract(pkg.notes, extract_length=200)|forceescape %} + + +{% endblock -%} + +{% block breadcrumb_content_selected %} class="active"{% endblock %} + +{% block breadcrumb_content %} + {% set showcase = pkg.title or pkg.name %} +
  • {{ h.nav_link(_('Showcases'), controller='ckanext.showcase.controller:ShowcaseController', action='search', highlight_actions = 'new index') }}
  • + {% link_for showcase|truncate(30), controller='ckanext.showcase.controller:ShowcaseController', action='read', id=pkg.name %} +{% endblock %} + +{% block page_header %} +{% endblock %} + {% block pre_primary %} -
    - {% if h.check_access('ckanext_showcase_update', {'id':pkg.id }) %} - {% link_for _('Manage'), controller='ckanext.showcase.controller:ShowcaseController', action='edit', id=pkg.name, class_='btn', icon='wrench' %} - {% endif %} - {% if pkg.url %} - - {{ _('External link') }} - - {% endif %} -
    {% endblock %} {% block primary_content_inner %} + {% if h.check_access('ckanext_showcase_update', {'id':pkg.id }) %} +
    + {% link_for _('Manage'), controller='ckanext.showcase.controller:ShowcaseController', action='edit', id=pkg.name, class_='btn', icon='wrench' %} +
    + {% endif %} {% block package_description %} {% if pkg.private %} @@ -34,20 +59,21 @@

    {% if pkg.image_display_url %} -

    {{ name }}

    - {% endif %} - - {% if pkg.url %} -

    URL: {{ pkg.url }}

    +

    {{ name }}

    {% endif %} {% block package_notes %} {% if pkg.showcase_notes_formatted %} -
    +
    {{ pkg.showcase_notes_formatted }}
    {% endif %} {% endblock %} + + {% if pkg.url %} +

    {{ _('Launch website') }}

    + {% endif %} + {% endblock %} {% block package_tags %} @@ -55,12 +81,18 @@

    {% endblock %} {% block package_search_results_list %} - {% if pkg.num_datasets %} -

    {{ ungettext('{num} dataset in this Showcase', '{num} datasets in this Showcase', pkg.num_datasets).format(num=pkg.num_datasets) }}

    - {% elif pkg.num_datasets == 0 %} -

    {{ _('There are no datasets in this Showcase') }}

    - {% endif %} - {{ h.snippet('snippets/package_list.html', packages=c.showcase_pkgs) }} {% endblock %} {% endblock %} + +{% block secondary_content %} + {% block secondary_help_content %}{% endblock %} + + {% block package_info %} + {% snippet 'showcase/snippets/showcase_info.html', pkg=pkg %} + {% endblock %} + + {% block package_social %} + {% snippet "snippets/social.html" %} + {% endblock %} +{% endblock %} diff --git a/ckanext/showcase/templates/showcase/read_base.html b/ckanext/showcase/templates/showcase/read_base.html deleted file mode 100644 index f61ca131..00000000 --- a/ckanext/showcase/templates/showcase/read_base.html +++ /dev/null @@ -1,41 +0,0 @@ -{% extends "page.html" %} - -{% block subtitle %}{{ pkg.title or pkg.name }} - {{ _('Showcases') }}{% endblock %} - -{% block links -%} - {{ super() }} - -{% endblock -%} - -{% block head_extras -%} - {{ super() }} - {% set description = h.markdown_extract(pkg.notes, extract_length=200)|forceescape %} - - -{% endblock -%} - -{% block breadcrumb_content_selected %} class="active"{% endblock %} - -{% block breadcrumb_content %} - {% set showcase = pkg.title or pkg.name %} -
  • {{ h.nav_link(_('Showcases'), controller='ckanext.showcase.controller:ShowcaseController', action='search', highlight_actions = 'new index') }}
  • - {% link_for showcase|truncate(30), controller='ckanext.showcase.controller:ShowcaseController', action='read', id=pkg.name %} -{% endblock %} - -{% block primary_content_inner %} -{% endblock %} - -{% block page_header %} -{% endblock %} - -{% block secondary_content %} - {% block secondary_help_content %}{% endblock %} - - {% block package_info %} - {% snippet 'showcase/snippets/showcase_info.html', pkg=pkg %} - {% endblock %} - - {% block package_social %} - {% snippet "snippets/social.html" %} - {% endblock %} -{% endblock %} diff --git a/ckanext/showcase/templates/showcase/snippets/showcase_info.html b/ckanext/showcase/templates/showcase/snippets/showcase_info.html index 200f6938..b7798c95 100644 --- a/ckanext/showcase/templates/showcase/snippets/showcase_info.html +++ b/ckanext/showcase/templates/showcase/snippets/showcase_info.html @@ -1,7 +1,7 @@ {# Displays a sidebard module with information for given package -pkg - The package dict that owns the resources. +pkg - The showcase package dict that owns the resources. Example: @@ -17,9 +17,36 @@ {% block heading %}

    {{ pkg.title or pkg.name }}

    {% endblock %} + {% if pkg.author %} + Submitted by +

    {{ pkg.author }}

    + {% endif %} + {% if pkg.url %} + + {% endif %} {% endblock %}
    + +
    +

    {{ _('Datasets in Showcase') }}

    + {% if c.showcase_pkgs %} + + {% else %} +

    There are no Datasetes in this Showcase

    + {% endif %} +
    {% endif %} {% endblock %}