Skip to content

Commit

Permalink
Merge pull request #103 from asc-csa/Development
Browse files Browse the repository at this point in the history
Merge Development into master. Addresses all conformity issues identified in the third communications review.
  • Loading branch information
nfee006 authored Mar 10, 2021
2 parents 61245a4 + 9893c4f commit 19b90a6
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ckanext/csa/templates/header_embeds.html
ckanext/csa/templates/footer_embeds.html
9 changes: 7 additions & 2 deletions ckanext/csa/fanstatic/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
a {
background-color: white;
}

.dataset-private.pull-right {
font-size: 12px;
margin-top: 8px;
}
@media (min-width: 768px) {
[role=main],
.main {
.main, .page-wrap {
padding-top: 10px;
background: white;
}
Expand All @@ -34,7 +39,7 @@

@media (min-width: 768px) {
[role=main],
.main {
.main, .page-wrap {
padding-top: 10px;
background: #fff;
}
Expand Down
12 changes: 12 additions & 0 deletions ckanext/csa/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import unicodedata
from pylons.i18n import _
from ckantoolkit import h
from os import path



Expand Down Expand Up @@ -39,6 +40,17 @@ def get_translated_t(data_dict, field):
return (_(val) if val and isinstance(val, basestring) else val), False


def header_embeds_exists():
''' check whether the files exists '''
# return path.dirname(path.realpath(__file__))
return path.exists(path.dirname(path.realpath(__file__))+'/templates/header_embeds.html')

def footer_embeds_exists():
''' check whether the files exists '''
# return path.dirname(path.realpath(__file__))
return path.exists(path.dirname(path.realpath(__file__))+'/templates/footer_embeds.html')


def csa_get_field_descriptions():
"""
Gets field descriptions stored in a CsaPlugin object if initialized
Expand Down
2 changes: 2 additions & 0 deletions ckanext/csa/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ def get_helpers(self):
'csa_get_field_descriptions': helpers.csa_get_field_descriptions,
'csa_get_field_description': helpers.csa_get_field_description,
'get_translated_t' : helpers.get_translated_t,
'header_embeds_exists' : helpers.header_embeds_exists,
'footer_embeds_exists' : helpers.footer_embeds_exists,
}


Expand Down
6 changes: 6 additions & 0 deletions ckanext/csa/templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ <h2 class="wb-inv">{{ _("About this site") }}</h2>
</div>
</footer>

{% block footer_embeds %}
{% if h.footer_embeds_exists() %}
{% include "footer_embeds.html" %}
{% endif %}
{% endblock %}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.js"></script>
<script src="https://wet-boew.github.io/themes-dist/GCWeb/wet-boew/js/wet-boew.min.js"></script>
<script src="https://wet-boew.github.io/themes-dist/GCWeb/js/theme.min.js"></script>
Expand Down
5 changes: 5 additions & 0 deletions ckanext/csa/templates/footer_embeds.html.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!--
Instructions
Make a copy of this file, remove the '.example' extension and replace the contents with any html you would like to appear
in the footer. This is intended for scripts such as analytic trackers.
-->
6 changes: 6 additions & 0 deletions ckanext/csa/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
<!-- Web Experience Toolkit (WET) / Boîte à outils de l'expériencse-search-boxce Web (BOEW)
wet-boew.github.io/wet-boew/License-en_(.html / wet-boew.github.io/wet-boew/Licence-fr.html -->

{% block header_embeds %}
{% if h.header_embeds_exists() %}
{% include "header_embeds.html" %}
{% endif %}
{% endblock %}

<header style="background-color: white;">
<div id="wb-bnr" class="container">
<div class="row">
Expand Down
5 changes: 5 additions & 0 deletions ckanext/csa/templates/header_embeds.html.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!--
Instructions
Make a copy of this file, remove the '.example' extension and replace the contents with any html you would like to appear
in the footer. This is intended for scripts such as analytic trackers.
-->
32 changes: 16 additions & 16 deletions ckanext/csa/templates/package/read.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,6 @@
{% block primary_content_inner %}
{{ super() }}
{% block package_description %}
{% if pkg.private %}
<span class="dataset-private label label-inverse pull-right">
<i class="fa fa-lock"></i>
{{ _('Private') }}
</span>
{% endif %}
{% block package_archive_notice %}
{% if is_activity_archive %}
<div class="alert alert-danger">
{% trans url=h.url_for('dataset.read', id=pkg.id) %}
You're currently viewing an old version of this dataset. To see the
current version, click <a href="{{ url }}">here</a>.
{% endtrans %}
</div>
{% endif %}
{% endblock %}
<h1>
{% block page_heading %}
{{ h.dataset_display_name(pkg) }}
Expand All @@ -31,7 +15,23 @@ <h1>
[{{ _('Deleted') }}]
{% endif %}
{% endblock %}
{% if pkg.private %}
<span class="dataset-private label label-inverse pull-right">
<i class="fa fa-lock"></i>
{{ _('Private') }}
</span>
{% endif %}
</h1>
{% block package_archive_notice %}
{% if is_activity_archive %}
<div class="alert alert-danger">
{% trans url=h.url_for('dataset.read', id=pkg.id) %}
You're currently viewing an old version of this dataset. To see the
current version, click <a href="{{ url }}">here</a>.
{% endtrans %}
</div>
{% endif %}
{% endblock %}
{% block package_notes %}
{% if pkg.notes %}
<div class="notes embedded-content">
Expand Down
17 changes: 14 additions & 3 deletions ckanext/csa/templates/package/search.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
{% ckan_extends %}
{% set pkg = c.pkg_dict %}
{% set res = c.resource %}

{% block page_header_block %}
{% if not pkg %}
{%if h.lang()=='en'%}
<h1>CSA Open Government Portal</h1>
{%else%}
<h1>Portail du gouvernement ouvert de l'ASC</h1>
{%endif%}
{% endif %}
{% endblock %}

{% block main_search_role %}role="main"{% endblock %}

{% block secondary_content %}
<!--template/package/search.html start-->
Expand All @@ -20,9 +34,6 @@ <h2 style="padding-left: 12px; padding-right: 12px; padding-top: 12px; padding-b


<!--template/package/search.html end-->



{% endblock %}

{% block form %}
Expand Down
9 changes: 5 additions & 4 deletions ckanext/csa/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

{# The content block allows you to replace the content of the page if needed #}
{%- block content %}
{% block maintag %}<div role="main" >{% endblock %}
{% block maintag %}<div class='page-wrap'>{% endblock %}
<div id="content" class="container" >
{% block main_content %}
{% block flash %}
Expand All @@ -44,14 +44,15 @@
</div>
{% endblock %}


<div class="row wrapper{% block wrapper_class %}{% endblock %}{% if self.secondary()|trim == '' or c.action=='resource_read' %} no-nav{% endif %}">
<div {% block main_search_role %}{% endblock %} class="row wrapper{% block wrapper_class %}{% endblock %}{% if self.secondary()|trim == '' or c.action=='resource_read' %} no-nav{% endif %}">
{#
The pre_primary block can be used to add content to before the
rendering of the main content columns of the page.
#}
{% block pre_primary %}
{% endblock %}
{% block page_header_block %}
{% endblock %}

{% block secondary %}
<aside class="secondary col-sm-3">
Expand Down Expand Up @@ -102,7 +103,7 @@ <h1>My page content</h1>
{% endblock %}
#}

<div class="module-content">
<div role='main' class="module-content">
{% if self.page_primary_action() | trim %}
<div class="page_primary_action">
{% block page_primary_action %}{% endblock %}
Expand Down
12 changes: 10 additions & 2 deletions ckanext/csa/templates/snippets/home_breadcrumb_item.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<!--template/snippets/home_breadcrumb.html start-->
{% set pkg = c.pkg_dict %}
{% set res = c.resource %}
{# Used to insert the home icon into a breadcrumb #}
{% if h.lang() == 'en' %}
<li><a href="https://www.canada.ca/en.html">Canada.ca</a></li>
<li><a href="https://www.asc-csa.gc.ca/eng/Default.asp">Canadian Space Agency</a></li>
<li id="wb-cont"><a href="/en">Open Data</a></li>
<li id="wb-cont"><a href="/en">Open Government</a></li>
{% if pkg %}
<li>{{ h.dataset_display_name(pkg) }}</li>
{% endif %}
{% else %}
<li><a href="https://www.canada.ca/fr.html">Canada.ca</a></li>
<li><a href="https://www.asc-csa.gc.ca/fra/Default.asp">Agence spatiale canadienne</a></li>
<li id="wb-cont"><a href="/fr/dataset">Données ouvertes</a></li>
<li id="wb-cont"><a href="/fr/dataset">Gouvernement ouvert</a></li>
{% if pkg %}
<li>{{ h.dataset_display_name(pkg) }}</li>
{% endif %}
{% endif %}
<!--template/snippets/home_breadcrumb.html end-->
4 changes: 2 additions & 2 deletions ckanext/csa/templates/snippets/package_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<article class="panel panel-default mrgn-bttm-sm relative">
<header class="panel-heading" style="background-color: white;">

<h2 class="panel-title">
<h3 class="panel-title">
{% block heading %}
{% set my_title, machine_translated = h.csa_get_translated_t(package, 'title') %}
{% if 'title_translated' not in package %}
Expand All @@ -23,7 +23,7 @@ <h2 class="panel-title">
<i class="fa fa-language text-muted mrgn-lft-sm" title="{{ _("This third party metadata element has been translated using an automated translation tool (DeepL). To report any discrepancies please contact [email protected]") }}"></i>
{% endif %}
{% endblock %}
</h2></header>
</h3></header>

<div class="panel-body">
{% block banner %}
Expand Down
4 changes: 2 additions & 2 deletions ckanext/csa/templates/snippets/search_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@

{% block search_title %}
{% if not error %}
<h1>{% snippet 'snippets/search_result_text.html', query=query, count=count, type=type %}</h1>
<h2>{% snippet 'snippets/search_result_text.html', query=query, count=count, type=type %}</h2>
{% else %}
<h1>Error</h1>
<h2>Error</h2>
{% endif %}
{% endblock %}

Expand Down

0 comments on commit 19b90a6

Please sign in to comment.