diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/routes_controller.rb | 5 | ||||
| -rw-r--r-- | app/decorators/stop_point_decorator.rb | 34 | ||||
| -rw-r--r-- | app/views/referential_stop_areas/show.html.slim | 9 | ||||
| -rw-r--r-- | app/views/routes/show.html.slim | 4 |
4 files changed, 33 insertions, 19 deletions
diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb index 79f49143a..af5a9a91b 100644 --- a/app/controllers/routes_controller.rb +++ b/app/controllers/routes_controller.rb @@ -47,10 +47,7 @@ class RoutesController < ChouetteController line: @line }) - @route_sp = ModelDecorator.decorate( - @route_sp, - with: StopPointDecorator - ) + @route_sp = StopPointDecorator.decorate(@route_sp) end end diff --git a/app/decorators/stop_point_decorator.rb b/app/decorators/stop_point_decorator.rb index 27e1a7058..e777e2b56 100644 --- a/app/decorators/stop_point_decorator.rb +++ b/app/decorators/stop_point_decorator.rb @@ -1,9 +1,35 @@ -class StopPointDecorator < StopAreaDecorator +class StopPointDecorator < AF83::Decorator decorates Chouette::StopPoint - delegate_all + with_instance_decorator do |instance_decorator| + instance_decorator.show_action_link do |l| + l.href do + h.referential_stop_area_path( + object.referential, + object.stop_area + ) + end + end - def action_links - common_action_links(object.stop_area).flatten + instance_decorator.edit_action_link do |l| + l.content h.t('stop_points.actions.edit') + l.href do + h.edit_stop_area_referential_stop_area_path( + object.stop_area.stop_area_referential, + object.stop_area + ) + end + end + + instance_decorator.destroy_action_link do |l| + l.content h.destroy_link_content('stop_points.actions.destroy') + l.href do + h.referential_stop_area_path( + object.referential, + object.stop_area + ) + end + l.data confirm: h.t('stop_points.actions.destroy_confirm') + end end end diff --git a/app/views/referential_stop_areas/show.html.slim b/app/views/referential_stop_areas/show.html.slim index 0470b4654..cb04ab7a6 100644 --- a/app/views/referential_stop_areas/show.html.slim +++ b/app/views/referential_stop_areas/show.html.slim @@ -1,14 +1,5 @@ - breadcrumb :referential_stop_area, @referential, @stop_area - page_header_content_for @stop_area -- content_for :page_header_content do - .row - .col-lg-12.text-right.mb-sm - - @stop_area.action_links.each do |link| - = link_to link.href, - method: link.method, - data: link.data, - class: 'btn btn-primary' do - = link.content .page_content .container-fluid diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim index 4d5963cd1..375d7c57b 100644 --- a/app/views/routes/show.html.slim +++ b/app/views/routes/show.html.slim @@ -54,9 +54,9 @@ attribute: Proc.new { |s| t("stop_points.stop_point.for_alighting.#{s.for_alighting}") } \ ) \ ], - links: [:show], sortable: false, - cls: 'table has-stoppoints' + cls: 'table has-stoppoints', + action: :index - else = replacement_msg t('stop_areas.search_no_results') |
