myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2466] branches/discovery: style change, number o


From: noreply
Subject: [myexperiment-hackers] [2466] branches/discovery: style change, number of results per page
Date: Sun, 11 Jul 2010 01:20:25 -0400 (EDT)

Revision
2466
Author
dgc
Date
2010-07-11 01:20:25 -0400 (Sun, 11 Jul 2010)

Log Message

style change, number of results per page

Modified Paths

Diff

Modified: branches/discovery/app/controllers/application.rb (2465 => 2466)


--- branches/discovery/app/controllers/application.rb	2010-07-09 17:04:16 UTC (rev 2465)
+++ branches/discovery/app/controllers/application.rb	2010-07-11 05:20:25 UTC (rev 2466)
@@ -433,12 +433,14 @@
         }
       ],
 
+      :num_options => ["10", "20", "25", "50", "100"],
+
       :filters =>
       [
         {
           :option    => "type",
           :column    => "contributions.contributable_type",
-          :title     => 'Category',
+          :title     => 'category',
           :select    => 'contributions.contributable_type, COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) AS count',
           :group     => 'contributions.contributable_type',
           :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC',
@@ -451,7 +453,7 @@
           :option    => "content_type",
           :column    => "content_types.title",
           :joins     => [ :content_types ],
-          :title     => 'Type',
+          :title     => 'type',
           :select    => 'content_types.title, COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) AS count',
           :condition => 'contributions.content_type_id IS NOT NULL',
           :group     => 'content_types.title',
@@ -465,7 +467,7 @@
           :option    => "tag",
           :column    => "tags.name",
           :joins     => [ :taggings, :tags ],
-          :title     => 'Tag',
+          :title     => 'tag',
           :select    => 'tags.name, COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) AS count',
           :group     => 'tags.id',
           :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC, tags.name',
@@ -478,7 +480,7 @@
           :option    => "member",
           :column    => "users.name",
           :joins     => [ :users ],
-          :title     => 'User',
+          :title     => 'user',
           :select    => 'users.name, COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) AS count',
           :group     => 'users.name',
           :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC',
@@ -491,7 +493,7 @@
           :option    => "license",
           :column    => "licenses.unique_name",
           :joins     => [ :licences ],
-          :title     => 'Licence',
+          :title     => 'licence',
           :select    => 'licenses.unique_name, COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) AS count',
           :condition => 'contributions.license_id IS NOT NULL',
           :group     => 'licenses.unique_name',
@@ -505,7 +507,7 @@
           :option    => "network",
           :column    => "networks.title",
           :joins     => [ :networks ],
-          :title     => "Group",
+          :title     => "group",
           :select    => 'networks.title, COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) AS count',
           :group     => 'networks.id',
           :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC',
@@ -514,18 +516,18 @@
           :value     => 'x.title'
         },
 
-        {
-          :option    => "attribution",
-          :column    => "attribution_targets.label",
-          :joins     => [ :attributions, :attribution_targets ],
-          :title     => "Attribution",
-          :select    => 'attribution_targets.label, COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) AS count',
-          :group     => 'attribution_targets.contributable_type, attribution_targets.contributable_id',
-          :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC',
-          :label     => 'x.label',
-          :key       => 'attribution',
-          :value     => 'x.label'
-        },
+#       {
+#         :option    => "attribution",
+#         :column    => "attribution_targets.label",
+#         :joins     => [ :attributions, :attribution_targets ],
+#         :title     => "attribution",
+#         :select    => 'attribution_targets.label, COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) AS count',
+#         :group     => 'attribution_targets.contributable_type, attribution_targets.contributable_id',
+#         :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC',
+#         :label     => 'x.label',
+#         :key       => 'attribution',
+#         :value     => 'x.label'
+#       },
       ],
 
       :joins =>
@@ -587,7 +589,7 @@
         :authorised_user => user,
         :include_permissions => true,
         :contribution_records => true,
-        :page => { :size => 10, :current => params["page"] },
+        :page => { :size => params["num"] ? params["num"].to_i : nil, :current => params["page"] },
         :joins => joins.length.zero? ? nil : joins.uniq.map do |j| pivot_options[:joins][j] end.join(" "),
         :conditions => conditions.length.zero? ? nil : conditions.join(" AND "),
         :order => order_options[:order])

Modified: branches/discovery/app/views/content/_index.rhtml (2465 => 2466)


--- branches/discovery/app/views/content/_index.rhtml	2010-07-09 17:04:16 UTC (rev 2465)
+++ branches/discovery/app/views/content/_index.rhtml	2010-07-11 05:20:25 UTC (rev 2466)
@@ -1,15 +1,13 @@
 <%= render :partial => "layouts/paginate", :locals => { :collection => @contributions, :sort_by => @pivot_options[:order] } %>
 
-<div style="clear: left"></div>
+<div style="clear: both"></div>
 
 <div>
   <div class="pivot">
-
-    <div class="pivot-title">Filters</div>
-
     <% @filters.each do |filter| %>
+      <div class="category">Filter by <%= filter[:title] -%></div>
+
       <div class="filter">
-        <div class="category"><%= filter[:title] -%></div>
 
         <div class="options">
           <% filter[:objects].each do |object| %>
@@ -31,6 +29,5 @@
 <%= _javascript__include_tag "ellipsis.js" %>
 <script>truncate_spans()</script>
 
-<%= render :partial => "layouts/paginate", :locals => { :collection => @contributions } %>
+<%= render :partial => "layouts/paginate", :locals => { :collection => @contributions, :sort_by => @pivot_options[:order], :num_options => @pivot_options[:num_options] } %>
 
-

Modified: branches/discovery/app/views/layouts/_paginate.rhtml (2465 => 2466)


--- branches/discovery/app/views/layouts/_paginate.rhtml	2010-07-09 17:04:16 UTC (rev 2465)
+++ branches/discovery/app/views/layouts/_paginate.rhtml	2010-07-11 05:20:25 UTC (rev 2466)
@@ -3,9 +3,20 @@
     Sort by:
     <select  = this.options[this.selectedIndex].value;">
       <% sort_by.each do |args| %>
-        <option value="?order=<%= args[:option] -%>" <% if params[:order] == args[:option] -%> selected="selected"<% end -%>><%= args[:label] -%></option>
+        <option value="<%= url_for(request.query_parameters.merge("order" => args[:option])) -%>" <% if params[:order] == args[:option] -%> selected="selected"<% end -%>><%= args[:label] -%></option>
       <% end %>
     </select>
+
+    <% if local_assigns[:num_options] %>
+      <br />
+      <br />
+      Results per page:
+      <select  = this.options[this.selectedIndex].value;">
+        <% num_options.each do |num_option| %>
+          <option value="<%= url_for(request.query_parameters.merge("num" => num_option)) -%>" <% if params[:num] == num_option -%> selected="selected"<% end -%>><%= num_option -%></option>
+        <% end %>
+      </select>
+    <% end %>
   </div>
 <% end %>
 

Modified: branches/discovery/config/routes.rb (2465 => 2466)


--- branches/discovery/config/routes.rb	2010-07-09 17:04:16 UTC (rev 2465)
+++ branches/discovery/config/routes.rb	2010-07-11 05:20:25 UTC (rev 2466)
@@ -42,6 +42,7 @@
   end
 
   map.content '/content', :controller => 'content', :action ="" 'index', :conditions => { :method => :get }
+  map.formatted_content '/content.:format', :controller => 'content', :action ="" 'index', :conditions => { :method => :get }
 
   # Runners
   map.resources :runners, :member => { :verify => :get }

Modified: branches/discovery/public/stylesheets/styles.css (2465 => 2466)


--- branches/discovery/public/stylesheets/styles.css	2010-07-09 17:04:16 UTC (rev 2465)
+++ branches/discovery/public/stylesheets/styles.css	2010-07-11 05:20:25 UTC (rev 2466)
@@ -2051,9 +2051,7 @@
 DIV.pivot DIV.category {
   padding: 0.2em;
   font-size: 110%;
-  background: #e0e0e0;
   margin-bottom: 0.2em;
-  border-radius: 6px 6px 0 0;
 }
 
 DIV.pivot DIV.options > DIV {
@@ -2063,6 +2061,10 @@
   padding-left: 0.2em;
 }
 
+DIV.pivot DIV.options > DIV:first-child {
+  border-radius: 6px 6px 0 0;
+}
+
 DIV.pivot DIV.options > DIV:last-child {
   border-radius: 0 0 6px 6px;
 }

reply via email to

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