diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/line_referentials_controller.rb | 6 | ||||
| -rw-r--r-- | app/controllers/stop_area_referentials_controller.rb | 7 | ||||
| -rw-r--r-- | app/decorators/line_referential_decorator.rb | 13 | ||||
| -rw-r--r-- | app/decorators/stop_area_referential_decorator.rb | 13 | ||||
| -rw-r--r-- | app/views/line_referentials/show.html.slim | 4 | ||||
| -rw-r--r-- | app/views/stop_area_referentials/show.html.slim | 3 | 
6 files changed, 40 insertions, 6 deletions
| diff --git a/app/controllers/line_referentials_controller.rb b/app/controllers/line_referentials_controller.rb index 03dab3f8f..e661fbb04 100644 --- a/app/controllers/line_referentials_controller.rb +++ b/app/controllers/line_referentials_controller.rb @@ -2,6 +2,12 @@ class LineReferentialsController < ChouetteController    defaults :resource_class => LineReferential +  def show +    show! do +      @line_referential = LineReferentialDecorator.decorate(@line_referential) +    end +  end +    def sync      authorize resource, :synchronize?      @sync = resource.line_referential_syncs.build diff --git a/app/controllers/stop_area_referentials_controller.rb b/app/controllers/stop_area_referentials_controller.rb index f2d375e49..0e6a54b49 100644 --- a/app/controllers/stop_area_referentials_controller.rb +++ b/app/controllers/stop_area_referentials_controller.rb @@ -1,6 +1,13 @@  class StopAreaReferentialsController < ChouetteController    defaults :resource_class => StopAreaReferential + +  def show +    show! do +      @stop_area_referential = StopAreaReferentialDecorator.decorate(@stop_area_referential) +    end +  end +    def sync      authorize resource, :synchronize?      @sync = resource.stop_area_referential_syncs.build diff --git a/app/decorators/line_referential_decorator.rb b/app/decorators/line_referential_decorator.rb new file mode 100644 index 000000000..1ca0312c3 --- /dev/null +++ b/app/decorators/line_referential_decorator.rb @@ -0,0 +1,13 @@ +class LineReferentialDecorator < AF83::Decorator +  decorates LineReferential + +  with_instance_decorator do |instance_decorator| + +    instance_decorator.action_link policy: :synchronize, primary: :show do |l| +      l.content t('actions.sync') +      l.href { h. sync_line_referential_path(object.id) } +      l.method :post +    end +     +  end +end diff --git a/app/decorators/stop_area_referential_decorator.rb b/app/decorators/stop_area_referential_decorator.rb new file mode 100644 index 000000000..d30501ec9 --- /dev/null +++ b/app/decorators/stop_area_referential_decorator.rb @@ -0,0 +1,13 @@ +class StopAreaReferentialDecorator < AF83::Decorator +  decorates StopAreaReferential + +  with_instance_decorator do |instance_decorator| + +    instance_decorator.action_link policy: :synchronize, primary: :show do |l| +      l.content t('actions.sync') +      l.href { h. sync_stop_area_referential_path(object.id) } +      l.method :post +    end +     +  end +end diff --git a/app/views/line_referentials/show.html.slim b/app/views/line_referentials/show.html.slim index 8db94609a..1f184b6f2 100644 --- a/app/views/line_referentials/show.html.slim +++ b/app/views/line_referentials/show.html.slim @@ -1,7 +1,5 @@  - breadcrumb :line_referential, @line_referential -- if policy(@line_referential).synchronize? -  - content_for :page_header_actions do -    = link_to(t('actions.sync'), sync_line_referential_path(@line_referential), method: :post, class: 'btn btn-default') +- page_header_content_for @line_referential  .page_content    .container-fluid diff --git a/app/views/stop_area_referentials/show.html.slim b/app/views/stop_area_referentials/show.html.slim index 9e6925e2c..bca89a0f4 100644 --- a/app/views/stop_area_referentials/show.html.slim +++ b/app/views/stop_area_referentials/show.html.slim @@ -1,8 +1,5 @@  - breadcrumb :stop_area_referential, @stop_area_referential  - page_header_content_for @stop_area_referential -- if policy(@stop_area_referential).synchronize? -  - content_for :page_header_actions do -    = link_to(t('actions.sync'), sync_stop_area_referential_path(@stop_area_referential), method: :post, class: 'btn btn-default')  .page_content    .container-fluid | 
