Skip to content

Commit

Permalink
complete migration #8
Browse files Browse the repository at this point in the history
  • Loading branch information
mdutoo committed Dec 9, 2021
1 parent fb9c9c6 commit 3b51e2a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 17 deletions.
5 changes: 2 additions & 3 deletions ckanext/ozwillo_theme/plugin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from pylons import config as pconfig

import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
pconfig = toolkit.config
from ckan.common import config
from ckan.lib.app_globals import set_app_global
from ckan.lib.plugins import DefaultTranslation
Expand All @@ -25,7 +24,7 @@ def update_config(self, config_):

toolkit.add_template_directory(config_, 'templates')
toolkit.add_public_directory(config_, 'public')
toolkit.add_resource('fanstatic', 'theme')
toolkit.add_resource('assets', 'theme')

# ITemplateHelpers
def get_helpers(self):
Expand Down
2 changes: 1 addition & 1 deletion ckanext/ozwillo_theme/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block styles %}
{{ super() }}
{% resource 'theme/ozwillo.css' %}
{% asset 'theme/ozwillo-css' %}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,800">
{% endblock %}

Expand Down
16 changes: 16 additions & 0 deletions ckanext/ozwillo_theme/templates/base.html.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% ckan_extends %}

{% block styles %}
{{ super() }}
{% resource 'theme/ozwillo.css' %}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,800">
{% endblock %}

{% block links %}
<link rel="shortcut icon" href="/img/data.ico" />
{% endblock %}


{% block body_extras %}
{{ super() }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="dataset-item">
<div class="row dataset__block-header">
<div class="col-xs-12">
<h4>{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='package', action='read',
<h4>{{ h.link_to(h.truncate(title, truncate_title), h.url_for('%s.read' % package.type,
id=package.name)) }}
</h4>
{% if notes %}
Expand All @@ -22,12 +22,12 @@ <h4>{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='packag
<ul class="dataset-resources unstyled">
{% for resource in h.dict_list_reduce(package.resources, 'format') %}
<li>
<a href="{{ h.url_for(controller='package', action='read', id=package.name) }}" class="label"
<a href="{{ h.url_for('%s.read' % package.type, id=package.name) }}" class="label"
data-format="{{ resource.lower() }}">{{ resource }}</a>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{% endblock %}

{% block package_basic_fields_url %}
{% set prefix = h.url_for(controller='package', action='read', id='') %}
{% set domain = h.url_for(controller='package', action='read', id='', qualified=true) %}
{% set prefix = h.url_for('dataset.read', id='') %}
{% set domain = h.url_for('dataset.read', id='', qualified=true) %}
{% set domain = domain|replace("http://", "")|replace("https://", "") %}
{% set attrs = {'data-module': 'slug-preview-slug', 'data-module-prefix': domain, 'data-module-placeholder': '<dataset>'} %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{% endblock %}
{% block delete_button %}
{% if h.check_access('package_delete', {'id': data.id}) and not data.state == 'deleted' %}
<a class="btn btn-danger pull-left" href="{% url_for controller='package', action='delete', id=data.id %}" data-module="confirm-action" data-module-content="{{ _('Are you sure you want to delete this dataset?') }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
<a class="btn btn-danger pull-left" href="{% url_for dataset_type ~ '.delete', id=data.id %}" data-module="confirm-action" data-module-content="{{ _('Are you sure you want to delete this dataset?') }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
{% endif %}
{% endblock %}
{% block save_button %}
Expand Down
9 changes: 4 additions & 5 deletions ckanext/ozwillo_theme/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,11 @@ <h2>A sidebar item</h2>

{%- block scripts %}
<script type="application/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/particles.min.js"></script>
{% resource 'theme/ozwillo.js' %}
{% resource 'theme/particles-loading.js' %}
{% resource 'base/main' %}
{% resource 'base/ckan' %}
{% asset 'theme/ozwillo' %}
{# % asset 'base/main' % rather in webassets.yml #}
{# % asset 'base/ckan' % rather in webassets.yml #}
{% if g.tracking_enabled %}
{% resource 'base/tracking.js' %}
{% asset 'base/tracking' %}
{% endif %}
{{ super() }}
{% endblock -%}
4 changes: 2 additions & 2 deletions ckanext/ozwillo_theme/templates/snippets/package_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h3 class="dataset-heading">
{% endif %}
{% endblock %}
{% block heading_title %}
{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='package', action='read', id=package.name)) }}
{{ h.link_to(h.truncate(title, truncate_title), h.url_for('%s.read' % package.type, id=package.name)) }}
{% endblock %}
{% block heading_meta %}
{% if package.get('state', '').startswith('draft') %}
Expand Down Expand Up @@ -66,7 +66,7 @@ <h3 class="dataset-heading">
{% block resources_inner %}
{% for resource in h.dict_list_reduce(package.resources, 'format') %}
<li>
<a href="{{ h.url_for(controller='package', action='read', id=package.name) }}" class="label" data-format="{{ resource.lower() }}">{{ resource }}</a>
<a href="{{ h.url_for(package.type ~ '.read', id=package.name) }}" class="label" data-format="{{ resource.lower() }}">{{ resource }}</a>
</li>
{% endfor %}
{% endblock %}
Expand Down

0 comments on commit 3b51e2a

Please sign in to comment.