From a957533216a07e6e03daabb4a78cdd0a17f6695f Mon Sep 17 00:00:00 2001 From: John Martin Date: Wed, 31 Jul 2013 10:42:28 +0100 Subject: [PATCH] [#1126] Simplified snippets and added temporary homepage layour variable --- ckan/public/base/less/homepage.less | 6 ++- ckan/templates/home/index.html | 2 +- .../homepage/theme/templates/home/index.html | 44 +++++++++++++------ .../home/snippets/featured_group.html | 2 + .../home/snippets/featured_organization.html | 2 + .../templates/home/snippets/promoted.html | 2 + .../theme/templates/home/snippets/search.html | 5 ++- 7 files changed, 45 insertions(+), 18 deletions(-) diff --git a/ckan/public/base/less/homepage.less b/ckan/public/base/less/homepage.less index 02574845817..fc185cb3098 100644 --- a/ckan/public/base/less/homepage.less +++ b/ckan/public/base/less/homepage.less @@ -53,7 +53,10 @@ margin: 0; } - .slot2 { +} + +.homepage-1 { + .row1 .col2 { position: absolute; bottom: 0; right: 0; @@ -63,5 +66,4 @@ right: 0; } } - } diff --git a/ckan/templates/home/index.html b/ckan/templates/home/index.html index ee1d1f4c8ae..d9e4abfb17b 100644 --- a/ckan/templates/home/index.html +++ b/ckan/templates/home/index.html @@ -6,7 +6,7 @@ {% block toolbar %}{% endblock %} {% block content %} -
+
{{ self.flash() }}
diff --git a/ckanext/homepage/theme/templates/home/index.html b/ckanext/homepage/theme/templates/home/index.html index 0a9d0de727b..bf9addfcb4b 100644 --- a/ckanext/homepage/theme/templates/home/index.html +++ b/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 %}
-
-
{{ self.homepage_slot_1() }}
-
{{ self.homepage_slot_2() }}
+
+
{{ self.row1_col1() }}
+
{{ self.row1_col2() }}
-
-
{{ self.homepage_slot_3() }}
-
{{ self.homepage_slot_4() }}
+
+
{{ self.row2_col1() }}
+
{{ self.row2_col2() }}
{% 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 %} diff --git a/ckanext/homepage/theme/templates/home/snippets/featured_group.html b/ckanext/homepage/theme/templates/home/snippets/featured_group.html index bdd20fafdbe..fb5ff22a640 100644 --- a/ckanext/homepage/theme/templates/home/snippets/featured_group.html +++ b/ckanext/homepage/theme/templates/home/snippets/featured_group.html @@ -1,3 +1,5 @@ +{% set group = h.get_featured_group() %} +
{% snippet 'snippets/group_item.html', group=group, truncate=50, truncate_title=35 %}
diff --git a/ckanext/homepage/theme/templates/home/snippets/featured_organization.html b/ckanext/homepage/theme/templates/home/snippets/featured_organization.html index 760f8b5e479..7e43e6c4bcb 100644 --- a/ckanext/homepage/theme/templates/home/snippets/featured_organization.html +++ b/ckanext/homepage/theme/templates/home/snippets/featured_organization.html @@ -1,3 +1,5 @@ +{% set organization = h.get_featured_organization() %} +
{% snippet 'snippets/organization_item.html', organization=organization, truncate=50, truncate_title=35 %}
diff --git a/ckanext/homepage/theme/templates/home/snippets/promoted.html b/ckanext/homepage/theme/templates/home/snippets/promoted.html index 287083a51b0..fc09d9a6300 100644 --- a/ckanext/homepage/theme/templates/home/snippets/promoted.html +++ b/ckanext/homepage/theme/templates/home/snippets/promoted.html @@ -1,3 +1,5 @@ +{% set intro = g.site_intro_text %} +
{% if intro %} diff --git a/ckanext/homepage/theme/templates/home/snippets/search.html b/ckanext/homepage/theme/templates/home/snippets/search.html index 586ae5dba6a..e4a72c7e074 100644 --- a/ckanext/homepage/theme/templates/home/snippets/search.html +++ b/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') %} +