myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2484] branches/discovery: added checkboxes to th


From: noreply
Subject: [myexperiment-hackers] [2484] branches/discovery: added checkboxes to the filters
Date: Tue, 27 Jul 2010 09:52:46 -0400 (EDT)

Revision
2484
Author
dgc
Date
2010-07-27 09:52:46 -0400 (Tue, 27 Jul 2010)

Log Message

added checkboxes to the filters

Modified Paths

Diff

Modified: branches/discovery/app/controllers/application.rb (2483 => 2484)


--- branches/discovery/app/controllers/application.rb	2010-07-27 13:20:46 UTC (rev 2483)
+++ branches/discovery/app/controllers/application.rb	2010-07-27 13:52:46 UTC (rev 2484)
@@ -605,15 +605,28 @@
             selected = current.include?(value)
 
             if selected
-              new_selection = (current - [value]).uniq.join(',')
+              if current.length == 1
+                label_selection = ""
+              else
+                label_selection = value
+              end
             else
-              new_selection = (current + [value]).uniq.join(',')
+              label_selection = value
             end
 
-            new_selection = nil if new_selection.empty?
+            if selected
+              checkbox_selection = (current - [value]).uniq.join(',')
+            else
+              checkbox_selection = (current + [value]).uniq.join(',')
+            end
 
-            target_uri = build_url(params, opts, [:filter, :order, :filter_query, :advanced], filter[:query_option] => new_selection, "page" => nil)
+            label_selection    = nil if label_selection.empty?
+            checkbox_selection = nil if checkbox_selection.empty?
 
+            label_uri = build_url(params, opts, [:filter, :order, :filter_query, :advanced], filter[:query_option] => label_selection, "page" => nil)
+
+            checkbox_uri = build_url(params, opts, [:filter, :order, :filter_query, :advanced], filter[:query_option] => checkbox_selection, "page" => nil)
+
             label = object.filter_label
             label = visible_name(label) if filter[:visible_name]
             label = label.capitalize    if filter[:capitalize]
@@ -624,12 +637,13 @@
             end
 
             {
-              :object   => object,
-              :value    => value,
-              :label    => label,
-              :count    => object.filter_count,
-              :uri      => target_uri,
-              :selected => selected
+              :object       => object,
+              :value        => value,
+              :label        => label,
+              :count        => object.filter_count,
+              :checkbox_uri => checkbox_uri,
+              :label_uri    => label_uri,
+              :selected     => selected
             }
           end
 

Modified: branches/discovery/app/views/content/_index.rhtml (2483 => 2484)


--- branches/discovery/app/views/content/_index.rhtml	2010-07-27 13:20:46 UTC (rev 2483)
+++ branches/discovery/app/views/content/_index.rhtml	2010-07-27 13:52:46 UTC (rev 2484)
@@ -27,7 +27,8 @@
           <div class="options">
             <% filter[:objects].each do |object| %>
               <div<%= object[:selected] ? ' class="selected"' : '' -%>>
-                <%= link_to("<div class='count'>#{object[:count]}</div><div class='label'><span class='truncate'>#{object[:label]}</span></div>", object[:uri]) -%>
+                <input class='checkbox' type='checkbox'  <% if object[:selected] %> checked='checked' <% end %> />
+                <%= link_to("<div class='count'>#{object[:count]}</div> <div class='label'><span class='truncate'>#{object[:label]}</span></div>", object[:label_uri]) -%>
               </div>
             <% end %>
           </div>

Modified: branches/discovery/public/stylesheets/styles.css (2483 => 2484)


--- branches/discovery/public/stylesheets/styles.css	2010-07-27 13:20:46 UTC (rev 2483)
+++ branches/discovery/public/stylesheets/styles.css	2010-07-27 13:52:46 UTC (rev 2484)
@@ -2094,14 +2094,6 @@
   background: #d0d0f0;
 }
 
-.pivot .options > DIV.selected {
-  background: #ffe0c0;
-}
- 
-.pivot .options > DIV.selected:hover {
-  background: #dfc0a0;
-}
- 
 .pivot .options > DIV:first-child {
   border-top-left-radius: 6px;
   border-top-right-radius: 6px;
@@ -2116,9 +2108,16 @@
   -moz-border-radius-bottomright: 6px;
 }
 
+.pivot .checkbox {
+  display: inline;
+  padding-top: 0;
+  padding-bottom: 0;
+}
+
 .pivot .label {
-  width: 110px;
+  width: 92px;
   overflow: hidden;
+  display: inline-block;
 }
 
 .pivot .count {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]