diff options
| author | Teddy Wing | 2017-07-10 11:59:55 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-07-12 11:11:14 +0200 |
| commit | 6920db47172cb5b55f6bdeccb575821cbf3a9f10 (patch) | |
| tree | 976291a1ddbf4b70e5b819c46a0e41c9d165e09a | |
| parent | df184535c36359921fd5aabfb4c5c3e98c91017d (diff) | |
| download | chouette-core-6920db47172cb5b55f6bdeccb575821cbf3a9f10.tar.bz2 | |
ReferentialLines#show: Render links from ReferentialLineDecorator
Leverage our newly created `ReferentialLineDecorator` to render the
header links, allowing us to use them both here and in the table of
lines on the Referentials#show page.
Used the extended decoration syntax to allow us to specify the
`ReferentialLineDecorator`, otherwise Draper will infer `LineDecorator`,
which is not what we want in this case.
Refs #3479
| -rw-r--r-- | app/controllers/referential_lines_controller.rb | 8 | ||||
| -rw-r--r-- | app/views/referential_lines/show.html.slim | 21 |
2 files changed, 14 insertions, 15 deletions
diff --git a/app/controllers/referential_lines_controller.rb b/app/controllers/referential_lines_controller.rb index fe81bee12..1da64991d 100644 --- a/app/controllers/referential_lines_controller.rb +++ b/app/controllers/referential_lines_controller.rb @@ -37,6 +37,14 @@ class ReferentialLinesController < ChouetteController ) show! do + @line = ReferentialLineDecorator.decorate( + @line, + context: { + referential: referential, + current_organisation: current_organisation + } + ) + build_breadcrumb :show end end diff --git a/app/views/referential_lines/show.html.slim b/app/views/referential_lines/show.html.slim index 14e300aa2..34c296932 100644 --- a/app/views/referential_lines/show.html.slim +++ b/app/views/referential_lines/show.html.slim @@ -7,21 +7,12 @@ / Below is secundary actions & optional contents .row .col-lg-12.text-right.mb-sm - = link_to @line.human_attribute_name(:footnotes), referential_line_footnotes_path(@referential, @line), class: 'btn btn-primary' - = link_to t('routing_constraint_zones.index.title'), referential_line_routing_constraint_zones_path(@referential, @line), class: 'btn btn-primary' - - - if policy(Chouette::Line).create? && @referential.organisation == current_organisation - = link_to t('actions.new'), new_referential_line_path(@referential), class: 'btn btn-primary' - - if policy(@line).update? - = link_to t('actions.edit'), edit_referential_line_path(@referential, @line), class: 'btn btn-primary' - - if policy(@line).destroy? - = link_to referential_line_path(@referential, @line), method: :delete, data: {confirm: t('lines.actions.destroy_confirm')}, class: 'btn btn-primary' do - span.fa.fa-trash - span = t('actions.destroy') - - - if !@line.hub_restricted? || (@line.hub_restricted? && @line.routes.size < 2) - - if policy(Chouette::Route).create? && @referential.organisation == current_organisation - = link_to t('routes.actions.new'), new_referential_line_route_path(@referential, @line), class: 'btn btn-primary' + - @line.action_links.each do |link| + = link_to link.href, + method: link.method, + data: link.data, + class: 'btn btn-primary' do + = link.content / PageContent .page_content |
