diff options
| author | Teddy Wing | 2017-06-19 15:58:02 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-06-19 17:42:03 +0200 |
| commit | 6f1fa09dd12979933bef8bb97cdc6ae4ff10a9f0 (patch) | |
| tree | 42f2862c28db3f5f2f3131200986dc51ff87274d | |
| parent | 3a9dbe0db981536ea7c138915e423ac009235c60 (diff) | |
| download | chouette-core-6f1fa09dd12979933bef8bb97cdc6ae4ff10a9f0.tar.bz2 | |
RoutingConstraintZones#show: Render header links from #action_links
Use the `RoutingConstraintZonesDecorator` to render the header links
instead of constructing them in the view. This allows us to reuse the
links.
To be honest, I haven't actually tested this for real. Don't know how to
set up an Interdiction de Traffic Local.
Refs #3479
| -rw-r--r-- | app/controllers/routing_constraint_zones_controller.rb | 4 | ||||
| -rw-r--r-- | app/views/routing_constraint_zones/show.html.slim | 13 |
2 files changed, 10 insertions, 7 deletions
diff --git a/app/controllers/routing_constraint_zones_controller.rb b/app/controllers/routing_constraint_zones_controller.rb index 7707427b0..9d2fd712c 100644 --- a/app/controllers/routing_constraint_zones_controller.rb +++ b/app/controllers/routing_constraint_zones_controller.rb @@ -16,6 +16,10 @@ class RoutingConstraintZonesController < ChouetteController def show @routing_constraint_zone = collection.find(params[:id]) + @routing_constraint_zone = @routing_constraint_zone.decorate(context: { + referential: @referential, + line: @line + }) end protected diff --git a/app/views/routing_constraint_zones/show.html.slim b/app/views/routing_constraint_zones/show.html.slim index f0c244387..1dad4f561 100644 --- a/app/views/routing_constraint_zones/show.html.slim +++ b/app/views/routing_constraint_zones/show.html.slim @@ -7,13 +7,12 @@ / Below is secundary actions & optional contents .row .col-lg-12.text-right.mb-sm - - if policy(@routing_constraint_zone).update? - = link_to t('actions.edit'), edit_referential_line_routing_constraint_zone_path(@referential, @line, @routing_constraint_zone), class: 'btn btn-primary' - - - if policy(@routing_constraint_zone).destroy? - = link_to referential_line_routing_constraint_zone_path(@referential, @line, @routing_constraint_zone), method: :delete, data: {confirm: t('routing_constraint_zones.actions.destroy_confirm')}, class: 'btn btn-primary' do - span.fa.fa-trash - span = t('actions.destroy') + - @routing_constraint_zone.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 |
