From 97036fabd85d2a6f80a2d6b3bf48414a03dcb825 Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Sun, 4 Dec 2022 18:25:34 +0200 Subject: [PATCH] use `theme` instead of `main_css` in CKAN >=2.9.6 --- .../templates/geoview/snippets/geojson_asset.html | 11 ++++++++--- .../geoview/templates/geoview/snippets/shp_asset.html | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ckanext/geoview/templates/geoview/snippets/geojson_asset.html b/ckanext/geoview/templates/geoview/snippets/geojson_asset.html index 84afd901..6c412a70 100644 --- a/ckanext/geoview/templates/geoview/snippets/geojson_asset.html +++ b/ckanext/geoview/templates/geoview/snippets/geojson_asset.html @@ -1,6 +1,11 @@ -{% set main_css = h.get_rtl_css() if h.is_rtl_language() else g.main_css %} -{# strip '/base/' prefix and '.css' suffix #} -{% asset main_css[6:-4] %} +{% if h.ckan_version().split('.') | map('int')| list >= [2, 9, 6] %} + {% set theme = h.get_rtl_theme() if h.is_rtl_language() else g.theme %} + {% asset theme %} +{% else %} + {% set main_css = h.get_rtl_css() if h.is_rtl_language() else g.main_css %} + {# strip '/base/' prefix and '.css' suffix #} + {% asset main_css[6:-4] %} +{% endif %} {% asset 'ckanext-geoview/geojson_js' %} {% asset 'ckanext-geoview/geojson_css' %} diff --git a/ckanext/geoview/templates/geoview/snippets/shp_asset.html b/ckanext/geoview/templates/geoview/snippets/shp_asset.html index ed452bec..71e932db 100644 --- a/ckanext/geoview/templates/geoview/snippets/shp_asset.html +++ b/ckanext/geoview/templates/geoview/snippets/shp_asset.html @@ -1,6 +1,11 @@ -{% set main_css = h.get_rtl_css() if h.is_rtl_language() else g.main_css %} -{# strip '/base/' prefix and '.css' suffix #} -{% asset main_css[6:-4] %} +{% if h.ckan_version().split('.') | map('int')| list >= [2, 9, 6] %} + {% set theme = h.get_rtl_theme() if h.is_rtl_language() else g.theme %} + {% asset theme %} +{% else %} + {% set main_css = h.get_rtl_css() if h.is_rtl_language() else g.main_css %} + {# strip '/base/' prefix and '.css' suffix #} + {% asset main_css[6:-4] %} +{% endif %} {% asset 'ckanext-geoview/shp_js' %} {% asset 'ckanext-geoview/shp_css' %}