[ARVADOS] created: 12e7019819d6e595f676eac29805b6e518733d13

git at public.curoverse.com git at public.curoverse.com
Fri Jul 18 21:34:46 EDT 2014


        at  12e7019819d6e595f676eac29805b6e518733d13 (commit)


commit 12e7019819d6e595f676eac29805b6e518733d13
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jul 18 21:34:06 2014 -0400

    3235: Top nav "search" button opens a collection chooser.

diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb
index 9a76e9a..9f2cfb0 100644
--- a/apps/workbench/app/controllers/actions_controller.rb
+++ b/apps/workbench/app/controllers/actions_controller.rb
@@ -10,6 +10,17 @@ class ActionsController < ApplicationController
     ArvadosBase::resource_class_for_uuid(params[:uuid])
   end
 
+  def show
+    @object = model_class.find(params[:uuid])
+    if @object.is_a? Link and
+        @object.link_class == 'name' and
+        ArvadosBase::resource_class_for_uuid(@object.head_uuid) == Collection
+      redirect_to collection_path(id: @object.uuid)
+    else
+      redirect_to @object
+    end
+  end
+
   def post
     params.keys.collect(&:to_sym).each do |param|
       if @@exposed_actions[param]
diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index ec2c98b..94fe580 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -74,6 +74,18 @@
           </li>
           -->
 
+          <li>
+            <%= link_to(choose_collections_path(
+                       title: 'Search',
+                       action_name: 'Show',
+                       action_href: url_for(controller: :actions, action: :show),
+                       action_method: 'get',
+                       action_data: {selection_param: 'uuid', success: 'redirect-to-created-object'}.to_json),
+                      { class: "", remote: true, method: 'get' }) do %>
+              <i class="fa fa-fw fa-search"></i> Search
+            <% end %>
+          </li>
+
           <li class="dropdown notification-menu">
             <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="notifications-menu">
               <span class="badge badge-alert notification-count"><%= @notification_count %></span>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index a4f69b3..bb4faf2 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -64,6 +64,7 @@ ArvadosWorkbench::Application.routes.draw do
   end
 
   post 'actions' => 'actions#post'
+  get 'actions' => 'actions#show'
   get 'websockets' => 'websocket#index'
 
   root :to => 'projects#index'

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list