[Xfce4-commits] <moka:master> Cycle css helper.

Nick Schermer noreply at xfce.org
Sun Nov 20 14:30:39 CET 2011


Updating branch refs/heads/master
         to 11d800b5691bd85a1d6b4f6a5c9ac908a75d4c1c (commit)
       from f6600ffafb815f6a9bef1334ddfda95e9d38c385 (commit)

commit 11d800b5691bd85a1d6b4f6a5c9ac908a75d4c1c
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Oct 15 16:46:01 2011 +0200

    Cycle css helper.

 lib/helpers/general.rb      |    5 +++++
 lib/views/project_list.haml |    2 +-
 lib/views/stylesheet.sass   |    3 +++
 3 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/lib/helpers/general.rb b/lib/helpers/general.rb
index b56f2ee..6bf867c 100755
--- a/lib/helpers/general.rb
+++ b/lib/helpers/general.rb
@@ -66,6 +66,11 @@ module Moka
           end
           return false
         end
+
+        def cycle
+          %w{even odd}[@_cycle = ((@_cycle || -1) + 1) % 2]
+        end
+
       end
     end
   end
diff --git a/lib/views/project_list.haml b/lib/views/project_list.haml
index a914bf7..c085e3b 100644
--- a/lib/views/project_list.haml
+++ b/lib/views/project_list.haml
@@ -6,7 +6,7 @@
     %th Description
     %th Maintainers
   - for project in Project.all.sort
-    %tr
+    %tr{:class => cycle}
       %td
         %a{:href => "/project/#{project.name}"} #{project.name}
       %td
diff --git a/lib/views/stylesheet.sass b/lib/views/stylesheet.sass
index 2d7920a..ebe5f5d 100755
--- a/lib/views/stylesheet.sass
+++ b/lib/views/stylesheet.sass
@@ -80,6 +80,9 @@ table
       
   tr.admin
     font-weight: bold
+
+  tr.odd
+    background-color: #eee
   
   td
     padding: 0.25em


More information about the Xfce4-commits mailing list