myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2463] branches/discovery: made /content route an


From: noreply
Subject: [myexperiment-hackers] [2463] branches/discovery: made /content route and routed workflows, files and packs tab to them with the preselected type
Date: Thu, 8 Jul 2010 06:21:58 -0400 (EDT)

Revision
2463
Author
dgc
Date
2010-07-08 06:21:57 -0400 (Thu, 08 Jul 2010)

Log Message

made /content route and routed workflows, files and packs tab to them with the preselected type

Modified Paths

Added Paths

Removed Paths

Diff

Modified: branches/discovery/app/controllers/application.rb (2462 => 2463)


--- branches/discovery/app/controllers/application.rb	2010-07-07 23:24:35 UTC (rev 2462)
+++ branches/discovery/app/controllers/application.rb	2010-07-08 10:21:57 UTC (rev 2463)
@@ -455,7 +455,7 @@
           :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',
-          :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC LIMIT 10',
+          :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC',
           :label     => 'x.title',
           :key       => 'content_type',
           :value     => 'x.title'
@@ -468,7 +468,7 @@
           :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 LIMIT 10',
+          :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC, tags.name',
           :label     => 'x.name',
           :key       => 'tag',
           :value     => 'x.name'
@@ -481,7 +481,7 @@
           :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 LIMIT 10',
+          :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC',
           :label     => 'x.name',
           :key       => 'member',
           :value     => 'x.name'
@@ -495,7 +495,7 @@
           :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',
-          :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC LIMIT 10',
+          :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC',
           :label     => 'x.unique_name',
           :key       => 'license',
           :value     => 'x.unique_name'
@@ -508,7 +508,7 @@
           :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 LIMIT 10',
+          :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC',
           :label     => 'x.title',
           :key       => 'network',
           :value     => 'x.title'
@@ -521,7 +521,7 @@
           :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 LIMIT 10',
+          :order     => 'COUNT(DISTINCT contributions.contributable_type, contributions.contributable_id) DESC',
           :label     => 'x.label',
           :key       => 'attribution',
           :value     => 'x.label'
@@ -592,6 +592,16 @@
         :conditions => conditions.length.zero? ? nil : conditions.join(" AND "),
         :order => order_options[:order])
 
+    # produce a query hash to match the current filters
+
+    query_hash = {}
+
+    pivot_options[:filters].each do |filter|
+      if params[filter[:option]]
+        query_hash[filter[:option]] = params[filter[:option]]
+      end
+    end
+
     # produce the filter list
 
     filters = pivot_options[:filters].clone
@@ -622,6 +632,7 @@
           :joins => joins.length.zero? ? nil : joins.uniq.map do |j| pivot_options[:joins][j] end.join(" "),
           :conditions => conditions.length.zero? ? nil : conditions.join(" AND "),
           :group => filter[:group],
+          :limit => 10,
           :order => filter[:order],
           :authorised_user => user).map do |object|
 
@@ -637,13 +648,13 @@
 
             new_selection = nil if new_selection.empty?
 
-            target_query = request.query_parameters.merge(filter[:key] => new_selection, "page" => nil)
+            target_uri = content_path(query_hash.merge(filter[:key] => new_selection, "page" => nil))
 
             {
               :object => object,
               :value  => value,
               :label  => "<div class='pivot-count'>" + eval("x.count") + "</div><div class='pivot-label'><span class='truncate'>" + eval(filter[:label]) + "</span></div>",
-              :query  => target_query,
+              :uri  => target_uri,
               :selected => selected
             }
           end

Modified: branches/discovery/app/controllers/blobs_controller.rb (2462 => 2463)


--- branches/discovery/app/controllers/blobs_controller.rb	2010-07-07 23:24:35 UTC (rev 2462)
+++ branches/discovery/app/controllers/blobs_controller.rb	2010-07-08 10:21:57 UTC (rev 2463)
@@ -54,10 +54,12 @@
 
   # GET /files
   def index
-    @pivot_options = pivot_options
-    @contributions, @filters, @summary = contributions_list(Blob, params, current_user)
     respond_to do |format|
-      format.html # index.rhtml
+      format.html {
+        @pivot_options = pivot_options
+        @contributions, @filters, @summary = contributions_list(Contribution, { "type" => "Blob" }, current_user)
+        render 'content/index'
+      }
     end
   end
   

Added: branches/discovery/app/controllers/content_controller.rb (0 => 2463)


--- branches/discovery/app/controllers/content_controller.rb	                        (rev 0)
+++ branches/discovery/app/controllers/content_controller.rb	2010-07-08 10:21:57 UTC (rev 2463)
@@ -0,0 +1,25 @@
+# myExperiment: app/controllers/content_controller.rb
+#
+# Copyright (c) 2010 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class ContentController < ApplicationController
+
+  include ApplicationHelper
+
+  def index
+    respond_to do |format|
+      format.html do
+        @pivot_options = pivot_options
+        @contributions, @filters, @summary = contributions_list(Contribution, params, current_user)
+        # index.rhtml
+      end
+#     format.rss do
+#       address@hidden = Workflow.find(:all, :order => "updated_at DESC") # list all (if required)
+#       render :action ="" 'index.rxml', :layout => false
+#     end
+    end
+  end
+
+end
+

Modified: branches/discovery/app/controllers/packs_controller.rb (2462 => 2463)


--- branches/discovery/app/controllers/packs_controller.rb	2010-07-07 23:24:35 UTC (rev 2462)
+++ branches/discovery/app/controllers/packs_controller.rb	2010-07-08 10:21:57 UTC (rev 2463)
@@ -27,10 +27,12 @@
 
   # GET /packs
   def index
-    @pivot_options = pivot_options
-    @contributions, @filters, @summary = contributions_list(Pack, params, current_user)
     respond_to do |format|
-      format.html # index.rhtml
+      format.html {
+        @pivot_options = pivot_options
+        @contributions, @filters, @summary = contributions_list(Contribution, { "type" => "Pack" }, current_user)
+        # index.rhtml
+      }
     end
   end
   

Modified: branches/discovery/app/controllers/workflows_controller.rb (2462 => 2463)


--- branches/discovery/app/controllers/workflows_controller.rb	2010-07-07 23:24:35 UTC (rev 2462)
+++ branches/discovery/app/controllers/workflows_controller.rb	2010-07-08 10:21:57 UTC (rev 2463)
@@ -167,8 +167,8 @@
     respond_to do |format|
       format.html do
         @pivot_options = pivot_options
-        @contributions, @filters, @summary = contributions_list(Contribution, params, current_user)
-        # index.rhtml
+        @contributions, @filters, @summary = contributions_list(Contribution, { "type" => "Workflow" }, current_user)
+        render 'content/index'
       end
       format.rss do
         address@hidden = Workflow.find(:all, :order => "updated_at DESC") # list all (if required)

Deleted: branches/discovery/app/views/blobs/index.rhtml (2462 => 2463)


--- branches/discovery/app/views/blobs/index.rhtml	2010-07-07 23:24:35 UTC (rev 2462)
+++ branches/discovery/app/views/blobs/index.rhtml	2010-07-08 10:21:57 UTC (rev 2463)
@@ -1,21 +0,0 @@
-<div class="box_standout" style="text-align: center; margin-bottom: 1em; font-weight: bold; line-height: 1.5em;">
-	<% Blob.count(:all, :group => 'content_type_id').sort{|x,y| y[1] <=> x[1]}.each do |arr| %>
-		  <span class="nowrap"><%= link_to((h(ContentType.find_by_id(arr[0]).title)),
-        search_files_path + "?query=kind:(#{ContentType.find_by_id(arr[0]).title})") %> (<%= arr[1] %>)</span>
-	<% end %>
-</div>
-
-<ul class="sectionIcons">
-	<li><%= icon "blob", new_file_path, nil, nil, "Upload New File" %></li>
-</ul>
-
-<% cache(:controller => 'files', :action ="" 'all_tags') do -%>
-	<%= render :partial => "blobs/all_tags" %>
-<% end -%>
-
-<%= render :partial => "layouts/paginate", :locals => { :collection => @contributions, :sort_by => @pivot_options[:order] } %>
-
-<%= render :partial => "contributions/list", :locals => { :collection => @contributions, :table => true } %>
-
-<%= render :partial => "layouts/paginate", :locals => { :collection => @contributions } %>
-

Modified: branches/discovery/app/views/packs/index.rhtml (2462 => 2463)


--- branches/discovery/app/views/packs/index.rhtml	2010-07-07 23:24:35 UTC (rev 2462)
+++ branches/discovery/app/views/packs/index.rhtml	2010-07-08 10:21:57 UTC (rev 2463)
@@ -1,7 +1,3 @@
-<ul class="sectionIcons">
-	<li><%= icon "pack", new_pack_path, nil, nil, "Create New Pack" %></li>
-</ul>
-
 <div class="box_standout" style="margin: 1.5em 3em; padding: 0.7em 1.5em;">
 	<p>
 		<%= image_tag 'manhattan_studio/folder-closed_24.png', :style => "vertical-align: middle;" -%>
@@ -9,7 +5,7 @@
 			<%= link_to_function "What are Packs?" + expand_image("0.3em"), visual_effect(:toggle_blind, "packs_info_more", :duration => 0.4) %>
 		</span>
 	</p>
-	<div id="packs_info_more" style="margin-left: 36px; font-size: 93%; color: #333333; display: block;">
+	<div id="packs_info_more" style="margin-left: 36px; font-size: 93%; color: #333333; display: none;">
 		<p>
 			Packs allow you to <font style="color: black; font-weight: bolder;">collect different items</font> together, 
 			like you might with a "wish list" or "shopping basket".
@@ -25,17 +21,4 @@
 	</div>
 </div>
 
-<center>
-	
-</center>
-
-<% cache(:controller => 'packs', :action ="" 'all_tags') do -%>
-	<%= render :partial => "packs/all_tags" %>
-<% end -%>
-
-<%= render :partial => "layouts/paginate", :locals => { :collection => @contributions, :sort_by => @pivot_options[:order] } %>
-
-<%= render :partial => "contributions/list", :locals => { :collection => @contributions, :table => true } %>
-
-<%= render :partial => "layouts/paginate", :locals => { :collection => @contributions } %>
-
+<%= render :partial => "content/index" -%>

Deleted: branches/discovery/app/views/workflows/index.rhtml (2462 => 2463)


--- branches/discovery/app/views/workflows/index.rhtml	2010-07-07 23:24:35 UTC (rev 2462)
+++ branches/discovery/app/views/workflows/index.rhtml	2010-07-08 10:21:57 UTC (rev 2463)
@@ -1,32 +0,0 @@
-<%= render :partial => "layouts/paginate", :locals => { :collection => @contributions, :sort_by => @pivot_options[:order] } %>
-
-<div style="clear: left"></div>
-
-<div>
-  <div class="pivot">
-    <% @filters.each do |filter| %>
-      <div class="filter">
-        <div class="category"><%= filter[:title] -%></div>
-
-        <div class="options">
-          <% filter[:objects].each do |object| %>
-            <div<%= object[:selected] ? ' class="selected"' : '' -%>>
-              <%= link_to(object[:label], object[:query]) -%>
-            </div>
-          <% end %>
-        </div>
-      </div>
-    <% end %>
-  </div>
-
-  <%= render :partial => "contributions/list", :locals => { :collection => @contributions, :table => true } %>
-
-</div>
-
-<div style="clear: left"></div>
-
-<%= _javascript__include_tag "ellipsis.js" %>
-<script>truncate_spans()</script>
-
-<%= render :partial => "layouts/paginate", :locals => { :collection => @contributions } %>
-

Modified: branches/discovery/config/routes.rb (2462 => 2463)


--- branches/discovery/config/routes.rb	2010-07-07 23:24:35 UTC (rev 2462)
+++ branches/discovery/config/routes.rb	2010-07-08 10:21:57 UTC (rev 2463)
@@ -41,6 +41,8 @@
       :controller => 'linked_data', :action ="" 'taggings'
   end
 
+  map.content '/content', :controller => 'content', :action ="" 'index', :conditions => { :method => :get }
+
   # Runners
   map.resources :runners, :member => { :verify => :get }
   

Modified: branches/discovery/public/stylesheets/styles.css (2462 => 2463)


--- branches/discovery/public/stylesheets/styles.css	2010-07-07 23:24:35 UTC (rev 2462)
+++ branches/discovery/public/stylesheets/styles.css	2010-07-08 10:21:57 UTC (rev 2463)
@@ -2050,7 +2050,7 @@
 
 DIV.pivot DIV.category {
   padding: 0.2em;
-  font-size: 120%;
+  font-size: 110%;
   background: #e0e0e0;
   margin-bottom: 0.2em;
   border-radius: 6px 6px 0 0;
@@ -2079,6 +2079,12 @@
   background: #dfc0a0;
 }
  
+.pivot-title {
+  font-size: 120%;
+  text-align: center;
+  margin-bottom: 1.0em;
+}
+
 .pivot-label {
   width: 110px;
   overflow: hidden;

reply via email to

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