Skip to content

Commit

Permalink
Migrate to CKAN 2.9.4 & python 3.7 :
Browse files Browse the repository at this point in the history
- following process at ozwillo/ckanext-ozwillo-theme#8
- patched imports : config, urlparse
- moved to webassets instead of fanstatic (save for IE conditional vendor/excanvas.js)
  • Loading branch information
mdutoo committed May 18, 2022
1 parent b6a72bf commit c1deddd
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 33 deletions.
8 changes: 4 additions & 4 deletions ckanext/mapviews/plugin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import urlparse
from urllib.parse import urlparse

import ckan.plugins as p
import pylons.config as config
config = p.toolkit.config

Invalid = p.toolkit.Invalid
_ = p.toolkit._
Expand All @@ -11,8 +11,8 @@


def url_is_relative_or_in_same_domain(url):
site_url = urlparse.urlparse(config.get('ckan.site_url', ''))
parsed_url = urlparse.urlparse(url)
site_url = urlparse(config.get('ckan.site_url', ''))
parsed_url = urlparse(url)

is_relative = (parsed_url.netloc == '')
is_in_same_domain = (parsed_url.netloc == site_url.netloc)
Expand Down
26 changes: 0 additions & 26 deletions ckanext/mapviews/theme/public/resource.config

This file was deleted.

25 changes: 25 additions & 0 deletions ckanext/mapviews/theme/public/webassets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
main-css:
output: ckanext-mapviews/main.css
extra:
preload:
- base/main
contents:
- vendor/leaflet.css
- vendor/leaflet.label.css
- navigablemap.css
- choroplethmap.css

main:
output: ckanext-mapviews/main.js
extra:
preload:
- base/main
contents:
- vendor/leaflet.js
- vendor/leaflet.label.js
- vendor/d3.scale.quantize.js
- vendor/backend.ckan.js
- vendor/queryStringToJSON.js
- ckan_map_modules.js
- navigablemap.js
- choroplethmap.js
6 changes: 6 additions & 0 deletions ckanext/mapviews/theme/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% ckan_extends %}

{% block styles %}
{{ super() }}
{% asset 'mapviews/main-css' %}
{% endblock %}
2 changes: 1 addition & 1 deletion ckanext/mapviews/theme/templates/choroplethmap_view.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% resource "mapviews/main" %}
{% asset "mapviews/main" %}

<div
data-module = "choroplethmap"
Expand Down
2 changes: 1 addition & 1 deletion ckanext/mapviews/theme/templates/navigablemap_form.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% resource 'mapviews/main' %}
{% asset 'mapviews/main' %}
{% import 'macros/form.html' as form %}

{% macro filterFields(name, label='', options='', error='', fields={}, classes=[], attrs={}, is_required=false) %}
Expand Down
2 changes: 1 addition & 1 deletion ckanext/mapviews/theme/templates/navigablemap_view.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% resource "mapviews/main" %}
{% asset "mapviews/main" %}

<div
data-module = "navigablemap"
Expand Down
9 changes: 9 additions & 0 deletions ckanext/mapviews/theme/templates/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% ckan_extends %}

{%- block scripts %}

{{ super() }}
{% asset 'mapviews/main' %}

{% endblock -%}

0 comments on commit c1deddd

Please sign in to comment.