Skip to content

Commit

Permalink
[#1126] Simplified snippets and added temporary homepage layour variable
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmartin committed Jul 31, 2013
1 parent 7910f78 commit a957533
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 18 deletions.
6 changes: 4 additions & 2 deletions ckan/public/base/less/homepage.less
Expand Up @@ -53,7 +53,10 @@
margin: 0;
}

.slot2 {
}

.homepage-1 {
.row1 .col2 {
position: absolute;
bottom: 0;
right: 0;
Expand All @@ -63,5 +66,4 @@
right: 0;
}
}

}
2 changes: 1 addition & 1 deletion ckan/templates/home/index.html
Expand Up @@ -6,7 +6,7 @@
{% block toolbar %}{% endblock %}

{% block content %}
<div class="homepage">
<div class="homepage{% block homepage_layout_class %}{% endblock %}">
<div class="container">
{{ self.flash() }}
</div>
Expand Down
44 changes: 30 additions & 14 deletions ckanext/homepage/theme/templates/home/index.html
@@ -1,36 +1,52 @@
{% ckan_extends %}

{% set homepage_layout = 1 %}

{% block homepage_layout_class %} homepage-{{ homepage_layout }}{% endblock %}

{% block primary_content %}
<div role="main" class="hero">
<div class="container">
<div class="row">
<div class="span6 slot1">{{ self.homepage_slot_1() }}</div>
<div class="span6 slot2">{{ self.homepage_slot_2() }}</div>
<div class="row row1">
<div class="span6 col1">{{ self.row1_col1() }}</div>
<div class="span6 col2">{{ self.row1_col2() }}</div>
</div>
</div>
</div>
<div role="main">
<div class="container">
<div class="row">
<div class="span6 slot3">{{ self.homepage_slot_3() }}</div>
<div class="span6 slot4">{{ self.homepage_slot_4() }}</div>
<div class="row row2">
<div class="span6 col1">{{ self.row2_col1() }}</div>
<div class="span6 col2">{{ self.row2_col2() }}</div>
</div>
</div>
</div>
{% endblock %}

{% block homepage_slot_1 %}
{% snippet 'home/snippets/promoted.html', intro=g.site_intro_text %}
{% block row1_col1 %}
{% if homepage_layout == 1 %}
{% snippet 'home/snippets/promoted.html' %}
{% elif homepage_layout == 2 %}
{% snippet 'home/snippets/search.html' %}
{% endif %}
{% endblock %}

{% block homepage_slot_2 %}
{% snippet 'home/snippets/search.html', query=c.q, tags=h.get_facet_items_dict('tags', limit=3), placeholder=_('eg. Gold Prices') %}
{% block row1_col2 %}
{% if homepage_layout == 1 %}
{% snippet 'home/snippets/search.html' %}
{% elif homepage_layout == 2 %}
{% snippet 'home/snippets/featured_dataset.html' %}
{% endif %}
{% endblock %}

{% block homepage_slot_3 %}
{% snippet 'home/snippets/featured_group.html', group=h.get_featured_group() %}
{% block row2_col1 %}
{% if homepage_layout == 1 %}
{% snippet 'home/snippets/featured_group.html' %}
{% elif homepage_layout == 2 %}
{% snippet 'home/snippets/stats.html' %}
{% endif %}
{% endblock %}

{% block homepage_slot_4 %}
{% snippet 'home/snippets/featured_organization.html', organization=h.get_featured_organization() %}
{% block row2_col2 %}
{% snippet 'home/snippets/featured_organization.html' %}
{% endblock %}
@@ -1,3 +1,5 @@
{% set group = h.get_featured_group() %}

<div class="box">
{% snippet 'snippets/group_item.html', group=group, truncate=50, truncate_title=35 %}
</div>
@@ -1,3 +1,5 @@
{% set organization = h.get_featured_organization() %}

<div class="box">
{% snippet 'snippets/organization_item.html', organization=organization, truncate=50, truncate_title=35 %}
</div>
2 changes: 2 additions & 0 deletions ckanext/homepage/theme/templates/home/snippets/promoted.html
@@ -1,3 +1,5 @@
{% set intro = g.site_intro_text %}

<div class="module-content box">
<header>
{% if intro %}
Expand Down
5 changes: 4 additions & 1 deletion ckanext/homepage/theme/templates/home/snippets/search.html
@@ -1,8 +1,11 @@
{% set tags = h.get_facet_items_dict('tags', limit=3) %}
{% set placeholder = _('eg. Gold Prices') %}

<div class="module module-search module-narrow module-shallow box">
<form class="module-content search-form" method="get" action="{% url_for controller='package', action='search' %}">
<h3 class="heading">{{ _("Search Your Data") }}</h3>
<div class="search-input control-group search-giant">
<input type="text" class="search" name="q" value="{{ query }}" autocomplete="off" placeholder="{{ placeholder }}" />
<input type="text" class="search" name="q" value="" autocomplete="off" placeholder="{{ placeholder }}" />
<button type="submit">
<i class="icon-search"></i>
<span>{{ _('Search') }}</span>
Expand Down

0 comments on commit a957533

Please sign in to comment.