From 5052f17686374d42b8d8ebc3caca5624ea51b0ee Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Mon, 21 Oct 2019 16:26:32 +0200 Subject: [PATCH] Aligned to DEV changes performed manually --- .../fanstatic/daterangepicker-module.js | 11 ++++++----- ckanext/datesearch/plugin.py | 6 +++++- ckanext/datesearch/templates/package/search.html | 16 ++++++++++++---- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ckanext/datesearch/fanstatic/daterangepicker-module.js b/ckanext/datesearch/fanstatic/daterangepicker-module.js index b9553f5..b1c6fdf 100644 --- a/ckanext/datesearch/fanstatic/daterangepicker-module.js +++ b/ckanext/datesearch/fanstatic/daterangepicker-module.js @@ -14,11 +14,11 @@ this.ckan.module('daterangepicker-module', function ($, _) { // Populate the datepicker and hidden fields if (param_start) { - $('#datepicker #start').val(moment.utc(param_start).year()); + $('#datepicker #start').val(moment.utc(param_start).format()); $('#ext_startdate').val(param_start); } if (param_end) { - $('#datepicker #end').val(moment.utc(param_end).year()); + $('#datepicker #end').val(moment.utc(param_end).format()); $('#ext_enddate').val(param_end); } @@ -37,9 +37,10 @@ this.ckan.module('daterangepicker-module', function ($, _) { // Add a date-range picker widget to the with id #daterange $('#datepicker.input-daterange').datepicker({ - format: "yyyy", - startView: 3, - minViewMode: 2, + format: "yyyy-mm-dd", + startView: 0, //show days + minViewMode: 0, + clearBtn: true, keyboardNavigation: false, autoclose: true }).on('changeDate', function (ev) { diff --git a/ckanext/datesearch/plugin.py b/ckanext/datesearch/plugin.py index caaa484..b712d8b 100644 --- a/ckanext/datesearch/plugin.py +++ b/ckanext/datesearch/plugin.py @@ -34,7 +34,11 @@ class DateSearchPlugin(plugins.SingletonPlugin): # Add a date-range query with the selected start and/or end dates into the Solr facet queries. fq = search_params.get('fq', '') - fq = '{fq} +extras_PublicationTimestamp:[{sd} TO {ed}]'.format(fq=fq, sd=start_date, ed=end_date) + #fq = '{fq} +extras_PublicationTimestamp:[{sd} TO {ed}]'.format(fq=fq, sd=start_date, ed=end_date) + + # Added by Francesco see: https://github.com/geosolutions-it/ckanext-datesearch + fq = '{fq} +metadata_modified:[{start_date} TO {end_date}]'.format(fq=fq, start_date=start_date, end_date=end_date) + log.info('fq is: '+str(fq)) search_params['fq'] = fq diff --git a/ckanext/datesearch/templates/package/search.html b/ckanext/datesearch/templates/package/search.html index 3107342..7564269 100644 --- a/ckanext/datesearch/templates/package/search.html +++ b/ckanext/datesearch/templates/package/search.html @@ -3,19 +3,27 @@ {% block secondary_content %} {% resource 'ckanext-datesearch/moment.js' %} {% resource 'ckanext-datesearch/datepicker.css' %} + {% resource 'ckanext-datesearch/daterange.css' %} {% resource 'ckanext-datesearch/bootstrap-datepicker.js' %} {% resource 'ckanext-datesearch/daterangepicker-module.js' %} {# This
is the date-range picker widget in the sidebar. #}

- {{ _('Publication Year') }} + {{ _('Filter by time') }} {{ _('Clear') }}

- -   to   - + + + + + + + + + +
From  
To