aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/workbenches_controller.rb
diff options
context:
space:
mode:
authorXinhui2017-02-16 16:32:55 +0100
committerXinhui2017-02-16 16:35:34 +0100
commit44c2626a2207ea1e06c7fc44f55673b135343135 (patch)
tree2319d78f1409ad022a7a911d9076505c21f6ce6e /app/controllers/workbenches_controller.rb
parentd76923393b4250c8a9c29d4dc35d4bebc0237a0e (diff)
downloadchouette-core-44c2626a2207ea1e06c7fc44f55673b135343135.tar.bz2
Fix workbench#show default organisation filter
Diffstat (limited to 'app/controllers/workbenches_controller.rb')
-rw-r--r--app/controllers/workbenches_controller.rb11
1 files changed, 2 insertions, 9 deletions
diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb
index c261373e0..da57268ec 100644
--- a/app/controllers/workbenches_controller.rb
+++ b/app/controllers/workbenches_controller.rb
@@ -3,18 +3,11 @@ class WorkbenchesController < BreadcrumbController
respond_to :html, :only => [:show]
def show
- scope = Workbench.find(params[:id])
- if params[:q] and params[:q][:organisation_name_eq_any] and params[:q][:organisation_name_eq_any].include? current_organisation.name
- scope = scope.referentials.ready
- else
- scope = scope.all_referentials
- end
-
- @q = scope.ransack(params[:q])
+ @q = Workbench.find(params[:id]).all_referentials.ransack(params[:q])
+ @q.organisation_name_eq_any ||= current_organisation.name unless params[:q]
@collection = @q.result(distinct: true)
@wbench_refs = @collection.order(sort_column + ' ' + sort_direction).paginate(page: params[:page], per_page: 30)
-
show! do
build_breadcrumb :show
end