allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [14/38] git commit: [#4019] ticket:514 added dropdown UI
Date Wed, 30 Apr 2014 18:15:46 GMT
[#4019] ticket:514 added dropdown UI


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2c8c3c51
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2c8c3c51
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2c8c3c51

Branch: refs/heads/master
Commit: 2c8c3c515a421fb9ea0ce8bbd99a0a811b98523b
Parents: a8a5ddc
Author: Yaroslav Sokolovsky <yaroslav.sokolovsky@gmail.com>
Authored: Wed Jan 15 18:28:56 2014 +0200
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Apr 30 15:55:11 2014 +0000

----------------------------------------------------------------------
 .../tracker_widgets/ticket_search_results.html  | 34 ++++++------
 .../widgets/resources/css/ticket-list.css       | 21 +++++++-
 .../widgets/resources/js/ticket-list.js         | 54 ++++++++++++++++----
 3 files changed, 78 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/2c8c3c51/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
b/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
index e7827cf..29df818 100644
--- a/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
+++ b/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
@@ -29,36 +29,32 @@
               {% if col['name'] == 'ticket_num' %}
                 #
               {% else %}
-                {{col['label']}}
+                {{col['label']}}<span class="filter-ico">&#x25BE;</span>
               {% endif %}
-            </th>
-          {% endfor %}
-          <th style="width:15px">
-            <a href="#" id="col_menu" title="Select Columns"><b data-icon="{{g.icons['admin'].char}}"
class="ico {{g.icons['admin'].css}}"></b></a>
-          </th>
-        </tr>
-
-        {% for col in columns if col['active'] %}
-          <tr class="ticket-filter" data-column="{{col['name']}}">
-            <th colspan="{{columns|length + 1}}">
-              <p><a data-sort="{{col['sort_name']}}" title="{{col['label']}}">Toggle
sort by {{col['label']}}</a></p>
+              <ul class="ticket-filter" data-column="{{col['name']}}" style="display:
none; position: absolute;">
+              <li><a data-sort-asc="{{col['sort_name']}}" title="{{col['label']}}">Sort
A -> Z</a></li>
+              <li><a data-sort-desc="{{col['sort_name']}}" title="{{col['label']}}">Sort
Z -> A</a></li>
               {% if col['name'] in widget.filters.keys() %}
-                <p>Filter by {{col['label']}}</p>
-                <p>
+                <li>Filter by {{col['label']}}</li>
+                <li>
                   <select name="filter-{{col['name']}}" data-label="{{col['label']}}"
multiple="multiple">
                     {% for o in widget.filters[col['name']] %}
                       <option value="{{o['value']}}"{% if o['selected'] %} selected="selected"{%
endif %}>{{o['label']}}</label>
                     {% endfor %}
                   </select>
+                </li>
+                <li class="btns">
                   <input type="button" value="Ok" class="apply-filters">
                   <a href="#" class="close btn link">Cancel</a>
-                </p>
-                <div style="clear:both;"></div>
+                </li>
               {% endif %}
+               </ul>
             </th>
-          </tr>
-        {% endfor %}
-
+          {% endfor %}
+          <th style="width:15px">
+            <a href="#" id="col_menu" title="Select Columns"><b data-icon="{{g.icons['admin'].char}}"
class="ico {{g.icons['admin'].css}}"></b></a>
+          </th>
+        </tr>
       </thead>
       <tbody>
         {% for t in tickets %}

http://git-wip-us.apache.org/repos/asf/allura/blob/2c8c3c51/ForgeTracker/forgetracker/widgets/resources/css/ticket-list.css
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/resources/css/ticket-list.css b/ForgeTracker/forgetracker/widgets/resources/css/ticket-list.css
index 0fcf370..3aa4d23 100644
--- a/ForgeTracker/forgetracker/widgets/resources/css/ticket-list.css
+++ b/ForgeTracker/forgetracker/widgets/resources/css/ticket-list.css
@@ -22,8 +22,25 @@
     padding: 0;
     list-style-type: none;
 }
-
-.ticket-filter { display: none; }
+.filter-ico {
+    font-size: 16px;
+}
+.ticket-filter {
+    display: none;
+    background: #E5E5E5;
+    margin: 6px 0;
+    padding: 0;
+    height: 65px;
+    border-radius: 4px;
+}
+.ticket-filter li {
+    list-style:none;
+    margin: 10px 5px 0 5px;
+}
+.ticket-filter .btns {
+    position: absolute;
+    bottom: 0px;
+}
 .ticket-filter a[data-sort] { cursor: pointer; }
 .ticket-list th[data-filter-toggle] { cursor: pointer; }
 .ticket-list th[data-filter-toggle]:hover { text-decoration: underline; }

http://git-wip-us.apache.org/repos/asf/allura/blob/2c8c3c51/ForgeTracker/forgetracker/widgets/resources/js/ticket-list.js
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/resources/js/ticket-list.js b/ForgeTracker/forgetracker/widgets/resources/js/ticket-list.js
index 32aee5f..838547d 100644
--- a/ForgeTracker/forgetracker/widgets/resources/js/ticket-list.js
+++ b/ForgeTracker/forgetracker/widgets/resources/js/ticket-list.js
@@ -18,6 +18,20 @@
 */
 
 (function(){
+    function ico_active() {
+    $('.ticket-filter').each(function() {
+          if ($(this).find('select option').attr('selected')) {
+              $(this).siblings('span').css('color', 'green');
+          } else {
+              $(this).siblings('span').css('color', '');
+          }
+    });
+    }
+
+    $( document ).ready(function() {
+        ico_active();
+    });
+
     $('table.ticket-list td a').each(function(){
       var $this = $(this);
       $this.html($this.html().replace(/\//gi,'/&#8203;'));
@@ -41,13 +55,17 @@
         window.location = location;
     }
 
-    $('.ticket-filter a[data-sort]').click(function(){
-        var old_sort = sort.split(' '),
-            new_dir = {'asc':'desc', 'desc':'asc'}[old_sort[1]],
-            new_sort = $(this).attr('data-sort');
-        if ( new_sort !== old_sort[0] ){
-            new_dir = 'asc';
-        }
+    $('.ticket-filter a[data-sort-asc]').click(function(){
+        var new_sort = $(this).attr('data-sort-asc'),
+        new_dir = 'asc';
+        sort = new_sort + ' ' + new_dir;
+        page = 0;
+        requery();
+    });
+
+    $('.ticket-filter a[data-sort-desc]').click(function(){
+        var new_sort = $(this).attr('data-sort-desc'),
+        new_dir = 'desc';
         sort = new_sort + ' ' + new_dir;
         page = 0;
         requery();
@@ -69,10 +87,25 @@
       var column = $(this).attr('data-filter-toggle');
       var filter_selector = '.ticket-filter[data-column="' + column + '"]';
       var filter = $(this).parents('.ticket-list').find(filter_selector);
+
+      $('.ticket-filter').each(function() {
+           if ($(this).attr('data-column') != $(this).parents('.ticket-list').find(filter_selector).attr('data-column'))
{
+               $(this).hide();
+           }
+      });
+      if ($(this).find('select').length == 0) {
+          $('.ticket-filter').css('height', '65px');
+      } else {
+          $('.ticket-filter').css('height', '370px');
+      }
+
       var visible = filter.is(':visible');
-      $('.ticket-filter').hide();
+      $(this).find('select').multiselect("close");
+      filter.hide();
+
       if (!visible) {
         filter.show();
+        $(this).find('select').multiselect("open");
       }
     });
 
@@ -82,8 +115,8 @@
         }
     });
     $('.ticket-filter .close').click(function(e) {
-      e.preventDefault();
-      $('.ticket-filter').hide();
+       e.preventDefault();
+       $('.ticket-filter').hide();
     });
     $('.ticket-filter .apply-filters').click(function() {
       filter = {};
@@ -95,6 +128,7 @@
         }
       });
       requery();
+      ico_active();
     });
 
     function select_active_filter() {


Mime
View raw message