Aligned to DEV changes performed manually

This commit is contained in:
Francesco Mangiacrapa 2019-10-21 16:26:32 +02:00
parent 321cb49a22
commit 5052f17686
3 changed files with 23 additions and 10 deletions

View File

@ -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 <input> 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) {

View File

@ -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

View File

@ -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 <section> is the date-range picker widget in the sidebar. #}
<section class="module module-narrow module-shallow">
<h2 class="module-heading">
<i class="icon-medium icon-calendar"></i> {{ _('Publication Year') }}
<i class="icon-medium icon-calendar"></i> {{ _('Filter by time') }}
<a href="{{ h.remove_url_param(['ext_startdate', 'ext_enddate']) }}" class="action">{{ _('Clear') }}</a>
</h2>
<div class="module-content input-prepend input-daterange" data-module="daterange-query" id="datepicker">
<input type="text" class="input-mini" style="cursor:pointer;" readonly="" name="start" id="start" data-module="daterangepicker-module" />
<span class="add-on" style="border:none;background-color:#ffffff;">&nbsp;&nbsp;to&nbsp;&nbsp;</span>
<input type="text" class="input-mini" style="cursor:pointer;" readonly="" name="end" id="end" data-module="daterangepicker-module" />
<table id="daterange-table">
<tr>
<td><span class="add-on" style="border:none;background-color:#ffffff;">From&nbsp;&nbsp;</span></td>
<td><input type="text" class="input-mini" readonly="" name="start" id="start" data-module="daterangepicker-module" /></td>
</tr>
<tr>
<td><span class="add-on" style="border:none;background-color:#ffffff;">To&nbsp;&nbsp;</span></td>
<td><input type="text" class="input-mini" readonly="" name="end" id="end" data-module="daterangepicker-module" /></td>
</tr>
</table>
</div>
</section>