whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [1/1] Commit 40bba6a: experiment with a sortable table
Date Tue, 16 Feb 2016 20:37:58 GMT
Commit 40bba6ab1f6e9e5df37284a37773ccf2e9c69f32:
    experiment with a sortable table


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
www/roster/main.rb                                           | + 
www/roster/public/stylesheets/app.css                        | +++ 
www/roster/views/members.html.rb                             | ++++++ -----
------------------------------------------------------------
46 changes: 28 additions, 18 deletions.
------------------------------------------------------------


diff --git a/www/roster/main.rb b/www/roster/main.rb
index 5324d75..21747b1 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -10,6 +10,7 @@
 require 'wunderbar/bootstrap/theme'
 require 'wunderbar/react'
 require 'wunderbar/underscore'
+require 'wunderbar/jquery/stupidtable'
 require 'ruby2js/filter/functions'
 require 'ruby2js/filter/require'
 
diff --git a/www/roster/public/stylesheets/app.css b/www/roster/public/stylesheets/app.css
index ac6eff6..28f3e93 100644
--- a/www/roster/public/stylesheets/app.css
+++ b/www/roster/public/stylesheets/app.css
@@ -18,6 +18,9 @@ table.wide {color: #000; border-collapse: separate; font-size: 100%}
 .chair {color: green; font-weight:bold} 
 .member {font-weight: bold}
 
+thead:hover th.sorting-desc:after {content: ' \25bc'}
+thead:hover th.sorting-asc:after {content: ' \25b2'}
+
 td .hint {display: none}
 td:hover .hint {
   position: absolute; display: block; background-color: #FFF;
diff --git a/www/roster/views/members.html.rb b/www/roster/views/members.html.rb
index efddc20..295cb23 100644
--- a/www/roster/views/members.html.rb
+++ b/www/roster/views/members.html.rb
@@ -60,33 +60,39 @@
   _table.table.table_hover do
     _thead do
       _tr do
-        _th 'id'
-        _th 'public name'
-        _th 'status'
+        _th 'id', data_sort: 'string'
+        _th.sorting_asc 'public name', data_sort: 'string'
+        _th 'status', data_sort: 'string'
       end
     end
 
-    members.sort_by {|id, info| info[:name]}.each do |id, info|
-      _tr_ do
-        _td! do
-          if ldap.include? ASF::Person.find(id)
-            _b {_a id, href: "committer/#{id}"}
-          else
-            _a id, href: "committer/#{id}"
-            
-            info[:issue] ||= 'Not in LDAP' if not info['status']
+    _tbody do
+      members.sort_by {|id, info| info[:name]}.each do |id, info|
+        _tr_ do
+          _td! do
+            if ldap.include? ASF::Person.find(id)
+              _b {_a id, href: "committer/#{id}"}
+            else
+              _a id, href: "committer/#{id}"
+              
+              info[:issue] ||= 'Not in LDAP' if not info['status']
+            end
           end
-        end
 
-        _td info[:name]
+          _td info[:name]
 
-        if info[:issue]
-          _td.issue info[:issue]
-        elsif
-          _td info['status']
+          if info[:issue]
+            _td.issue info[:issue]
+          elsif
+            _td info['status']
+          end
         end
       end
     end
   end
 
+
+  _script %{
+    $(".table").stupidtable();
+  }
 end

Mime
View raw message