Skip to content

Commit

Permalink
Redesign of showcase details page
Browse files Browse the repository at this point in the history
  • Loading branch information
brew committed Apr 3, 2015
1 parent d0a8f2b commit 5b37ca6
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 67 deletions.
2 changes: 1 addition & 1 deletion ckanext/showcase/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions ckanext/showcase/public/ckanext_showcase.css
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion ckanext/showcase/templates/showcase/edit_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
78 changes: 55 additions & 23 deletions ckanext/showcase/templates/showcase/read.html
Original file line number Diff line number Diff line change
@@ -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() }}
<link rel="stylesheet" href="/ckanext_showcase.css" />
{% endblock %}

{% block links -%}
{{ super() }}
<link rel="alternate" type="application/rdf+xml" href="{{ h.url_for(controller='ckanext.showcase.controller:ShowcaseController', action='read', id=pkg.id, format='rdf', qualified=True) }}"/>
{% endblock -%}

{% block head_extras -%}
{{ super() }}
{% set description = h.markdown_extract(pkg.notes, extract_length=200)|forceescape %}
<meta property="og:title" content="{{ h.dataset_display_name(pkg) }} - {{ g.site_title }}">
<meta property="og:description" content="{{ description|forceescape }}">
{% endblock -%}

{% block breadcrumb_content_selected %} class="active"{% endblock %}

{% block breadcrumb_content %}
{% set showcase = pkg.title or pkg.name %}
<li>{{ h.nav_link(_('Showcases'), controller='ckanext.showcase.controller:ShowcaseController', action='search', highlight_actions = 'new index') }}</li>
<li{{ self.breadcrumb_content_selected() }}>{% link_for showcase|truncate(30), controller='ckanext.showcase.controller:ShowcaseController', action='read', id=pkg.name %}</li>
{% endblock %}

{% block page_header %}
{% endblock %}

{% block pre_primary %}
<div class="actions">
{% 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 %}
<a class="btn btn-primary" href="{{ pkg.url }}" target="_blank">
<i class="icon-external-link"></i> {{ _('External link') }}
</a>
{% endif %}
</div>
{% endblock %}

{% block primary_content_inner %}
{% if h.check_access('ckanext_showcase_update', {'id':pkg.id }) %}
<div class="actions">
{% link_for _('Manage'), controller='ckanext.showcase.controller:ShowcaseController', action='edit', id=pkg.name, class_='btn', icon='wrench' %}
</div>
{% endif %}
{% block package_description %}
{% if pkg.private %}
<span class="dataset-private label label-inverse pull-right">
Expand All @@ -34,33 +59,40 @@ <h1>
</h1>

{% if pkg.image_display_url %}
<p><img src="{{ pkg.image_display_url }}" alt="{{ name }}" class="media-image"></p>
{% endif %}

{% if pkg.url %}
<p class="muted ellipsis">URL: <a href="{{ pkg.url }}" target="_blank">{{ pkg.url }}</a></p>
<p><img src="{{ pkg.image_display_url }}" alt="{{ name }}" class="media-image ckanext-showcase-image"></p>
{% endif %}

{% block package_notes %}
{% if pkg.showcase_notes_formatted %}
<div class="notes embedded-content">
<div class="notes embedded-content ckanext-showcase-notes">
{{ pkg.showcase_notes_formatted }}
</div>
{% endif %}
{% endblock %}

{% if pkg.url %}
<p><a class="btn btn-primary ckanext-showcase-launch" href="{{ pkg.url }}" target="_blank"><i class="icon-external-link"></i> {{ _('Launch website') }}</a></p>
{% endif %}

{% endblock %}

{% block package_tags %}
{% snippet "showcase/snippets/tags.html", tags=pkg.tags %}
{% endblock %}

{% block package_search_results_list %}
{% if pkg.num_datasets %}
<h2>{{ ungettext('{num} dataset in this Showcase', '{num} datasets in this Showcase', pkg.num_datasets).format(num=pkg.num_datasets) }}</h2>
{% elif pkg.num_datasets == 0 %}
<h2>{{ _('There are no datasets in this Showcase') }}</h2>
{% 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 %}
41 changes: 0 additions & 41 deletions ckanext/showcase/templates/showcase/read_base.html

This file was deleted.

29 changes: 28 additions & 1 deletion ckanext/showcase/templates/showcase/snippets/showcase_info.html
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -17,9 +17,36 @@
{% block heading %}
<h1 class="heading">{{ pkg.title or pkg.name }}</h1>
{% endblock %}
{% if pkg.author %}
<span class="smallest">Submitted by</span>
<p>{{ pkg.author }}</p>
{% endif %}
{% if pkg.url %}
<div class="info">
<a class="btn btn-primary" href="{{ pkg.url }}" target="_blank">
<i class="icon-external-link"></i> {{ _('Launch website') }}
</a>
</div>
{% endif %}
{% endblock %}
</div>
</div>
</section>

<section class="module module-narrow">
<h3 class="module-heading"><i class="icon-medium icon-sitemap"></i> {{ _('Datasets in Showcase') }}</h2>
{% if c.showcase_pkgs %}
<ul class="nav nav-simple">
{% for package in c.showcase_pkgs %}
{% set truncate = truncate or 180 %}
{% set truncate_title = truncate_title or 80 %}
{% set title = package.title or package.name %}
<li class="nav-item">{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='package', action='read', id=package.name)) }}</li>
{% endfor %}
</ul>
{% else %}
<p class="module-content empty">There are no Datasetes in this Showcase</p>
{% endif %}
</section>
{% endif %}
{% endblock %}

1 comment on commit 5b37ca6

@Chealer
Copy link

@Chealer Chealer commented on 5b37ca6 Jun 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reported an HTML regression in ticket #86 .

Please sign in to comment.