Skip to content

Commit

Permalink
Custom footer links and translations
Browse files Browse the repository at this point in the history
  • Loading branch information
blagojabozinovski committed Sep 2, 2024
1 parent 02b6d90 commit 7b2dbca
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 4 deletions.
25 changes: 25 additions & 0 deletions ckanext/alisea/i18n/ckanext-alisea.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translations template for ckanext-alisea.
# Copyright (C) 2024 ORGANIZATION
# This file is distributed under the same license as the ckanext-alisea project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ckanext-alisea 0.0.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-09-02 18:36+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.3\n"

#: ckanext/alisea/templates/footer.html:15
msgid ""
"<strong>Powered by</strong> <a class=\"hide-text ckan-footer-logo\" "
"href=\"http://ckan.org\">CKAN</a>"
msgstr ""

27 changes: 27 additions & 0 deletions ckanext/alisea/i18n/vi/LC_MESSAGES/ckanext-alisea.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Vietnamese translations for ckanext-alisea.
# Copyright (C) 2024 ORGANIZATION
# This file is distributed under the same license as the ckanext-alisea
# project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
#
msgid ""
msgstr ""
"Project-Id-Version: ckanext-alisea 0.0.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-09-02 18:36+0200\n"
"PO-Revision-Date: 2024-09-02 18:36+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: vi\n"
"Language-Team: vi <[email protected]>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.3\n"

#: ckanext/alisea/templates/footer.html:15
msgid ""
"<strong>Powered by</strong> <a class=\"hide-text ckan-footer-logo\" "
"href=\"http://ckan.org\">CKAN</a>"
msgstr ""

18 changes: 14 additions & 4 deletions ckanext/alisea/plugin.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
from ckan.lib.plugins import DefaultTranslation

from ckanext.alisea import helpers as h


class AliseaPlugin(plugins.SingletonPlugin):
class AliseaPlugin(plugins.SingletonPlugin, DefaultTranslation):
plugins.implements(plugins.IConfigurer)
plugins.implements(plugins.ITemplateHelpers)
plugins.implements(plugins.ITranslation)


# IConfigurer

def update_config(self, config_):
toolkit.add_template_directory(config_, "templates")
toolkit.add_public_directory(config_, "public")
Expand All @@ -20,7 +21,16 @@ def update_config(self, config_):
# ITemplateHelpers
def get_helpers(self):
return {
'get_google_tag':h.get_google_tag
'get_google_tag': h.get_google_tag
}


def update_config_schema(self, schema):

ignore_missing = toolkit.get_validator('ignore_missing')
validators = [ignore_missing]
schema.update({
'footer_left': validators,
'footer_right': validators,
})

return schema
13 changes: 13 additions & 0 deletions ckanext/alisea/templates/admin/config.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% ckan_extends %}

{% import 'macros/form.html' as form %}

{% block admin_form %}
{{ h.csrf_input() }}
{{ super() }}

{{ form.markdown('footer_left', label=_('Footer Left'), value=data.footer_left, error=error, placeholder=_('Enter a list of links - one per line - to be shown as a list withing the secondary footer navigation. Please format the links with Markdown (i.e. * [Example link](https://www.example.com)).'), classes=['control-full']) }}

{{ form.markdown('footer_right', label=_('Footer right'), value=data.footer_right, error=error, placeholder=_('Enter a list of links - one per line - to be shown as a list withing the secondary footer navigation. Please format the links with Markdown (i.e. * [Example link](https://www.example.com)).'), classes=['control-full']) }}

{% endblock %}
25 changes: 25 additions & 0 deletions ckanext/alisea/templates/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<footer class="site-footer">
<div class="container">
{% block footer_content %}

<div class="row">
{% include "/snippets/footer_left.html" %}
{% include "/snippets/footer_right.html" %}

</div>
<div class="row">
<div class="col-md-8 footer-links">
</div>
<div class="col-md-4 attribution">
{% block footer_attribution %}
<p>{% trans %}<strong>Powered by</strong> <a class="hide-text ckan-footer-logo" href="http://ckan.org">CKAN</a>{% endtrans %}</p>
{% endblock %}
{% block footer_lang %}
{% snippet "snippets/language_selector.html" %}
{% endblock %}
</div>
</div>
{% endblock %}
</div>
</footer>

7 changes: 7 additions & 0 deletions ckanext/alisea/templates/snippets/footer_left.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% if g.footer_left %}
<div class="col-md-4 attribution">
<div class="links">
{{ h.render_markdown(g.footer_left) }}
</div>
</div>
{% endif %}
7 changes: 7 additions & 0 deletions ckanext/alisea/templates/snippets/footer_right.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% if g.footer_right %}
<div class="col-md-4 attribution">
<div class="links">
{{ h.render_markdown(g.footer_right) }}
</div>
</div>
{% endif %}

0 comments on commit 7b2dbca

Please sign in to comment.