myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2480] branches/discovery: added a lock filter to


From: noreply
Subject: [myexperiment-hackers] [2480] branches/discovery: added a lock filter to keep certain filters locked to a given value
Date: Wed, 21 Jul 2010 11:32:07 -0400 (EDT)

Revision
2480
Author
dgc
Date
2010-07-21 11:32:07 -0400 (Wed, 21 Jul 2010)

Log Message

added a lock filter to keep certain filters locked to a given value

Modified Paths

Diff

Modified: branches/discovery/app/controllers/application.rb (2479 => 2480)


--- branches/discovery/app/controllers/application.rb	2010-07-19 15:35:15 UTC (rev 2479)
+++ branches/discovery/app/controllers/application.rb	2010-07-21 15:32:07 UTC (rev 2480)
@@ -618,6 +618,11 @@
             label = visible_name(label) if filter[:visible_name]
             label = label.capitalize    if filter[:capitalize]
 
+            if params[:filter_query]
+              label.sub!(Regexp.new("(#{params[:filter_query]})", Regexp::IGNORECASE), '<b>\1</b>')
+              puts "new label = #{label}"
+            end
+
             {
               :object   => object,
               :value    => value,
@@ -768,6 +773,10 @@
       cancel_filter_query_url = build_url(params, opts, [:filter, :order, :advanced])
     end
 
+    if opts[:filter_params].length > 0
+      reset_filters_url = build_url(params, opts, [:order, :advanced])
+    end
+
     # remove filters that do not help in narrowing down the result set
 
     filters = filters.select do |filter|
@@ -789,6 +798,7 @@
     {
       :results                 => results,
       :filters                 => filters,
+      :reset_filters_url       => reset_filters_url,
       :cancel_filter_query_url => cancel_filter_query_url,
       :filter_query_url        => build_url(params, opts, [:filter]),
       :summary                 => summary

Modified: branches/discovery/app/views/content/_index.rhtml (2479 => 2480)


--- branches/discovery/app/views/content/_index.rhtml	2010-07-19 15:35:15 UTC (rev 2479)
+++ branches/discovery/app/views/content/_index.rhtml	2010-07-21 15:32:07 UTC (rev 2480)
@@ -1,26 +1,24 @@
 <div class="pivot">
   <div class="left">
+    <% if @pivot[:reset_filters_url] %>
+      <div class="reset_filters"><%= link_to("Reset filters", @pivot[:reset_filters_url]) -%></div>
+    <% end %>
     <div class="search_filters">
       <form action="" url_for(request.query_parameters) -%>" method="GET">
         <div>Search filters:</div>
         <div class="filter_search_box">
-          <input name="filter_query" value="<%= params[:filter_query] -%>" />
+          <input class="query" name="filter_query" value="<%= params[:filter_query] -%>" />
           <% @pivot[:filter_query_url].each do |key, value| %>
             <input name="<%= key -%>" type="hidden" value="<%= value.sub('"', '\\"') -%>" />
           <% end %>
           <% if @pivot[:cancel_filter_query_url] %>
-            <img src="" />
+            <%= link_to('<img src="" />',
+                @pivot[:cancel_filter_query_url]) -%>
           <% else %>
-            <img src="" />
+            <input class="submit" type="image" src="" name="submit" />
           <% end %>
         </div>
       </form>
-
-      <div>
-        <% if @pivot[:cancel_filter_query_url] %>
-          <%= link_to("Cancel filter query", @pivot[:cancel_filter_query_url]) -%>
-        <% end %>
-      </div>
     </div>
     <div class="filters">
       <% @pivot[:filters].each do |filter| %>
@@ -34,7 +32,7 @@
             <% end %>
           </div>
         </div>
-      <% end %>
+        <% end %>
       <div class="advanced_switch">
         <% if params[:advanced] %>
           <%= link_to("Switch to simple mode", request.query_parameters.merge( { "advanced" => nil } )) -%>

Modified: branches/discovery/public/stylesheets/styles.css (2479 => 2480)


--- branches/discovery/public/stylesheets/styles.css	2010-07-19 15:35:15 UTC (rev 2479)
+++ branches/discovery/public/stylesheets/styles.css	2010-07-21 15:32:07 UTC (rev 2480)
@@ -2161,12 +2161,18 @@
   border: 1px solid gray;
 }
 
-.pivot .filter_search_box INPUT {
+.pivot .filter_search_box INPUT.query {
   width: 127px;
   border: none;
   outline: none;
 }
 
+.pivot .filter_search_box INPUT.submit {
+  vertical-align: middle;
+  position: relative;
+  top: -1px;
+}
+
 .pivot .filter_search_box IMG {
   vertical-align: middle;
   position: relative;

reply via email to

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