Diff
Modified: branches/contextualisation/app/controllers/application_controller.rb (3419 => 3420)
--- branches/contextualisation/app/controllers/application_controller.rb 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/controllers/application_controller.rb 2013-02-14 15:56:55 UTC (rev 3420)
@@ -488,4 +488,15 @@
format.html { redirect_to target, (referrer.blank? ? nil : params) }
end
end
+
+
+ def check_context
+ if params[:user_id]
+ @context = User.find_by_id(params[:user_id])
+ error("User not found") if @context.nil?
+ elsif params[:network_id]
+ @context = Network.find_by_id(params[:network_id])
+ error("Group not found") if @context.nil?
+ end
+ end
end
Modified: branches/contextualisation/app/controllers/blobs_controller.rb (3419 => 3420)
--- branches/contextualisation/app/controllers/blobs_controller.rb 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/controllers/blobs_controller.rb 2013-02-14 15:56:55 UTC (rev 3420)
@@ -15,6 +15,8 @@
before_filter :set_sharing_mode_variables, : [:show, :new, :create, :edit, :update]
before_filter :check_is_owner, : [:edit, :update, :suggestions, :process_suggestions]
+
+ before_filter :check_context, : :index
# declare sweepers and which actions should invoke them
cache_sweeper :blob_sweeper, : [ :create, :update, :destroy ]
@@ -75,6 +77,13 @@
pivot_options["order"] = [{"order" => "id ASC", "option" => "relevance", "label" => "Relevance"}] + pivot_options["order"]
end
+ locked_filters = { 'CATEGORY' => 'Blob' }
+
+ if @context
+ context_filter = visible_name(@context).upcase + "_ID"
+ locked_filters[context_filter] = @context.id.to_s
+ end
+
@pivot, problem = calculate_pivot(
:pivot_options => Conf.pivot_options,
@@ -83,7 +92,7 @@
:search_models => [Blob],
:search_limit => Conf.max_search_size,
- :locked_filters => { 'CATEGORY' => 'Blob' },
+ :locked_filters => locked_filters,
:active_filters => ["CATEGORY", "TYPE_ID", "TAG_ID", "USER_ID",
"LICENSE_ID", "GROUP_ID", "WSDL_ENDPOINT",
Modified: branches/contextualisation/app/controllers/packs_controller.rb (3419 => 3420)
--- branches/contextualisation/app/controllers/packs_controller.rb 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/controllers/packs_controller.rb 2013-02-14 15:56:55 UTC (rev 3420)
@@ -11,7 +11,9 @@
before_filter :find_pack_auth, :except => [:index, :new, :create, :search]
before_filter :set_sharing_mode_variables, : [:show, :new, :create, :edit, :update]
-
+
+ before_filter :check_context, : :index
+
# declare sweepers and which actions should invoke them
cache_sweeper :pack_sweeper, : [ :create, :update, :destroy ]
cache_sweeper :pack_entry_sweeper, : [ :create_item, :quick_add, :update_item, :destroy_item ]
@@ -37,6 +39,13 @@
pivot_options["order"] = [{"order" => "id ASC", "option" => "relevance", "label" => "Relevance"}] + pivot_options["order"]
end
+ locked_filters = { 'CATEGORY' => 'Pack' }
+
+ if @context
+ context_filter = visible_name(@context).upcase + "_ID"
+ locked_filters[context_filter] = @context.id.to_s
+ end
+
@pivot, problem = calculate_pivot(
:pivot_options => Conf.pivot_options,
@@ -45,7 +54,7 @@
:search_models => [Pack],
:search_limit => Conf.max_search_size,
- :locked_filters => { 'CATEGORY' => 'Pack' },
+ :locked_filters => locked_filters,
:active_filters => ["CATEGORY", "TYPE_ID", "TAG_ID", "USER_ID",
"LICENSE_ID", "GROUP_ID", "WSDL_ENDPOINT",
Modified: branches/contextualisation/app/controllers/workflows_controller.rb (3419 => 3420)
--- branches/contextualisation/app/controllers/workflows_controller.rb 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/controllers/workflows_controller.rb 2013-02-14 15:56:55 UTC (rev 3420)
@@ -21,6 +21,8 @@
before_filter :check_is_owner, : [:edit, :update]
+ before_filter :check_context, : :index
+
# declare sweepers and which actions should invoke them
cache_sweeper :workflow_sweeper, : [ :create, :create_version, :launch, :update, :update_version, :destroy_version, :destroy ]
cache_sweeper :download_viewing_sweeper, : [ :show, :download, :named_download, :galaxy_tool, :galaxy_tool_download, :launch ]
@@ -207,6 +209,13 @@
pivot_options["order"] = [{"order" => "id ASC", "option" => "relevance", "label" => "Relevance"}] + pivot_options["order"]
end
+ locked_filters = { 'CATEGORY' => 'Workflow' }
+
+ if @context
+ context_filter = visible_name(@context).upcase + "_ID"
+ locked_filters[context_filter] = @context.id.to_s
+ end
+
@pivot, problem = calculate_pivot(
:pivot_options => pivot_options,
@@ -215,7 +224,7 @@
:search_models => [Workflow],
:search_limit => Conf.max_search_size,
- :locked_filters => { 'CATEGORY' => 'Workflow' },
+ :locked_filters => locked_filters,
:active_filters => ["CATEGORY", "TYPE_ID", "TAG_ID", "USER_ID",
"LICENSE_ID", "GROUP_ID", "WSDL_ENDPOINT",
Modified: branches/contextualisation/app/models/network.rb (3419 => 3420)
--- branches/contextualisation/app/models/network.rb 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/models/network.rb 2013-02-14 15:56:55 UTC (rev 3420)
@@ -44,7 +44,6 @@
validates_associated :owner
validates_presence_of :user_id, :title
-
# bugfix. after unique_name has been set, if you un-set it, Rails throws an error!
validates_uniqueness_of :unique_name, :if => Proc.new { |network| !(network.unique_name.nil? or network.unique_name.empty?) }
@@ -61,6 +60,10 @@
def owner_name
owner.name
end
+
+ def name
+ title
+ end
# announcements belonging to the group;
#
Modified: branches/contextualisation/app/views/blobs/_breadcrumbs.rhtml (3419 => 3420)
--- branches/contextualisation/app/views/blobs/_breadcrumbs.rhtml 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/views/blobs/_breadcrumbs.rhtml 2013-02-14 15:56:55 UTC (rev 3420)
@@ -1,5 +1,14 @@
-<li><%= link_to 'Files', blobs_path -%></li>
+<% if @context %>
+ <li><%= link_to visible_name(@context).pluralize, polymorphic_url(@context.class.name.underscore.pluralize) %></li>
+ <li><%= link_to @context.name, @context %></li>
+<% end %>
+<% if controller.action_name == 'index' %>
+ <li>Files</li>
+<% else %>
+ <li><%= link_to 'Files', blobs_path %></li>
+<% end %>
+
<% if ["show", "new", "edit", "all", "search", "suggestions"].include? controller.action_name.to_s -%>
<% case controller.action_name.to_s; when "show" -%>
Modified: branches/contextualisation/app/views/blobs/index.rhtml (3419 => 3420)
--- branches/contextualisation/app/views/blobs/index.rhtml 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/views/blobs/index.rhtml 2013-02-14 15:56:55 UTC (rev 3420)
@@ -1,4 +1,15 @@
-<h1>Files</h1>
+<%
+ case @context
+ when User
+ prefix = "address@hidden'"
+ prefix << 's' if @context.name[-1] != 's'
+ when Network
+ prefix = @context.name
+ else
+ prefix = ""
+ end
+%>
+<h1><%= prefix -%> Files</h1>
<%= render :partial => "content/index" -%>
Modified: branches/contextualisation/app/views/content/_index.rhtml (3419 => 3420)
--- branches/contextualisation/app/views/content/_index.rhtml 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/views/content/_index.rhtml 2013-02-14 15:56:55 UTC (rev 3420)
@@ -33,7 +33,10 @@
<% filter[:objects].each do |object| %>
<div title='<%= h(object[:plain_label]) -%>'<%= object[:selected] ? ' class="selected"' : '' -%>>
<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]) -%>
+ <a href="" object[:label_uri].delete_if {|k,v| v.nil?}.to_param -%>">
+ <div class='count'><%= object[:count] -%></div>
+ <div class='label'><span class='truncate'><%= object[:label] -%></span></div>
+ </a>
</div>
<% end %>
</div>
Modified: branches/contextualisation/app/views/networks/_breadcrumbs.rhtml (3419 => 3420)
--- branches/contextualisation/app/views/networks/_breadcrumbs.rhtml 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/views/networks/_breadcrumbs.rhtml 2013-02-14 15:56:55 UTC (rev 3420)
@@ -1,4 +1,8 @@
-<li><%= link_to 'Groups', networks_path -%></li>
+<% if controller.action_name == 'index' %>
+ <li>Groups</li>
+<% else %>
+ <li><%= link_to 'Groups', networks_path %></li>
+<% end %>
<% if ["show", "content", "new", "edit", "search", "all", "invite"].include? controller.action_name.to_s -%>
<% case controller.action_name.to_s; when "show" %>
Modified: branches/contextualisation/app/views/packs/_breadcrumbs.rhtml (3419 => 3420)
--- branches/contextualisation/app/views/packs/_breadcrumbs.rhtml 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/views/packs/_breadcrumbs.rhtml 2013-02-14 15:56:55 UTC (rev 3420)
@@ -1,5 +1,14 @@
-<li><%= link_to 'Packs', packs_path %></li>
+<% if @context %>
+ <li><%= link_to visible_name(@context).pluralize, polymorphic_url(@context.class.name.underscore.pluralize) %></li>
+ <li><%= link_to @context.name, @context %></li>
+<% end %>
+<% if controller.action_name == 'index' %>
+ <li>Packs</li>
+<% else %>
+ <li><%= link_to 'Packs', packs_path %></li>
+<% end %>
+
<% if ["show", "new", "edit", "all", "new_item", "edit_item", "search"].include? controller.action_name.to_s %>
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@pack.title) %></li>
Modified: branches/contextualisation/app/views/packs/index.rhtml (3419 => 3420)
--- branches/contextualisation/app/views/packs/index.rhtml 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/views/packs/index.rhtml 2013-02-14 15:56:55 UTC (rev 3420)
@@ -20,5 +20,17 @@
<center><%= image_tag 'packs.png' -%></center>
</div>
</div>
+<%
+ case @context
+ when User
+ prefix = "address@hidden'"
+ prefix << 's' if @context.name[-1] != 's'
+ when Network
+ prefix = @context.name
+ else
+ prefix = ""
+ end
+%>
+<h1><%= prefix -%> Packs</h1>
<%= render :partial => "content/index" -%>
Modified: branches/contextualisation/app/views/users/_breadcrumbs.rhtml (3419 => 3420)
--- branches/contextualisation/app/views/users/_breadcrumbs.rhtml 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/views/users/_breadcrumbs.rhtml 2013-02-14 15:56:55 UTC (rev 3420)
@@ -1,4 +1,8 @@
-<li><%= link_to 'Users', users_path -%></li>
+<% if controller.action_name == 'index' %>
+ <li>Users</li>
+<% else %>
+ <li><%= link_to 'Users', users_path %></li>
+<% end %>
<% if ["edit"].include? controller.action_name.to_s -%>
<li><%= link_to h(@user.name), user_path(@user) -%></li>
Modified: branches/contextualisation/app/views/workflows/_breadcrumbs.rhtml (3419 => 3420)
--- branches/contextualisation/app/views/workflows/_breadcrumbs.rhtml 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/views/workflows/_breadcrumbs.rhtml 2013-02-14 15:56:55 UTC (rev 3420)
@@ -1,5 +1,14 @@
-<li><%= link_to 'Workflows', workflows_path %></li>
+<% if @context %>
+ <li><%= link_to visible_name(@context).pluralize, polymorphic_url(@context.class.name.underscore.pluralize) %></li>
+ <li><%= link_to @context.name, @context %></li>
+<% end %>
+<% if controller.action_name == 'index' %>
+ <li>Workflows</li>
+<% else %>
+ <li><%= link_to 'Workflows', workflows_path %></li>
+<% end %>
+
<% if ["show", "new", "edit", "search", "all", "new_version", "edit_version", "comments_timeline", "galaxy_tool"].include? controller.action_name.to_s %>
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@workflow.title) %></li>
Modified: branches/contextualisation/app/views/workflows/index.rhtml (3419 => 3420)
--- branches/contextualisation/app/views/workflows/index.rhtml 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/app/views/workflows/index.rhtml 2013-02-14 15:56:55 UTC (rev 3420)
@@ -1,4 +1,15 @@
-<h1>Workflows</h1>
+<%
+ case @context
+ when User
+ prefix = "address@hidden'"
+ prefix << 's' if @context.name[-1] != 's'
+ when Network
+ prefix = @context.name
+ else
+ prefix = ""
+ end
+%>
+<h1><%= prefix -%> Workflows</h1>
<%= render :partial => "content/index" -%>
Modified: branches/contextualisation/config/routes.rb (3419 => 3420)
--- branches/contextualisation/config/routes.rb 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/config/routes.rb 2013-02-14 15:56:55 UTC (rev 3420)
@@ -179,7 +179,7 @@
map.connect 'users/forgot_password', :controller => "users", :action ="" "forgot_password"
map.connect 'users/reset_password/:reset_code', :controller => "users", :action ="" "reset_password"
- [ 'news', 'friends', 'groups', 'workflows', 'files', 'packs', 'forums', 'credits', 'tags', 'favourites' ].each do |tab|
+ [ 'news', 'friends', 'groups', 'forums', 'credits', 'tags', 'favourites' ].each do |tab|
map.connect "users/:id/#{tab}", :controller => 'users', :action ="" tab
end
@@ -208,6 +208,11 @@
# user's reports of inappropriate content
user.resources :reports, :controller => :user_reports
+
+ # user's uploaded resources
+ user.resources :workflows, : :index
+ user.resources :blobs, : :index, :as => :files
+ user.resources :packs, : :index
end
map.resources :networks,
@@ -223,6 +228,11 @@
network.resources :group_announcements, :as => :announcements, :name_prefix => nil
network.resources :comments, :collection => { :timeline => :get }
network.resources :policies, :controller => 'group_policies'
+
+ # resources shared with network
+ network.resources :workflows, : :index
+ network.resources :blobs, : :index, :as => :files
+ network.resources :packs, : :index
end
# The priority is based upon order of creation: first created -> highest priority.
Modified: branches/contextualisation/lib/pivoting.rb (3419 => 3420)
--- branches/contextualisation/lib/pivoting.rb 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/lib/pivoting.rb 2013-02-14 15:56:55 UTC (rev 3420)
@@ -23,7 +23,11 @@
begin
expr = parse_filter_expression(opts[:params]["filter"], opts[:pivot_options], :active_filters => opts[:active_filters])
rescue Exception => ex
- problem = "Problem with query _expression_: #{ex}"
+ if Rails.env == "production"
+ problem = "Problem with query _expression_: #{ex}"
+ else
+ raise ex
+ end
end
pivot = contributions_list(opts[:params], opts[:user], opts[:pivot_options],
Modified: branches/contextualisation/public/stylesheets/styles.css (3419 => 3420)
--- branches/contextualisation/public/stylesheets/styles.css 2013-02-14 08:39:09 UTC (rev 3419)
+++ branches/contextualisation/public/stylesheets/styles.css 2013-02-14 15:56:55 UTC (rev 3420)
@@ -2380,6 +2380,7 @@
background-color: #F5F5F5;
padding: 0.5em;
margin-bottom: 0.5em;
+ overflow: auto;
}
.resource_list_item p {