diff options
| author | Teddy Wing | 2017-06-19 17:28:27 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-06-19 17:42:05 +0200 | 
| commit | 4e81e22aff65221316c1528a3f2fa82272345c65 (patch) | |
| tree | 43ee11f3325e27a3f4457fbf8f4fa0e4f7f2dc34 | |
| parent | 7fe8b7d100e92060a14f7c7bc32a097947dd860e (diff) | |
| download | chouette-core-4e81e22aff65221316c1528a3f2fa82272345c65.tar.bz2 | |
Calendars#show: Use #action_links to render header buttons
To abstract the links and make them reusable in other contexts, render
the buttons in the header from `CalendarDecorator#action_links`.
Refs #3479
| -rw-r--r-- | app/controllers/calendars_controller.rb | 4 | ||||
| -rw-r--r-- | app/views/calendars/show.html.slim | 10 | 
2 files changed, 10 insertions, 4 deletions
| diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index 86d567882..432e528f0 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -5,6 +5,10 @@ class CalendarsController < BreadcrumbController    respond_to :html    respond_to :js, only: :index +  def show +    @calendar = @calendar.decorate +  end +    private    def calendar_params      permitted_params = [:id, :name, :short_name, periods_attributes: [:id, :begin, :end, :_destroy], date_values_attributes: [:id, :value, :_destroy]] diff --git a/app/views/calendars/show.html.slim b/app/views/calendars/show.html.slim index 3886cefaa..26248cea8 100644 --- a/app/views/calendars/show.html.slim +++ b/app/views/calendars/show.html.slim @@ -8,10 +8,12 @@    / Below is secondary actions & optional contents (filters, ...)    .row.mb-sm      .col-lg-12.text-right -      - if policy(@calendar).destroy? -        = link_to calendar_path(@calendar), method: :delete, data: { confirm: t('calendars.actions.destroy_confirm') }, class: 'btn btn-primary' do -          span.fa.fa-trash -          span = t('actions.destroy') +      - @calendar.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 | 
