From 1527ebd95b7d090f5d9f889f1a4585d988ccf631 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Wed, 8 Apr 2015 10:44:18 -0400
Subject: [PATCH] Added missing sliders to EDS advanced search (Bootstrap
 theme).

---
 .../templates/search/advanced/eds.phtml       | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/themes/bootstrap3/templates/search/advanced/eds.phtml b/themes/bootstrap3/templates/search/advanced/eds.phtml
index c9313cdb787..6c953e9c71d 100644
--- a/themes/bootstrap3/templates/search/advanced/eds.phtml
+++ b/themes/bootstrap3/templates/search/advanced/eds.phtml
@@ -1,3 +1,4 @@
+<div class="clearfix"></div>
 <div class="row">
   <? if (!empty($this->expanderList)): ?>
     <fieldset class="col-sm-4">
@@ -73,4 +74,57 @@
       <? endforeach; ?>
     </fieldset>
   <? endif; ?>
+  <? if (isset($this->dateRangeLimit)): ?>
+    <fieldset class="col-sm-4">
+      <legend><?=$this->transEsc('adv_search_year')?></legend>
+      <input type="hidden" name="daterange[]" value="PublicationDate"/>
+      <div class="row">
+        <div class="col-sm-6">
+          <label for="PublicationDatefrom"><?=$this->transEsc('date_from')?>:</label>
+          <input type="text" name="PublicationDatefrom" id="PublicationDatefrom" value="<?=$this->escapeHtmlAttr($this->dateRangeLimit[0])?>" class="form-control"/>
+        </div>
+        <div class="col-sm-6">
+          <label for="PublicationDateto"><?=$this->transEsc('date_to')?>:</label>
+          <input type="text" name="PublicationDateto" id="PublicationDateto" value="<?=$this->escapeHtmlAttr($this->dateRangeLimit[1])?>" class="form-control"/>
+        </div>
+      </div>
+        <div class="slider-container">
+          <input type="text" id="PublicationDateSlider">
+        </div>
+        <?
+          $this->headScript()->appendFile('vendor/bootstrap-slider.js');
+          $min = !empty($current['values'][0]) ? min($current['values'][0], 1400) : 1400;
+          $future = date('Y', time()+31536000);
+          $max = !empty($current['values'][1]) ? max($future, $current['values'][1]) : $future;
+          $low  = !empty($current['values'][0]) ? $current['values'][0] : $min;
+          $high = !empty($current['values'][1]) ? $current['values'][1] : $max;
+          $min = intval($min);
+          $max = intval($max);
+          $low = intval($low);
+          $high = intval($high);
+          $init = !empty($current['values'][0]) ? 'fillTexts()' : '';
+          $script = <<<JS
+$(document).ready(function() {
+  var fillTexts = function() {
+    var v = PublicationDateSlider.getValue();
+    $('#PublicationDatefrom').val(v[0]);
+    $('#PublicationDateto').val(v[1]);
+  };
+  var PublicationDateSlider = $('#PublicationDateSlider')
+    .slider({
+       'min':{$min},
+       'max':{$max},
+       'handle':"square",
+       'tooltip':"hide",
+       'value':[{$low},{$high}]
+    })
+    .on('slide', fillTexts)
+    .data('slider');
+  {$init}
+});
+JS;
+      ?>
+      <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $script, 'SET'); ?>
+    </fieldset>
+  <? endif; ?>
 </div>
\ No newline at end of file
-- 
GitLab