From 1fd199a78eda54df5824fab77475e504d8d7bab0 Mon Sep 17 00:00:00 2001
From: Chris Lawton <chris.lawton@torchbox.com>
Date: Thu, 8 Feb 2018 10:43:50 +0000
Subject: [PATCH] created new listing index template which fund, lab and
 project index pages all extend from

---
 .../templates/public_funds/fund_index.html    | 37 +---------------
 .../templates/public_funds/lab_index.html     | 40 +----------------
 .../projects/project_index_page.html          | 40 +----------------
 .../utils/templates/utils/listing_index.html  | 44 +++++++++++++++++++
 4 files changed, 47 insertions(+), 114 deletions(-)
 create mode 100644 opentech/public/utils/templates/utils/listing_index.html

diff --git a/opentech/public/funds/templates/public_funds/fund_index.html b/opentech/public/funds/templates/public_funds/fund_index.html
index c4e308791..40d38499b 100644
--- a/opentech/public/funds/templates/public_funds/fund_index.html
+++ b/opentech/public/funds/templates/public_funds/fund_index.html
@@ -1,36 +1 @@
-{% extends "base.html" %}
-{% load wagtailcore_tags wagtailimages_tags %}
-{% block body_class %}light-grey-bg{% endblock %}
-{% block content %}
-<div class="wrapper wrapper--small wrapper--top-bottom-inner-space">
-    <div class="wrapper wrapper--listings">
-
-        {% if subpages.object_list.exists %}
-            {% for subpage in subpages.object_list.specific %}
-
-                <a class="listing" href="{% pageurl subpage %}">
-                    {% if subpage.deadline %}
-                        <p class="listing__deadline">
-                            <svg class="icon icon--calendar icon--small"><use xlink:href="#calendar"></use></svg>
-                            <span>Next deadline: {{ subpage.deadline|date:"M j, Y" }}</span>
-                        </p>
-                    {% endif %}
-
-                    <h4 class="listing__title">{{ subpage.listing_title|default:subpage.title }}</h4>
-
-                    {% if subpage.listing_summary or subpage.introduction %}
-                        <h6 class="listing__teaser">{{ subpage.listing_summary|default:subpage.introduction|truncatechars_html:155 }}</h6>
-                    {% endif %}
-                </a>
-
-            {% endfor %}
-
-            {% include "includes/pagination.html" with paginator_page=subpages %}
-
-        {% else %}
-            {# no items on this page #}
-        {% endif %}
-    </div>
-</div>
-
-{% endblock %}
+{% extends "utils/listing_index.html" %}
diff --git a/opentech/public/funds/templates/public_funds/lab_index.html b/opentech/public/funds/templates/public_funds/lab_index.html
index 36dc2aa22..40d38499b 100644
--- a/opentech/public/funds/templates/public_funds/lab_index.html
+++ b/opentech/public/funds/templates/public_funds/lab_index.html
@@ -1,39 +1 @@
-{% extends "base.html" %}
-{% load wagtailcore_tags wagtailimages_tags %}
-{% block body_class %}light-grey-bg{% endblock %}
-{% block content %}
-<div class="wrapper wrapper--small wrapper--top-bottom-inner-space">
-    {% if page.introduction %}
-        <h4 class="heading heading--listings-introduction">{{ page.introduction }}</h4>
-    {% endif %}
-    <div class="wrapper wrapper--listings">
-
-        {% if subpages.object_list.exists %}
-            {% for subpage in subpages.object_list.specific %}
-
-                <a class="listing" href="{% pageurl subpage %}">
-                    {% if subpage.icon %}
-                        {% image subpage.icon fill-180x180 class="listing__image" %}
-                    {% else %}
-                        <div class="listing__image listing__image--default">
-                            <svg><use xlink:href="#logo-mobile-no-text"></use></svg>
-                        </div>
-                    {% endif %}
-                    <h4 class="listing__title">{{ subpage.listing_title|default:subpage.title }}</h4>
-
-                    {% if subpage.listing_summary or subpage.introduction %}
-                        <h6 class="listing__teaser">{{ subpage.listing_summary|default:subpage.introduction|truncatechars_html:155 }}</h6>
-                    {% endif %}
-                </a>
-
-            {% endfor %}
-
-            {% include "includes/pagination.html" with paginator_page=subpages %}
-
-        {% else %}
-            {# no items on this page #}
-        {% endif %}
-    </div>
-</div>
-
-{% endblock %}
+{% extends "utils/listing_index.html" %}
diff --git a/opentech/public/projects/templates/projects/project_index_page.html b/opentech/public/projects/templates/projects/project_index_page.html
index 1234f44ae..40d38499b 100644
--- a/opentech/public/projects/templates/projects/project_index_page.html
+++ b/opentech/public/projects/templates/projects/project_index_page.html
@@ -1,39 +1 @@
-{% extends "base.html" %}
-{% load wagtailcore_tags wagtailimages_tags %}
-{% block body_class %}light-grey-bg{% endblock %}
-{% block content %}
-<div class="wrapper wrapper--small wrapper--top-bottom-inner-space">
-    {% if page.introduction %}
-        <h4 class="heading heading--listings-introduction">{{ page.introduction }}</h4>
-    {% endif %}
-    <div class="wrapper wrapper--listings">
-        {% if subpages.object_list.exists %}
-            {% for subpage in subpages.object_list.specific %}
-
-                <a class="listing" href="{% pageurl subpage %}">
-                    {% if subpage.icon %}
-                        {% image subpage.icon fill-180x180 class="listing__image" %}
-                    {% else %}
-                        <div class="listing__image listing__image--default">
-                            <svg><use xlink:href="#logo-mobile-no-text"></use></svg>
-                        </div>
-                    {% endif %}
-
-                    <h4 class="listing__title">{{ subpage.listing_title|default:subpage.title }}</h4>
-
-                     {% if subpage.listing_summary or subpage.introduction %}
-                        <h6 class="listing__teaser">{{ subpage.listing_summary|default:subpage.introduction }}</h6>
-                    {% endif %}
-                </a>
-
-            {% endfor %}
-
-            {% include "includes/pagination.html" with paginator_page=subpages %}
-
-        {% else %}
-            {# no items on this page #}
-        {% endif %}
-    </div>
-</div>
-
-{% endblock %}
+{% extends "utils/listing_index.html" %}
diff --git a/opentech/public/utils/templates/utils/listing_index.html b/opentech/public/utils/templates/utils/listing_index.html
new file mode 100644
index 000000000..90f3558b7
--- /dev/null
+++ b/opentech/public/utils/templates/utils/listing_index.html
@@ -0,0 +1,44 @@
+{% extends "base.html" %}
+{% load wagtailcore_tags wagtailimages_tags %}
+{% block body_class %}light-grey-bg{% endblock %}
+{% block content %}
+<div class="wrapper wrapper--small wrapper--top-bottom-inner-space">
+    <div class="wrapper wrapper--listings">
+
+        {% if subpages.object_list.exists %}
+            {% for subpage in subpages.object_list.specific %}
+
+                <a class="listing" href="{% pageurl subpage %}">
+                    {% if subpage.icon %}
+                        {% image subpage.icon fill-180x180 class="listing__image" %}
+                    {% else %}
+                        <div class="listing__image listing__image--default">
+                            <svg><use xlink:href="#logo-mobile-no-text"></use></svg>
+                        </div>
+                    {% endif %}
+
+                    {% if subpage.deadline %}
+                        <p class="listing__deadline">
+                            <svg class="icon icon--calendar icon--small"><use xlink:href="#calendar"></use></svg>
+                            <span>Next deadline: {{ subpage.deadline|date:"M j, Y" }}</span>
+                        </p>
+                    {% endif %}
+
+                    <h4 class="listing__title">{{ subpage.listing_title|default:subpage.title }}</h4>
+
+                    {% if subpage.listing_summary or subpage.introduction %}
+                        <h6 class="listing__teaser">{{ subpage.listing_summary|default:subpage.introduction|truncatechars_html:155 }}</h6>
+                    {% endif %}
+                </a>
+
+            {% endfor %}
+
+            {% include "includes/pagination.html" with paginator_page=subpages %}
+
+        {% else %}
+            {# no items on this page #}
+        {% endif %}
+    </div>
+</div>
+
+{% endblock %}
-- 
GitLab