From df184535c36359921fd5aabfb4c5c3e98c91017d Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 10 Jul 2017 11:48:23 +0200 Subject: 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 --- app/controllers/referentials_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/controllers') 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, -- cgit v1.2.3