Author: sevein
Date: Wed Jun 6 17:21:09 2012
New Revision: 11743
Log:
Add endDate facet, create form to submit data
Modified:
branches/2.0/apps/qubit/modules/search/actions/indexAction.class.php
branches/2.0/apps/qubit/modules/search/templates/_searchFields.php
branches/2.0/apps/qubit/modules/search/templates/_searchResults.php
branches/2.0/apps/qubit/modules/search/templates/advancedSuccess.php
branches/2.0/apps/qubit/modules/search/templates/indexSuccess.php
branches/2.0/js/dominion.js
Modified: branches/2.0/apps/qubit/modules/search/actions/indexAction.class.php
==============================================================================
--- branches/2.0/apps/qubit/modules/search/actions/indexAction.class.php
Wed Jun 6 13:49:03 2012 (r11742)
+++ branches/2.0/apps/qubit/modules/search/actions/indexAction.class.php
Wed Jun 6 17:21:09 2012 (r11743)
@@ -104,6 +104,11 @@
$facet->addRange(null, null);
$query->addFacet($facet);
+ $facet = new Elastica_Facet_Range('dates.endDate');
+ $facet->setField('dates.endDate');
+ $facet->addRange(null, null);
+ $query->addFacet($facet);
+
return $query;
}
Modified: branches/2.0/apps/qubit/modules/search/templates/_searchFields.php
==============================================================================
--- branches/2.0/apps/qubit/modules/search/templates/_searchFields.php Wed Jun
6 13:49:03 2012 (r11742)
+++ branches/2.0/apps/qubit/modules/search/templates/_searchFields.php Wed Jun
6 17:21:09 2012 (r11743)
@@ -99,7 +99,7 @@
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
- <li><a href="#" id="add-criteria-add"><?php echo __('Add') ?></a></li>
+ <li><a href="#" id="add-criteria-and"><?php echo __('And') ?></a></li>
<li><a href="#" id="add-criteria-or"><?php echo __('Or') ?></a></li>
<li><a href="#" id="add-criteria-not"><?php echo __('Not') ?></a></li>
</ul>
Modified: branches/2.0/apps/qubit/modules/search/templates/_searchResults.php
==============================================================================
--- branches/2.0/apps/qubit/modules/search/templates/_searchResults.php Wed Jun
6 13:49:03 2012 (r11742)
+++ branches/2.0/apps/qubit/modules/search/templates/_searchResults.php Wed Jun
6 17:21:09 2012 (r11743)
@@ -92,6 +92,30 @@
<?php endif; ?>
+ <div class="section">
+
+ <h2 class="visible-phone widebtn btn-huge" data-toggle="collapse"
data-target="#dates"><?php echo __('Creation date') ?></h2>
+ <h2 class="hidden-phone"><?php echo __('Creation date') ?></h2>
+
+ <div class="scrollable dates" id="dates">
+
+ <form method="get" action="<?php echo
url_for($sf_request->getParameterHolder()->getAll()) ?>">
+ <input type="hidden" name="query" value="<?php echo
esc_entities($sf_request->query) ?>" />
+ <input type="hidden" name="realm" value="<?php echo
esc_entities($sf_request->realm) ?>" />
+ <input type="text" value="<?php echo
$pager->facets['dates_startDate']['min'] ?>" name="creationDate_from" />
+ <span>-</span>
+ <?php if (isset($pager->facets['dates_endDate'])): ?>
+ <input type="text" value="<?php echo
$pager->facets['dates_endDate']['max'] ?>" name="creationDate_to" />
+ <?php else: ?>
+ <input type="text" value="<?php echo
$pager->facets['dates_startDate']['max'] ?>" name="creationDate_to" />
+ <?php endif; ?>
+
+ </form>
+
+ </div>
+
+ </div>
+
</div>
<div class="span9" id="content">
@@ -127,3 +151,4 @@
</div>
</div>
+
Modified: branches/2.0/apps/qubit/modules/search/templates/advancedSuccess.php
==============================================================================
--- branches/2.0/apps/qubit/modules/search/templates/advancedSuccess.php
Wed Jun 6 13:49:03 2012 (r11742)
+++ branches/2.0/apps/qubit/modules/search/templates/advancedSuccess.php
Wed Jun 6 17:21:09 2012 (r11743)
@@ -35,7 +35,7 @@
</div>
- <?php if (isset($error)): ?>
+ <?php if (false && isset($error)): ?>
<div class="error">
<ul>
@@ -45,7 +45,7 @@
<?php endif; ?>
- <?php if (isset($pager)): ?>
+ <?php if (isset($pager) && $pager->hasResults()): ?>
<?php echo get_partial('search/searchResults', array('pager' => $pager,
'filters' => $filters)) ?>
Modified: branches/2.0/apps/qubit/modules/search/templates/indexSuccess.php
==============================================================================
--- branches/2.0/apps/qubit/modules/search/templates/indexSuccess.php Wed Jun
6 13:49:03 2012 (r11742)
+++ branches/2.0/apps/qubit/modules/search/templates/indexSuccess.php Wed Jun
6 17:21:09 2012 (r11743)
@@ -1 +1,5 @@
-<?php echo get_partial('search/searchResults', array('pager' => $pager,
'filters' => $filters)) ?>
+<?php if (isset($pager) && $pager->hasResults()): ?>
+
+ <?php echo get_partial('search/searchResults', array('pager' => $pager,
'filters' => $filters)) ?>
+
+<?php endif; ?>
Modified: branches/2.0/js/dominion.js
==============================================================================
--- branches/2.0/js/dominion.js Wed Jun 6 13:49:03 2012 (r11742)
+++ branches/2.0/js/dominion.js Wed Jun 6 17:21:09 2012 (r11743)
@@ -476,11 +476,18 @@
this.$criteria.last().hide();
}
+ // Hide filters if not being used
if (!this.$element.find('#toggle-filters').hasClass('active'))
{
this.$filters.hide();
}
+ var $results = $('#search-results');
+ if ($results.length)
+ {
+ window.scroll(0, $results.offset().top - $('#header').height());
+ }
+
// Bind events
this.$element.on('click', $.proxy(this.click, this));
},
@@ -492,7 +499,7 @@
switch (id)
{
- case 'add-criteria-add':
+ case 'add-criteria-and':
case 'add-criteria-or':
case 'add-criteria-not':
event.preventDefault();
@@ -562,6 +569,20 @@
{
new AdvancedSearch($advancedSearch.get(0));
}
+
+ var $body = $('body.search');
+ if ($body.hasClass('index') || $body.hasClass('advanced'))
+ {
+ $body.find('[name^=creationDate]').on('keyup', function (e)
+ {
+ // Enter
+ if (e.keyCode == 13)
+ {
+ e.preventDefault();
+ $(e.target).closest('form').submit();
+ }
+ });
+ }
});
})(window.jQuery);
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.