Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

djlinted templates #558

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
{% if h.check_access('package_update',{'id':pkg_dict.id}) %}
<div class="package-additional-info-tr">
<dt class="dataset-label package-additional-info-th">{{ _("State") }}</dt>
<dd class="dataset-details package-additional-info-td">{{ _(pkg_dict.state) }}</dd>
<dd class="dataset-details package-additional-info-td">
{{ _(pkg_dict.state) }}
</dd>
</div>
{% endif %}
{% endblock package_additional_info %}
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ <h3>{{ _( "Field {num}.").format(num=position) }} {{ field.id }} ({{ field.type
#}

{{ form.select('info__' ~ position ~ '__type_override',
label=_('Type Override'), options=[
{'name': '', 'value': ''},
{'name': 'boolean', 'value': 'boolean'},
{'name': 'date', 'value': 'date'},
{'name': 'float', 'value': 'double precision'},
{'name': 'integer', 'value': 'integer'},
{'name': 'array', 'value': 'integer[]'},
{'name': 'interval', 'value': 'interval'},
{'name': 'money', 'value': 'money'},
{'name': 'numeric', 'value': 'numeric'},
{'name': 'array', 'value': 'numeric[]'},
{'name': 'text', 'value': 'text'},
{'name': 'array', 'value': 'text[]'},
{'name': 'time', 'value': 'time'},
{'name': 'timestamp', 'value': 'timestamp'},
], selected=field.get('info', {}).get('type_override', '')) }}
label=_('Type Override'), options=[
{'name': '', 'value': ''},
{'name': 'boolean', 'value': 'boolean'},
{'name': 'date', 'value': 'date'},
{'name': 'float', 'value': 'double precision'},
{'name': 'integer', 'value': 'integer'},
{'name': 'array', 'value': 'integer[]'},
{'name': 'interval', 'value': 'interval'},
{'name': 'money', 'value': 'money'},
{'name': 'numeric', 'value': 'numeric'},
{'name': 'array', 'value': 'numeric[]'},
{'name': 'text', 'value': 'text'},
{'name': 'array', 'value': 'text[]'},
{'name': 'time', 'value': 'time'},
{'name': 'timestamp', 'value': 'timestamp'},
], selected=field.get('info', {}).get('type_override', '')) }}

{{ form.input('info__' ~ position ~ '__label',
label=_('Label'), id='field-f' ~ position ~ 'label',
value=field.get('info', {}).get('label', ''), classes=['control-full']) }}
label=_('Label'), id='field-f' ~ position ~ 'label',
value=field.get('info', {}).get('label', ''), classes=['control-full']) }}

{{ form.markdown('info__' ~ position ~ '__notes',
label=_('Description'), id='field-d' ~ position ~ 'notes',
value=field.get('info', {}).get('notes', '')) }}
label=_('Description'), id='field-d' ~ position ~ 'notes',
value=field.get('info', {}).get('notes', '')) }}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{% extends "group/read_base.html" %}
{% extends "group/read_base.html" %}

{% block subtitle %}
{{ _('History') }} {{ g.template_title_delimiter }} {{ h.get_translated(c.group_dict,"title") }}
{% endblock subtitle %}
{% endblock subtitle %}


{% block primary_content_inner %}
<div class="ontario-columns">
Expand Down
8 changes: 4 additions & 4 deletions ckanext/ontario_theme/templates/internal/group/read.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
tabindex="0"
class="close no-text hide-filters">
<svg class="ontario-icon hide-sort-by"
focusable="false"
sol:category="primary"
viewBox="0 0 24 24"
preserveAspectRatio="xMidYMid meet">
focusable="false"
sol:category="primary"
viewBox="0 0 24 24"
preserveAspectRatio="xMidYMid meet">
<use xlink:href="#ontario-icon-close"></use>
</svg>
</span>
Expand Down
3 changes: 2 additions & 1 deletion ckanext/ontario_theme/templates/internal/gtm.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl+ '&gtm_auth=Wq24uXP3CoptjFHA01X7vA&gtm_preview=env-26&gtm_cookies_win=x';f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-TK6PW9Z');</script>
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl+ '&gtm_auth=Wq24uXP3CoptjFHA01X7vA&gtm_preview=env-26&gtm_cookies_win=x';f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-TK6PW9Z');
</script>
<!-- End Google Tag Manager -->
6 changes: 5 additions & 1 deletion ckanext/ontario_theme/templates/internal/gtm_ns.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id="height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id="
height="0"
width="0"
style="display:none;
visibility:hidden"></iframe></noscript>
<!-- End Google Tag manager (noscript) -->
4 changes: 2 additions & 2 deletions ckanext/ontario_theme/templates/internal/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<a href="{{ h.url_for(h.current_url(), locale=toggle_to) }}"
class="ontario-header__language-toggler ontario-header-button ontario-header-button--without-outline"
lang="{{ 'fr' if current_lang =='en' else 'en' }}">
{{ 'Français' if current_lang =='en' else 'English' }}
{{ 'Français' if current_lang =='en' else 'English' }}
</a>
</div>
</div>
Expand Down Expand Up @@ -149,7 +149,7 @@
id="ontario-search-reset"
type="reset"
value=""
aria-label="{{ _('Clear field') }}"/>
aria-label="{{ _('Clear field') }}" />
<button class="ontario-search-submit header-search"
id="ontario-header-search-submit"
type="submit">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
class="hp_category">
<i class="fa fa-{{ i['fa-icon'] }}"></i>
<span>{{ i[label] }}</span></a>
<span class="category-count">({{ h.ontario_theme_get_keyword_count(_(i[label]), language) }}<span class="ontario-show-for-sr"> {{ _('datasets') }}</span>)</span>
<span class="category-count">({{ h.ontario_theme_get_keyword_count(_(i[label]), language) }}<span class="ontario-show-for-sr">{{ _('datasets') }}</span>)</span>
</li>
{% endfor %}
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
id="home-search-reset"
type="reset"
value=""
aria-label="{{ _('Clear field') }}"/>
aria-label="{{ _('Clear field') }}" />
<button class="ontario-search-submit"
id="ontario-search-submit"
type="submit">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

{% block subtitle %}
{{ _('History') }} {{ g.template_title_delimiter }} {{ h.get_translated(c.group_dict,"title") }} - {{ _('Ministries') }}
{% endblock subtitle %}
{% endblock subtitle %}


{% block primary_content_inner %}
<div class="ontario-columns">
Expand Down
34 changes: 17 additions & 17 deletions ckanext/ontario_theme/templates/internal/organization/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ <h1>
data-module="select-switch"
novalidate>
{% snippet 'snippets/search_form.html',
searchbar_title=searchbar_title,
form_id=form_id,
type=type,
query=query,
sorting=sorting,
sorting_selected=sort_by_selected,
count=c.page.item_count,
sr_submit_text=sr_submit_text,
facets=facets,
show_empty=request.params,
error=c.query_error,
fields=c.fields
%}
searchbar_title=searchbar_title,
form_id=form_id,
type=type,
query=query,
sorting=sorting,
sorting_selected=sort_by_selected,
count=c.page.item_count,
sr_submit_text=sr_submit_text,
facets=facets,
show_empty=request.params,
error=c.query_error,
fields=c.fields
%}
</form>
{% endblock organizations_search_form %}
</div>
Expand All @@ -79,10 +79,10 @@ <h1>
{% set current_lang = request.environ.CKAN_LANG %}
{% set reverse = True if 'desc' in request.params['sort'] else False %}
{% set sorted_org = h.ontario_theme_sort_by_title_translated(c.page.items,
current_page=c.page.page,
items_per_page=c.page.items_per_page,
lang=current_lang,
reverse=reverse) %}
current_page=c.page.page,
items_per_page=c.page.items_per_page,
lang=current_lang,
reverse=reverse) %}
{% snippet "organization/snippets/organization_list.html", organizations=sorted_org %}
{% endif %}
{% else %}
Expand Down
24 changes: 12 additions & 12 deletions ckanext/ontario_theme/templates/internal/package/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,18 @@ <h1 class="ontario-h1">
data-module="select-switch"
novalidate>
{% snippet "snippets/search_form.html",
searchbar_title=searchbar_title,
form_id=form_id,
type=type,
query=query,
sorting=sorting,
sorting_selected=sort_order,
count=c.page.item_count,
placeholder=input_text,
facets=facets,
show_empty=request.params,
error=c.query_error,
fields=c.fields %}
searchbar_title=searchbar_title,
form_id=form_id,
type=type,
query=query,
sorting=sorting,
sorting_selected=sort_order,
count=c.page.item_count,
placeholder=input_text,
facets=facets,
show_empty=request.params,
error=c.query_error,
fields=c.fields %}
</form>
{% endblock form %}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,66 @@ <h2>{{ _('Additional information') }}</h2>
<div class="package-additional-info-tr">
<dt class="dataset-label package-additional-info-th">{{ _('Source') }}</dt>
{% if h.is_url(pkg_dict.url) %}
<dd class="dataset-details package-additional-info-td" property="foaf:homepage">
<dd class="dataset-details package-additional-info-td"
property="foaf:homepage">
{{ h.link_to(pkg_dict.url, pkg_dict.url, rel='foaf:homepage', target='_blank') }}
</dd>
{% else %}
<dd class="dataset-details package-additional-info-td" property="foaf:homepage">{{ pkg_dict.url }}</dd>
<dd class="dataset-details package-additional-info-td"
property="foaf:homepage">
{{ pkg_dict.url }}
</dd>
{% endif %}
</div>
{% endif %}
{% if pkg_dict.author_email %}
<div class="package-additional-info-tr">
<dt class="dataset-label package-additional-info-th">{{ _("Author") }}</dt>
<dd class="dataset-details package-additional-info-td" property="dc:creator">
<dd class="dataset-details package-additional-info-td"
property="dc:creator">
{{ h.mail_to(email_address=pkg_dict.author_email, name=pkg_dict.author) }}
</dd>
</div>
{% elif pkg_dict.author %}
<div class="package-additional-info-tr">
<dt class="dataset-label package-additional-info-th">{{ _("Author") }}</dt>
<dd class="dataset-details package-additional-info-td" property="dc:creator">{{ pkg_dict.author }}</dd>
<dd class="dataset-details package-additional-info-td"
property="dc:creator">
{{ pkg_dict.author }}
</dd>
</div>
{% endif %}
{% if pkg_dict.maintainer_email %}
<div class="package-additional-info-tr">
<dt class="dataset-label package-additional-info-th">{{ _('Maintainer') }}</dt>
<dd class="dataset-details package-additional-info-td" property="dc:contributor">
<dd class="dataset-details package-additional-info-td"
property="dc:contributor">
{{ h.mail_to(email_address=pkg_dict.maintainer_email, name=pkg_dict.maintainer) }}
</dd>
</div>
{% elif pkg_dict.maintainer %}
<div class="package-additional-info-tr">
<dt class="dataset-label package-additional-info-th">{{ _('Maintainer') }}</dt>
<dd class="dataset-details package-additional-info-td" property="dc:contributor">{{ pkg_dict.maintainer }}</dd>
<dd class="dataset-details package-additional-info-td"
property="dc:contributor">
{{ pkg_dict.maintainer }}
</dd>
</div>
{% endif %}
{% if pkg_dict.version %}
<div class="package-additional-info-tr">
<dt class="dataset-label package-additional-info-th">{{ _("Version") }}</dt>
<dd class="dataset-details package-additional-info-td">{{ pkg_dict.version }}</dd>
<dd class="dataset-details package-additional-info-td">
{{ pkg_dict.version }}
</dd>
</div>
{% endif %}
{% if h.check_access('package_update',{'id':pkg_dict.id}) %}
<div class="package-additional-info-tr">
<dt class="dataset-label package-additional-info-th">{{ _("State") }}</dt>
<dd class="dataset-details package-additional-info-td">{{ _(pkg_dict.state) }}</dd>
<dd class="dataset-details package-additional-info-td">
{{ _(pkg_dict.state) }}
</dd>
</div>
{% endif %}
{% if pkg_dict.metadata_modified %}
Expand All @@ -72,9 +88,15 @@ <h2>{{ _('Additional information') }}</h2>
{% block extras scoped %}
{% for extra in h.sorted_extras(pkg_dict.extras) %}
{% set key, value = extra %}
<div class="package-additional-info-tr" rel="dc:relation" resource="_:extra{{ i }}">
<dt class="dataset-label package-additional-info-th" property="rdfs:label">{{ _(key|e) }}</dt>
<dd class="dataset-details package-additional-info-td" property="rdf:value">{{ value }}</dd>
<div class="package-additional-info-tr"
rel="dc:relation"
resource="_:extra{{ i }}">
<dt class="dataset-label package-additional-info-th"
property="rdfs:label">{{ _(key|e) }}</dt>
<dd class="dataset-details package-additional-info-td"
property="rdf:value">
{{ value }}
</dd>
</div>
{% endfor %}
{% endblock extras %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% set description = h.scheming_language_text(pkg['notes_translated'])|truncate(5000, true) %}
{%- endif -%}
{% block javascript %}
<script type="application/ld+json">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Dataset",
Expand Down Expand Up @@ -54,5 +54,5 @@
]
{% endif %}
}
</script>
{% endblock javascript %}
</script>
{% endblock javascript %}
19 changes: 10 additions & 9 deletions ckanext/ontario_theme/templates/internal/scheming/group/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

{% block subtitle %}
{{ _('More information') }} {{ g.template_title_delimiter }} {{ h.get_translated(c.group_dict,"title") }}
{% endblock subtitle %}
{% endblock subtitle %}


<div class="ontario-columns">

Comment on lines +5 to 9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the addition spaces around the div, one space after the endblock should suffice

{% block primary_content_inner %}
{% block organization_description %}
{% if h.get_translated(c.group_dict, "description") %}
{{ h.render_markdown(h.get_translated(c.group_dict, "description"), allow_html=true) }}
{% endif %}
{% endblock organization_description %}
{% endblock primary_content_inner %}
{% block primary_content_inner %}
{% block organization_description %}
{% if h.get_translated(c.group_dict, "description") %}
{{ h.render_markdown(h.get_translated(c.group_dict, "description"), allow_html=true) }}
{% endif %}
{% endblock organization_description %}
{% endblock primary_content_inner %}

</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

{% block subtitle %}
{{ _('More information') }} {{ g.template_title_delimiter }} {{ h.get_translated(c.group_dict,"title") }}
{% endblock subtitle %}
{% endblock subtitle %}


{% set exclude_fields = ["name", "title_translated", "org_contact", "image_url", "description_translated"] %}
{% set current_lang = request.environ.CKAN_LANG %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ <h1>{{ h.resource_display_name(res) }}</h1>
{% endif %}
{% endblock resource_read_url %}

{% if res.description %}
<div>
{{ h.render_markdown(h.get_translated(res, "description")) }}
</div>
{% endif %}
{% if res.description %}<div>{{ h.render_markdown(h.get_translated(res, "description")) }}</div>{% endif %}
{% if not res.description and c.package.notes %}
{% if res.datastore_active %}
{{ h.render_markdown(h.get_translated(c.package, 'notes')) }}
Expand Down
Loading