Author: sevein
Date: Sat Apr 28 21:37:54 2012
New Revision: 11539

Log:
Simplify search fields in advanced search, add button with dropdown to add 
criterias with predefined boolean option

Modified:
   branches/2.0/apps/qubit/modules/search/templates/_searchFields.php
   branches/2.0/js/dominion.js

Modified: branches/2.0/apps/qubit/modules/search/templates/_searchFields.php
==============================================================================
--- branches/2.0/apps/qubit/modules/search/templates/_searchFields.php  Sat Apr 
28 21:36:55 2012        (r11538)
+++ branches/2.0/apps/qubit/modules/search/templates/_searchFields.php  Sat Apr 
28 21:37:54 2012        (r11539)
@@ -1,16 +1,4 @@
-<div>
-  <ul>
-    <li><?php echo __('Find') ?></li>
-    <li>[ Archival descriptions ]</li>
-    <li><?php echo __('in') ?></li>
-    <li>
-      <select id="respository" data-placeholder="Any repository" 
class="chzn-select" tabindex="2">
-        <option value="" selected="selected"><?php echo __('Any repository') 
?></option>
-      </select>
-    </li>
-    <li><?php echo __('that match:') ?></li>
-  </ul>
-</div>
+<p class="headline"><?php echo __('Search for') ?>:</p>
 
 <?php $count = 0 ?>
 
@@ -96,9 +84,20 @@
 
 </div>
 
-<div id="actions">
+<div class="actions">
+  <div class="btn-group" style="display: inline-block">
+    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
+      <?php echo __('Add new criteria') ?>
+      <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-or"><?php echo __('Or') ?></a></li>
+      <li><a href="#" id="add-criteria-not"><?php echo __('Not') ?></a></li>
+    </ul>
+  </div>
+</div>
 
-  <button id="add-criteria" class="gray btn-large"><?php echo __('Add search 
filter') ?></button>
+<div class="actions">
   <button type="submit" class="gray btn-large"><?php echo __('Search') 
?></button>
-
 </div>

Modified: branches/2.0/js/dominion.js
==============================================================================
--- branches/2.0/js/dominion.js Sat Apr 28 21:36:55 2012        (r11538)
+++ branches/2.0/js/dominion.js Sat Apr 28 21:37:54 2012        (r11539)
@@ -444,8 +444,6 @@
     {
       this.$element = $(element);
 
-      this.$element.find('.criteria:first .boolean').hide();
-
       this.listen();
     };
 
@@ -455,27 +453,43 @@
 
     listen: function()
     {
+      this.$criteria = this.$element.find('.criteria');
+
+      // Hide first boolean
+      this.$criteria.first().find('.boolean').hide();
+
+      // Hide last criteria if more than once
+      if (1 < this.$criteria.length)
+      {
+        this.$criteria.last().hide();
+      }
+
       this.$element.on('click', $.proxy(this.click, this));
     },
 
     click: function (event)
     {
       var $target = $(event.target);
+      var id = $target.attr('id');
 
-      switch ($target.attr('id'))
+      switch (id)
       {
-        case 'add-criteria':
+        case 'add-criteria-add':
+        case 'add-criteria-or':
+        case 'add-criteria-not':
           event.preventDefault();
-          this.addCriteria();
+          this.addCriteria(id.replace('add-criteria-', ''));
           break;
       }
     },
 
-    addCriteria: function ()
+    addCriteria: function (option)
     {
       this
         .cloneLastCriteria()
         .insertAfter(this.getLastCriteria())
+        .show()
+        .find('.boolean select').val(option).end()
         .find('.criterion input').first().focus();
     },
 

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

Reply via email to