aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorTeddy Wing2017-07-10 11:48:23 +0200
committerTeddy Wing2017-07-12 11:11:13 +0200
commitdf184535c36359921fd5aabfb4c5c3e98c91017d (patch)
tree1c5c4991ac9780f83a7d6912eee092e663d7331a /app/controllers
parentc7ceb38801b853154cdae31672ff2c105c8b191f (diff)
downloadchouette-core-df184535c36359921fd5aabfb4c5c3e98c91017d.tar.bz2
Referentials#show: Use new table builder helper
Needed to add a new decorator to provide links to this table's gear menu. The links correspond to those in the header on the "referential_lines/show.html.slim" page. Call `#human_attribute_name` on the model directly instead of the collection because the decorated collection doesn't expose that method. Refs #3479
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/referentials_controller.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb
index 9505a47f3..838c46168 100644
--- a/app/controllers/referentials_controller.rb
+++ b/app/controllers/referentials_controller.rb
@@ -27,6 +27,14 @@ class ReferentialsController < BreadcrumbController
show! do |format|
@referential = @referential.decorate
@reflines = lines_collection.paginate(page: params[:page], per_page: 10)
+ @reflines = ModelDecorator.decorate(
+ @reflines,
+ with: ReferentialLineDecorator,
+ context: {
+ referential: referential,
+ current_organisation: current_organisation
+ }
+ )
format.json {
render :json => { :lines_count => resource.lines.count,