X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/19e913d3b754429be49c38505c249b7b2151a70f..82386abaf8f818a64cd730b9af0e0cfa97a6d0ae:/apps/workbench/app/controllers/application_controller.rb diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 0802113911..e018363561 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -11,9 +11,9 @@ class ApplicationController < ActionController::Base around_filter :set_thread_api_token # Methods that don't require login should # skip_around_filter :require_thread_api_token - around_filter :require_thread_api_token, except: ERROR_ACTIONS + around_filter :require_thread_api_token, except: [:report_issue_popup, :report_issue] + ERROR_ACTIONS before_filter :accept_uuid_as_id_param, except: ERROR_ACTIONS - before_filter :check_user_agreements, except: ERROR_ACTIONS + before_filter :check_user_agreements, except: [:report_issue_popup, :report_issue] + ERROR_ACTIONS before_filter :check_user_profile, except: [:update_profile] + ERROR_ACTIONS before_filter :check_user_notifications, except: ERROR_ACTIONS before_filter :load_filters_and_paging_params, except: ERROR_ACTIONS @@ -90,6 +90,9 @@ class ApplicationController < ActionController::Base end def load_filters_and_paging_params + @order = params[:order] || 'created_at desc' + @order = [@order] unless @order.is_a? Array + @limit ||= 200 if params[:limit] @limit = params[:limit].to_i @@ -129,10 +132,8 @@ class ApplicationController < ActionController::Base respond_to do |f| f.json { render json: @objects } f.html { - if params['tab_pane'] - comparable = self.respond_to? :compare - render(partial: 'show_' + params['tab_pane'].downcase, - locals: { comparable: comparable, objects: @objects }) + if params[:tab_pane] + render_pane params[:tab_pane] else render end @@ -141,6 +142,23 @@ class ApplicationController < ActionController::Base end end + helper_method :render_pane + def render_pane tab_pane, opts={} + render_opts = { + partial: 'show_' + tab_pane.downcase, + locals: { + comparable: self.respond_to?(:compare), + objects: @objects, + tab_pane: tab_pane + }.merge(opts[:locals] || {}) + } + if opts[:to_string] + render_to_string render_opts + else + render render_opts + end + end + def index find_objects_for_index if !@objects render_index @@ -178,9 +196,7 @@ class ApplicationController < ActionController::Base f.json { render json: @object.attributes.merge(href: url_for(@object)) } f.html { if params['tab_pane'] - comparable = self.respond_to? :compare - render(partial: 'show_' + params['tab_pane'].downcase, - locals: { comparable: comparable, objects: @objects }) + render_pane params['tab_pane'] elsif request.method.in? ['GET', 'HEAD'] render else