From 9d6a08815fb1b1509e33fdb66925d142399f18a0 Mon Sep 17 00:00:00 2001
From: Xavier Frankline <xf.xavierfrank@gmail.com>
Date: Mon, 25 Mar 2024 15:58:39 +0300
Subject: [PATCH] update templates to use blueprints

---
 ckanext/openafrica/blueprint.py                            | 5 +++--
 ckanext/openafrica/plugin.py                               | 5 ++---
 ckanext/openafrica/templates/dataset-page.html             | 2 +-
 ckanext/openafrica/templates/header.html                   | 4 ++--
 ckanext/openafrica/templates/home/about/accessibility.html | 2 +-
 ckanext/openafrica/templates/home/about/coc.html           | 2 +-
 ckanext/openafrica/templates/home/about/contact.html       | 2 +-
 ckanext/openafrica/templates/home/about/faq.html           | 2 +-
 ckanext/openafrica/templates/home/about/moderation.html    | 2 +-
 ckanext/openafrica/templates/home/about/privacy.html       | 2 +-
 ckanext/openafrica/templates/home/about/toc.html           | 2 +-
 ckanext/openafrica/templates/page.html                     | 2 +-
 12 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/ckanext/openafrica/blueprint.py b/ckanext/openafrica/blueprint.py
index b826665..54dc528 100644
--- a/ckanext/openafrica/blueprint.py
+++ b/ckanext/openafrica/blueprint.py
@@ -1,7 +1,7 @@
 from flask import Blueprint
 from ckan.plugins.toolkit import render
 
-openafrica = Blueprint('datapusher', __name__)
+openafrica = Blueprint('openafrica', __name__)
 
 def toc():
     return render('home/about/toc.html')
@@ -33,7 +33,8 @@ def atlas():
     ("/about/code-of-conduct", "coc", coc),
     ("/about/moderation-policy", "moderation", moderation),
     ("/about/faq", "faq", faq),
-    ("/about/privacy", "privacy", privacy)
+    ("/about/privacy", "privacy", privacy),
+    ("/about/contact", "contact", contact)
 ]
 
 for rule in rules:
diff --git a/ckanext/openafrica/plugin.py b/ckanext/openafrica/plugin.py
index a5784d7..d0b1ba0 100644
--- a/ckanext/openafrica/plugin.py
+++ b/ckanext/openafrica/plugin.py
@@ -30,8 +30,8 @@ class OpenAfricaPlugin(plugins.SingletonPlugin):
     u"""
     openAFRICA templating plugin.
     """
-    plugins.implements(plugins.IConfigurer)
-    plugins.implements(plugins.ITemplateHelpers)
+    plugins.implements(plugins.IConfigurer, inherit=True)
+    plugins.implements(plugins.ITemplateHelpers, inherit=True)
     plugins.implements(plugins.IBlueprint)
 
     def update_config(self, config):
@@ -43,7 +43,6 @@ def update_config(self, config):
         """
         toolkit.add_template_directory(config, 'templates')
         toolkit.add_public_directory(config, 'public')
-        # toolkit.add_resource('fanstatic', 'openafrica')
         toolkit.add_resource('assets', 'openafrica')
 
     # IBlueprint
diff --git a/ckanext/openafrica/templates/dataset-page.html b/ckanext/openafrica/templates/dataset-page.html
index bfcba44..1be96a5 100644
--- a/ckanext/openafrica/templates/dataset-page.html
+++ b/ckanext/openafrica/templates/dataset-page.html
@@ -23,7 +23,7 @@
     {% block flash %}
     <div class="flash-messages">
       {% block flash_inner %}
-      {% for message in h.flash.pop_messages() | list %}
+      {% for message in h.flash.pop_messages | list %}
       <div class="alert fade in {{ message.category }}">
         {{ h.literal(message) }}
       </div>
diff --git a/ckanext/openafrica/templates/header.html b/ckanext/openafrica/templates/header.html
index 7cb8d07..885fb1a 100644
--- a/ckanext/openafrica/templates/header.html
+++ b/ckanext/openafrica/templates/header.html
@@ -8,10 +8,10 @@
       <!-- Be sure to leave the brand out there if you want it shown -->
       {% block header_logo %}
       {% if g.site_logo %}
-      <a class="logo brand" href="{{ h.url('home') }}"><img src="{{ g.site_logo }}" alt="{{ g.site_title }}"
+      <a class="logo brand" href="{{ h.url_for('home.index') }}"><img src="{{ g.site_logo }}" alt="{{ g.site_title }}"
           title="{{ g.site_title }}" /></a>
       {% else %}
-      <a class="brand" href="{{ h.url('home') }}"><img
+      <a class="brand" href="{{ h.url_for('home.index') }}"><img
           src="https://cloud.githubusercontent.com/assets/877919/14067805/7e3ff5ae-f476-11e5-88eb-059d88816232.png"
           alt="{{ g.site_title }}" title="{{ g.site_title }}" /></a>
       {% endif %}
diff --git a/ckanext/openafrica/templates/home/about/accessibility.html b/ckanext/openafrica/templates/home/about/accessibility.html
index 4e5478a..eabbbfb 100644
--- a/ckanext/openafrica/templates/home/about/accessibility.html
+++ b/ckanext/openafrica/templates/home/about/accessibility.html
@@ -4,7 +4,7 @@
 
 {% block breadcrumb_content %}
 	<li >{% link_for _('About'), controller='home', action='about' %}</li>
-	<li class="active">{% link_for _('Accessibility'), controller='ckanext.openafrica.controller:CustomPageController', action='accessibility' %}</li>
+	<li class="active">{% link_for _('Accessibility'), named_route='openafrica.accessibility' %}</li>
 {% endblock %}
 
 {% block primary %}
diff --git a/ckanext/openafrica/templates/home/about/coc.html b/ckanext/openafrica/templates/home/about/coc.html
index cecd567..6394e1e 100644
--- a/ckanext/openafrica/templates/home/about/coc.html
+++ b/ckanext/openafrica/templates/home/about/coc.html
@@ -4,7 +4,7 @@
 
 {% block breadcrumb_content %}
 	<li >{% link_for _('About'), controller='home', action='about' %}</li>
-	<li class="active">{% link_for _('Code of Conduct'), controller='ckanext.openafrica.controller:CustomPageController', action='coc' %}</li>
+	<li class="active">{% link_for _('Code of Conduct'), named_route='openafrica.coc' %}</li>
 {% endblock %}
 
 {% block primary %}
diff --git a/ckanext/openafrica/templates/home/about/contact.html b/ckanext/openafrica/templates/home/about/contact.html
index 9abba96..3ad0b85 100644
--- a/ckanext/openafrica/templates/home/about/contact.html
+++ b/ckanext/openafrica/templates/home/about/contact.html
@@ -4,7 +4,7 @@
 
 {% block breadcrumb_content %}
 	<li >{% link_for _('About'), controller='home', action='about' %}</li>
-	<li class="active">{% link_for _('Contact Us'), controller='ckanext.openafrica.controller:CustomPageController', action='contact' %}</li>
+	<li class="active">{% link_for _('Contact Us'), named_route='openafrica.contact' %}</li>
 {% endblock %}
 
 {% block primary %}
diff --git a/ckanext/openafrica/templates/home/about/faq.html b/ckanext/openafrica/templates/home/about/faq.html
index 7c826a8..a52a983 100644
--- a/ckanext/openafrica/templates/home/about/faq.html
+++ b/ckanext/openafrica/templates/home/about/faq.html
@@ -4,7 +4,7 @@
 
 {% block breadcrumb_content %}
 	<li >{% link_for _('About'), controller='home', action='about' %}</li>
-	<li class="active">{% link_for _('FAQs'), controller='ckanext.openafrica.controller:CustomPageController', action='faq' %}</li>
+	<li class="active">{% link_for _('FAQs'), named_route='openafrica.faq' %}</li>
 {% endblock %}
 
 {% block primary %}
diff --git a/ckanext/openafrica/templates/home/about/moderation.html b/ckanext/openafrica/templates/home/about/moderation.html
index fe52b2b..a8ac6ed 100644
--- a/ckanext/openafrica/templates/home/about/moderation.html
+++ b/ckanext/openafrica/templates/home/about/moderation.html
@@ -4,7 +4,7 @@
 
 {% block breadcrumb_content %}
 	<li >{% link_for _('About'), controller='home', action='about' %}</li>
-	<li class="active">{% link_for _('Moderation Policy'), controller='ckanext.openafrica.controller:CustomPageController', action='moderation' %}</li>
+	<li class="active">{% link_for _('Moderation Policy'), named_route='openafrica.moderation' %}</li>
 {% endblock %}
 
 {% block primary %}
diff --git a/ckanext/openafrica/templates/home/about/privacy.html b/ckanext/openafrica/templates/home/about/privacy.html
index 7bacc1e..2fb6761 100644
--- a/ckanext/openafrica/templates/home/about/privacy.html
+++ b/ckanext/openafrica/templates/home/about/privacy.html
@@ -4,7 +4,7 @@
 
 {% block breadcrumb_content %}
 	<li >{% link_for _('About'), controller='home', action='about' %}</li>
-	<li class="active">{% link_for _('Privacy'), controller='ckanext.openafrica.controller:CustomPageController', action='privacy' %}</li>
+	<li class="active">{% link_for _('Privacy'), named_route='openafrica.privacy' %}</li>
 {% endblock %}
 
 {% block primary %}
diff --git a/ckanext/openafrica/templates/home/about/toc.html b/ckanext/openafrica/templates/home/about/toc.html
index 951b403..30065b1 100644
--- a/ckanext/openafrica/templates/home/about/toc.html
+++ b/ckanext/openafrica/templates/home/about/toc.html
@@ -4,7 +4,7 @@
 
 {% block breadcrumb_content %}
 	<li >{% link_for _('About'), controller='home', action='about' %}</li>
-	<li class="active">{% link_for _('Terms & Conditions'), controller='ckanext.openafrica.controller:CustomPageController', action='toc' %}</li>
+	<li class="active">{% link_for _('Terms & Conditions'), named_route='openafrica.toc' %}</li>
 {% endblock %}
 
 {% block primary %}
diff --git a/ckanext/openafrica/templates/page.html b/ckanext/openafrica/templates/page.html
index 5d3155a..e3ed21a 100644
--- a/ckanext/openafrica/templates/page.html
+++ b/ckanext/openafrica/templates/page.html
@@ -23,7 +23,7 @@
     {% block flash %}
     <div class="flash-messages">
       {% block flash_inner %}
-      {% for message in h.flash.pop_messages() | list %}
+      {% for message in h.flash.pop_messages | list %}
       <div class="alert fade in {{ message.category }}">
         {{ h.literal(message) }}
       </div>