Skip to content

Commit

Permalink
[2375] Merge branch 'feature-2440-demo-homepage' into 'feature-2375-d…
Browse files Browse the repository at this point in the history
…emo-theme'

Conflicts:
	ckan/templates/snippets/facet_list_static.html
  • Loading branch information
aron committed Jun 12, 2012
2 parents 415e8eb + 7a5f99f commit e612e90
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 21 deletions.
6 changes: 2 additions & 4 deletions ckan/public/base/less/dataset.less
Expand Up @@ -13,18 +13,16 @@
.dataset-item {
}

.dataset-item > .heading {
.dataset-item > .content > .heading {
font-size: 14px;
line-height: 1.2;
float: left;
line-height: 1.3;
}

.dataset-item > .heading a {
color: #333;
}

.dataset-item > .content {
clear: both;
font-size: 12px;
}

Expand Down
2 changes: 1 addition & 1 deletion ckan/public/base/less/layout.less
Expand Up @@ -130,7 +130,7 @@
}

.hero .tags {
margin-bottom: 15px;
margin-bottom: 9px;
}

.hero .tags .tag,
Expand Down
4 changes: 4 additions & 0 deletions ckan/public/base/less/media.less
Expand Up @@ -106,6 +106,10 @@ ol.media-grid {
padding: 0;
}

.media.module > .heading {
background: none;
}

// Banner
.transform (@func) {
-webkit-transform: @arguments;
Expand Down
4 changes: 2 additions & 2 deletions ckan/templates/home/index.html
Expand Up @@ -49,15 +49,15 @@ <h3 class="heading">{{ _("Search Your Data") }}</h3>
</form>
</div>
<div class="tags">
{{ h.snippet('snippets/facet_list_static.html', title='Tags', name='tags') }}
{{ h.snippet('snippets/facet_list_static.html', title='Tags', name='tags', limit=3) }}
</div>
</div>
</div>
{% endblock %}

{% block secondary_content %}
<div class="">
{{ h.snippet('snippets/package_list.html', packages=c.datasets, item_class='media media-vertical module', list_class='media-grid media-wide', hide_resources=True, banner=True) }}
{% snippet 'snippets/package_grid.html', packages=c.datasets[:4] %}
</div>
{% endblock %}

Expand Down
16 changes: 9 additions & 7 deletions ckan/templates/snippets/facet_list_static.html
@@ -1,18 +1,20 @@
{#
Construct a facet module populated with links to filtered results.

name
The field name identifying the facet field, eg. "tags"
name - The field name identifying the facet field, eg. "tags"
title - The title of the facet, eg. "Tags", or "Tag Cloud"
limit - The maximum number of tags to display.

title
The title of the facet, eg. "Tags", or "Tag Cloud"
Example:

{% snippet 'snippets/facet_list_static', name='tags, title=_('Tags'), limit=10) %}
#}
<h3 class="tag">Popular {{ c.facet_titles.get(name) }}</h3>
{% with items = h.get_facet_items_dict(name) %}
<h3 class="tag">Popular {{ c.facet_titles.name }}</h3>
{% with items = h.get_facet_items_dict(name, limit) %}
<ul class="tag-list">
{% for item in items %}
<li class="tag">
<a href="{% url_for controller='tag', action='read', id=item.name %}">{{ h.truncate(item.display_name, 22) }}</a>
<a href="{% url_for controller='tag', action='read', id=item.name %}">{{ h.truncate(item.display_name, 22) }}</a>
</li>
{% endfor %}
</ul>
Expand Down
21 changes: 21 additions & 0 deletions ckan/templates/snippets/package_grid.html
@@ -0,0 +1,21 @@
{#
Displays a list of packages in a grid.

packages - A list of packages to display.
list_class - The class name for the list item.
item_class - The class name to use on each item.
banner - If true displays a popular banner (default: false).
truncate - The length to trucate the description to (default: 120).
title_truncate - The length to truncate the title to (default: 40).

Example:

{% snippet 'snippets/package_grid.html', packages=c.datasets[:4] %}

#}
{% set list_class = list_class or 'media-grid media-wide' %}
{% set item_class = item_class or 'media media-vertical module' %}
{% set truncate = truncate or 120 %}
{% set truncate_title = truncate_title or 40 %}

{% snippet 'snippets/package_list.html', packages=packages, list_class=list_class, item_class=item_class, truncate=truncate, truncate_title=truncate_title, hide_resources=true, banner=true %}
33 changes: 26 additions & 7 deletions ckan/templates/snippets/package_list.html
@@ -1,17 +1,36 @@
{#
Displays a list of datasets.

packages - A list of packages to display.
list_class - The class name for the list item.
item_class - The class name to use on each item.
hide_resources - If true hides the resources (default: false).
banner - If true displays a popular banner (default: false).
truncate - The length to trucate the description to (default: 180)
truncate_title - The length to truncate the title to (default: 80).

Example:

{% snippet 'snippets/package_list.html', packages=c.datasets %}

#}
{% set list_class = list_class or 'dataset-list unstyled' %}
{% set item_class = item_class or 'dataset-item' %}
{% set truncate = truncate or 180 %}
{% set truncate_title = truncate_title or 80 %}

{% if packages %}
<ul class="{{ list_class }}">
<ul class="{{ list_class }}">
{% for package in packages %}
{% set title = package.get('title') or package.get('name') %}
{% set notes = h.markdown_extract(package.notes) %}
{% set notes = h.markdown_extract(package.notes, extract_length=truncate) %}

<li class="{{ item_class }} ">
<h3 class="heading">
{{ h.link_to(h.truncate(title, 80), h.url_for(controller='package', action='read', id=package.get('name'))) }}
{{ h.popular('recent views', package.tracking_summary.recent, min=10) }}
</h3>
<div class="content">
<div class="content">
<h3 class="heading">
{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='package', action='read', id=package.get('name'))) }}
{{ h.popular('recent views', package.tracking_summary.recent, min=10) }}
</h3>
{% if banner %}
<span class="banner">Popular</span>
{% endif %}
Expand Down

0 comments on commit e612e90

Please sign in to comment.