diff options
| author | Xinhui | 2017-02-16 16:32:55 +0100 |
|---|---|---|
| committer | Xinhui | 2017-02-16 16:32:55 +0100 |
| commit | 630d6c162a937f83681553da4cfe32e80e2519df (patch) | |
| tree | 2319d78f1409ad022a7a911d9076505c21f6ce6e | |
| parent | fd13b6b120faf0a6a9c6f7e746405b0aa93d6507 (diff) | |
| download | chouette-core-630d6c162a937f83681553da4cfe32e80e2519df.tar.bz2 | |
Fix workbench#show default organisation filter
| -rw-r--r-- | app/controllers/workbenches_controller.rb | 11 |
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 |
