aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorZog2018-02-08 10:33:46 +0100
committerLuc Donnet2018-02-20 10:20:18 +0100
commit3dcea81c627c1c740630ce7306bac55256ce8037 (patch)
tree1ff79bdb5f04aba4503b47c781aaa0146d1ac32a /app/helpers
parent3809301116aec5466445b29637026804da3d6745 (diff)
downloadchouette-core-3dcea81c627c1c740630ce7306bac55256ce8037.tar.bz2
Refs #5863 @6h; Remove workbench id from the querystring
Infer it when possible, and use a nested otherwise
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/referentials_helper.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/helpers/referentials_helper.rb b/app/helpers/referentials_helper.rb
index 8251377aa..e464ec8a5 100644
--- a/app/helpers/referentials_helper.rb
+++ b/app/helpers/referentials_helper.rb
@@ -15,4 +15,14 @@ module ReferentialsHelper
service = ReferentialOverview.new referential, self
render partial: "referentials/overview", locals: {referential: referential, overview: service}
end
+
+ def mutual_workbench workbench
+ current_user.organisation.workbenches.where(workgroup_id: workbench.workgroup_id).last
+ end
+
+ def duplicate_workbench_referential_path referential
+ workbench = mutual_workbench referential.workbench
+ raise "Missing workbench for referential #{referential.name}" unless workbench.present?
+ new_workbench_referential_path(workbench, from: referential.id)
+ end
end