diff --git a/ckanext/canada/assets/datatables/canada_datatables.css b/ckanext/canada/assets/datatables/canada_datatables.css new file mode 100644 index 000000000..0e7418643 --- /dev/null +++ b/ckanext/canada/assets/datatables/canada_datatables.css @@ -0,0 +1,28 @@ +/*#################### +## Datatables Views ## +######################*/ +div#dtprv_processing.dataTables_processing{ + z-index: 9999 !important; + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; + margin: 0 !important; + /* see static/js/canada_datatables for dynamic styles */ +} +div#dtprv_processing.dataTables_processing > div:last-child{ + position: absolute !important; + left: 50% !important; + transform: translate(-50%, -50%) !important; + pointer-events: none !important; + /* see static/js/canada_datatables for dynamic styles */ +} +div#dtprv_processing.dataTables_processing > div:last-child > div{ + background-color: #335075 !important; + pointer-events: none !important; +} +/*##################### +## END ## +## Datatables Views ## +## END ## +#######################*/ diff --git a/ckanext/canada/assets/datatables/canada_datatables.js b/ckanext/canada/assets/datatables/canada_datatables.js new file mode 100644 index 000000000..70591416d --- /dev/null +++ b/ckanext/canada/assets/datatables/canada_datatables.js @@ -0,0 +1,31 @@ +window.addEventListener('load', function(){ + + $(document).on('preInit.dt', function(_event, _settings){ + + $('body.dt-view').css('visibility', 'visible'); + $('#dtprv_processing').css({ + 'background-color': 'rgba(255, 255, 255, 1)', + 'display': 'block', + 'pointer-events': 'all', + }); + $('#dtprv_processing > div').css('top', '15%'); + + }); + + $(document).on('init.dt', function(){ + + $('#dtprv_processing').css({ + 'background-color': 'rgba(255, 255, 255, 0.65)', + 'pointer-events': 'none', + }); + $('#dtprv_processing > div').css('top', '50%'); + + }); + + $(document).on('processing.dt', function(_event, _settings, _processing){ + + $('#dtprv_processing').css('display', _processing ? 'block' : 'none'); + + }); + +}); diff --git a/ckanext/canada/assets/datatables/webassets.yml b/ckanext/canada/assets/datatables/webassets.yml new file mode 100644 index 000000000..e67a446c0 --- /dev/null +++ b/ckanext/canada/assets/datatables/webassets.yml @@ -0,0 +1,9 @@ +css: + contents: + - canada_datatables.css + output: canada_datatables/%(version)s_canada_datatables.css + +js: + contents: + - canada_datatables.js + output: canada_datatables/%(version)s_canada_datatables.js diff --git a/ckanext/canada/plugins.py b/ckanext/canada/plugins.py index fe3fdb60c..a13443432 100755 --- a/ckanext/canada/plugins.py +++ b/ckanext/canada/plugins.py @@ -448,6 +448,7 @@ def update_config(self, config): p.toolkit.add_template_directory(config, 'templates/public') p.toolkit.add_public_directory(config, 'public') p.toolkit.add_resource('public/static/js', 'js') + p.toolkit.add_resource('assets/datatables', 'canada_datatables') config['ckan.auth.public_user_details'] = False config['recombinant.definitions'] = """ ckanext.canada:tables/ati.yaml diff --git a/ckanext/canada/templates/public/datatables/datatables_view.html b/ckanext/canada/templates/public/datatables/datatables_view.html index 5b12fb32f..2ae3d89d7 100644 --- a/ckanext/canada/templates/public/datatables/datatables_view.html +++ b/ckanext/canada/templates/public/datatables/datatables_view.html @@ -1,5 +1,14 @@ {% ckan_extends %} +{% block page %} + {{ super() }} +