From c4cfb4caca122ba09ab9153453650c308457e675 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 5 Jun 2014 13:20:39 -0400 Subject: [PATCH] 2961: Added tab_pane query parameter which returns just the desired tab pane partial. --- .../app/controllers/application_controller.rb | 23 +++++++++++++++---- .../app/controllers/collections_controller.rb | 2 ++ .../app/controllers/folders_controller.rb | 2 ++ .../app/controllers/groups_controller.rb | 1 + .../app/controllers/jobs_controller.rb | 5 ++-- .../app/controllers/sessions_controller.rb | 1 + 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index e1b6a7f929..24d6ab3d97 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -87,7 +87,15 @@ class ApplicationController < ActionController::Base @objects = @objects.filter(@filters).limit(@limit).offset(@offset).all respond_to do |f| f.json { render json: @objects } - f.html { render } + f.html { + if params['tab_pane'] + comparable = self.respond_to? :compare + render(partial: 'show_' + params['tab_pane'].downcase, + locals: { comparable: comparable, objects: @objects }) + else + render + end + } f.js { render } end end @@ -97,12 +105,19 @@ class ApplicationController < ActionController::Base return render_not_found("object not found") end respond_to do |f| + puts f f.json { render json: @object.attributes.merge(href: url_for(@object)) } f.html { - if request.method == 'GET' - render + if params['tab_pane'] + comparable = self.respond_to? :compare + render(partial: 'show_' + params['tab_pane'].downcase, + locals: { comparable: comparable, objects: @objects }) else - redirect_to params[:return_to] || @object + if request.method == 'GET' + render + else + redirect_to params[:return_to] || @object + end end } f.js { render } diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb index 218ba893fc..7c6bab63f6 100644 --- a/apps/workbench/app/controllers/collections_controller.rb +++ b/apps/workbench/app/controllers/collections_controller.rb @@ -88,6 +88,8 @@ class CollectionsController < ApplicationController info[:links] << link end @request_url = request.url + + super end def show_file_links diff --git a/apps/workbench/app/controllers/folders_controller.rb b/apps/workbench/app/controllers/folders_controller.rb index 8ebb1a34b1..e00608eb8d 100644 --- a/apps/workbench/app/controllers/folders_controller.rb +++ b/apps/workbench/app/controllers/folders_controller.rb @@ -74,6 +74,8 @@ class FoldersController < ApplicationController @shared_folder_tree = sorted_paths.call({'Shared with me' => buildtree.call(children_of, false)}) + + super end def choose diff --git a/apps/workbench/app/controllers/groups_controller.rb b/apps/workbench/app/controllers/groups_controller.rb index 854496a56a..30cd1e35c8 100644 --- a/apps/workbench/app/controllers/groups_controller.rb +++ b/apps/workbench/app/controllers/groups_controller.rb @@ -4,6 +4,7 @@ class GroupsController < ApplicationController @group_uuids = @groups.collect &:uuid @links_from = Link.where link_class: 'permission', tail_uuid: @group_uuids @links_to = Link.where link_class: 'permission', head_uuid: @group_uuids + super end def show diff --git a/apps/workbench/app/controllers/jobs_controller.rb b/apps/workbench/app/controllers/jobs_controller.rb index 4746635c72..9de82d82f9 100644 --- a/apps/workbench/app/controllers/jobs_controller.rb +++ b/apps/workbench/app/controllers/jobs_controller.rb @@ -16,7 +16,7 @@ class JobsController < ApplicationController @svg = ProvenanceHelper::create_provenance_graph nodes, "provenance_svg", { :request => request, - :all_script_parameters => true, + :all_script_parameters => true, :script_version_nodes => true} end @@ -27,12 +27,13 @@ class JobsController < ApplicationController generate_provenance(@objects) else @limit = 20 - super end + super end def show generate_provenance([@object]) + super end def index_pane_list diff --git a/apps/workbench/app/controllers/sessions_controller.rb b/apps/workbench/app/controllers/sessions_controller.rb index 585f322a85..abed6b68a7 100644 --- a/apps/workbench/app/controllers/sessions_controller.rb +++ b/apps/workbench/app/controllers/sessions_controller.rb @@ -8,5 +8,6 @@ class SessionsController < ApplicationController end def index redirect_to root_url if session[:arvados_api_token] + super end end -- 2.30.2