diff options
| author | Xinhui | 2017-11-24 13:01:00 +0100 | 
|---|---|---|
| committer | Xinhui | 2017-11-28 12:23:35 +0100 | 
| commit | 529399a52ed3f19a78cf843c22ead0202c813820 (patch) | |
| tree | f3606dd3ed76d29a3094b4aad7f86c155be9e3a4 | |
| parent | dbe89b80c55f87e5423030370416be97097c8caa (diff) | |
| download | chouette-core-529399a52ed3f19a78cf843c22ead0202c813820.tar.bz2 | |
Refactoring pageheader
60 files changed, 122 insertions, 248 deletions
| diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0a7b0fb75..eec7dda4f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,6 +2,31 @@ module ApplicationHelper    include NewapplicationHelper +  def page_header_title(object) +    # Unwrap from decorator, we want to know the object model name +    object = object.object if object.try(:object) +    local  = "#{object.model_name.name.underscore.pluralize}.#{params[:action]}.title" +    if object.try(:name) +      t(local, name: object.name) +    else +      t(local) +    end +  end + +  def page_header_meta(object) +    info = t('last_update', time: l(object.updated_at, format: :short)).html_safe +    if object.try(:versions) && object.versions.last +      author = object.versions.last.try(:whodunnit) +      info   = "#{info} #{t('whodunnit', author: author)}" if author +    end +    content_tag :div, info, class: 'small' +  end + +  def page_header_content_for(object) +    content_for :page_header_title, page_header_title(object) +    content_for :page_header_meta, page_header_meta(object) +  end +    def font_awesome_classic_tag(name)      name = "fa-file-text-o" if name == "fa-file-csv-o"      name = "fa-file-code-o" if name == "fa-file-xml-o" diff --git a/app/views/calendars/edit.html.slim b/app/views/calendars/edit.html.slim index 79009725e..e806fc94b 100644 --- a/app/views/calendars/edit.html.slim +++ b/app/views/calendars/edit.html.slim @@ -1,7 +1,5 @@  - breadcrumb :calendar, @calendar -= render partial: 'layouts/navigation/page_header', locals: {object: @calendar} - -/ PageContent +- page_header_content_for @calendar  .page_content    .container-fluid      .row diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim index a80deb5e7..77478a624 100644 --- a/app/views/calendars/index.html.slim +++ b/app/views/calendars/index.html.slim @@ -3,8 +3,6 @@    - if policy(Calendar).create?      = link_to(t('actions.add'), new_calendar_path, class: 'btn btn-default') -= render partial: 'layouts/navigation/page_header' -  .page_content    .container-fluid      - if params[:q].present? or @calendars.any? diff --git a/app/views/calendars/new.html.slim b/app/views/calendars/new.html.slim index 6daf61136..ce8b6a036 100644 --- a/app/views/calendars/new.html.slim +++ b/app/views/calendars/new.html.slim @@ -1,6 +1,4 @@  - breadcrumb :calendars -= render partial: 'layouts/navigation/page_header' -  .page_content    .container-fluid      .row diff --git a/app/views/calendars/show.html.slim b/app/views/calendars/show.html.slim index bdc69c21c..da4afa3e6 100644 --- a/app/views/calendars/show.html.slim +++ b/app/views/calendars/show.html.slim @@ -1,8 +1,5 @@  - breadcrumb :calendar, @calendar -- content_for :page_header_actions do -  - if policy(@calendar).edit? -    = link_to(t('actions.edit'), edit_calendar_path(@calendar), class: 'btn btn-default') - +- page_header_content_for @calendar  - content_for :page_header_content do    .row.mb-sm      .col-lg-12.text-right @@ -12,8 +9,9 @@              data: link.data,              class: 'btn btn-primary' do                = link.content - -= render partial: 'layouts/navigation/page_header', locals: {object: @calendar} +- if policy(@calendar).edit? +  - content_for :page_header_actions do +      = link_to(t('actions.edit'), edit_calendar_path(@calendar), class: 'btn btn-default')  .page_content    .container-fluid diff --git a/app/views/compliance_check_sets/executed.html.slim b/app/views/compliance_check_sets/executed.html.slim index bba8d4a2b..da8a2a3de 100644 --- a/app/views/compliance_check_sets/executed.html.slim +++ b/app/views/compliance_check_sets/executed.html.slim @@ -1,6 +1,5 @@  - breadcrumb :compliance_check_set, @workbench, @compliance_check_set - -= render partial: 'layouts/navigation/page_header', locals: {object: @compliance_check_set} +- page_header_content_for @compliance_check_set  .page_content    .container-fluid diff --git a/app/views/compliance_check_sets/index.html.slim b/app/views/compliance_check_sets/index.html.slim index f086fd52d..b02b1c89f 100644 --- a/app/views/compliance_check_sets/index.html.slim +++ b/app/views/compliance_check_sets/index.html.slim @@ -1,8 +1,5 @@  - breadcrumb :compliance_check_sets, @workbench -= render partial: 'layouts/navigation/page_header' - -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/compliance_control_sets/edit.html.slim b/app/views/compliance_control_sets/edit.html.slim index 94bce23ac..fd68f0abb 100644 --- a/app/views/compliance_control_sets/edit.html.slim +++ b/app/views/compliance_control_sets/edit.html.slim @@ -1,5 +1,6 @@  - breadcrumb :compliance_control_set, @compliance_control_set -= render partial: 'layouts/navigation/page_header', locals: {object: @compliance_control_set} +- page_header_content_for @compliance_control_set +  .page_content    .container-fluid      .row diff --git a/app/views/compliance_control_sets/index.html.slim b/app/views/compliance_control_sets/index.html.slim index c59621c93..2a5651280 100644 --- a/app/views/compliance_control_sets/index.html.slim +++ b/app/views/compliance_control_sets/index.html.slim @@ -3,8 +3,6 @@    - if policy(ComplianceControlSet).create?      = link_to(t('compliance_control_sets.actions.new'), new_compliance_control_set_path, class: 'btn btn-default') -= render partial: 'layouts/navigation/page_header' -  .page_content    .container-fluid      .row diff --git a/app/views/compliance_control_sets/new.html.slim b/app/views/compliance_control_sets/new.html.slim index b01f410d8..ada0de5bf 100644 --- a/app/views/compliance_control_sets/new.html.slim +++ b/app/views/compliance_control_sets/new.html.slim @@ -1,8 +1,5 @@  - breadcrumb :compliance_control_sets -= render partial: 'layouts/navigation/page_header' - -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/compliance_control_sets/show.html.slim b/app/views/compliance_control_sets/show.html.slim index f93b9410f..2291eda06 100644 --- a/app/views/compliance_control_sets/show.html.slim +++ b/app/views/compliance_control_sets/show.html.slim @@ -1,4 +1,5 @@  - breadcrumb :compliance_control_set, @compliance_control_set +- page_header_content_for @compliance_control_set  - content_for :page_header_content do    .row.mb-sm      .col-lg-12.text-right @@ -12,9 +13,6 @@                class: 'btn btn-primary' do              = link.content -= render partial: 'layouts/navigation/page_header', locals: {object: @compliance_control_set} - -  .page_content    .container-fluid      .row diff --git a/app/views/dashboards/show.html.slim b/app/views/dashboards/show.html.slim index 55845a5fe..8df880f89 100644 --- a/app/views/dashboards/show.html.slim +++ b/app/views/dashboards/show.html.slim @@ -6,7 +6,6 @@       - if policy(Api::V1::ApiKey).create?         = link_to t('actions.create_api_key'), new_api_key_path, class: 'btn btn-primary' -= render partial: 'layouts/navigation/page_header'  .page_content    .container-fluid      = render partial: @dashboard diff --git a/app/views/errors/forbidden.html.slim b/app/views/errors/forbidden.html.slim index 4ca3a6dbf..23ea67eff 100644 --- a/app/views/errors/forbidden.html.slim +++ b/app/views/errors/forbidden.html.slim @@ -1,7 +1,4 @@ -/ PageHeader -= pageheader 'bug', -             'Erreur 403', -             '' +- content_for :page_header_title, 'Erreur 403'  .page_content    .container-fluid diff --git a/app/views/errors/not_found.html.slim b/app/views/errors/not_found.html.slim index 6348ea1be..8821e9ec3 100644 --- a/app/views/errors/not_found.html.slim +++ b/app/views/errors/not_found.html.slim @@ -1,7 +1,4 @@ -/ PageHeader -= pageheader 'bug', -             'Erreur 404', -             '' +- content_for :page_header_title, 'Erreur 404'  .page_content    .container-fluid @@ -11,11 +8,11 @@            - if I18n.locale == :fr              p                strong = "Désolé, la page demandée n'existe pas." -             +              p = "Vous pouvez néanmoins continuer à utiliser l'application IBOO." -               +            - else              p                strong = "The page you were looking for doesn't exist." -             +              p = "You can still continue the use the IBOO application. Thank you for understanding." diff --git a/app/views/errors/server_error.html.slim b/app/views/errors/server_error.html.slim index 09884dc29..189a48760 100644 --- a/app/views/errors/server_error.html.slim +++ b/app/views/errors/server_error.html.slim @@ -1,7 +1,4 @@ -/ PageHeader -= pageheader 'bug', -             'Erreur serveur', -             '' +- content_for :page_header_title, 'Erreur serveur'  .page_content    .container-fluid @@ -11,11 +8,11 @@            - if I18n.locale == :fr              p                strong = "Désolé, une erreur est survenue." -             +              p = "Vous pouvez néanmoins continuer à utiliser l'application IBOO." -               +            - else              p                strong = "We're sorry, but something went wrong." -             +              p = "You can still continue the use the IBOO application. Thank you for understanding." diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 8c731007d..567e14ef0 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -17,6 +17,7 @@ html lang=I18n.locale    body      = render 'layouts/navigation/main_nav'      = render 'layouts/flash_messages', flash: flash +    = render 'layouts/navigation/page_header'      = yield      #sidebar        = yield :sidebar diff --git a/app/views/layouts/navigation/_page_header.html.slim b/app/views/layouts/navigation/_page_header.html.slim index 6d22dcf26..2548ddd81 100644 --- a/app/views/layouts/navigation/_page_header.html.slim +++ b/app/views/layouts/navigation/_page_header.html.slim @@ -2,25 +2,23 @@ div.page_header    div.container-fluid      div.row        div.col-lg-9.col-md-8.col-sm-7.col-xs-7 -        div.page-icon -          span.sb class="sb-#{resource_class.model_name.name.underscore}" +        - if defined?(resource_class) +          div.page-icon +            span.sb class="sb-#{resource_class.model_name.name.underscore}"          div.page-title            - if content_for? :page_header_title              h1 = yield :page_header_title -          - elsif defined?(object) -            h1 = t("#{resource_class.model_name.name.underscore.pluralize}.#{params[:action]}.title", name: object.name) -          - else +          - elsif defined?(resource_class)              h1 = t("#{resource_class.model_name.name.underscore.pluralize}.#{params[:action]}.title")        div.col-lg-3.col-md-4.col-sm-5.col-xs-5.text-right -        div.page-action -          - if defined?(object) -            div.small = t('last_update', time: l(object.updated_at, format: :short)).html_safe -            - if object.try(:versions) -              div.small = t('whodunnit', author: object.versions.last.whodunnit) +        div.page-meta +        - if content_for? :page_header_meta +          div.small = yield :page_header_meta -          - if content_for? :page_header_actions -            div.small = yield :page_header_actions +        div.page-action +        - if content_for? :page_header_actions +          div.small = yield :page_header_actions      - if content_for? :page_header_content        = yield :page_header_content diff --git a/app/views/line_referentials/edit.html.slim b/app/views/line_referentials/edit.html.slim index 820b788e5..374d34ed3 100644 --- a/app/views/line_referentials/edit.html.slim +++ b/app/views/line_referentials/edit.html.slim @@ -1,3 +1,2 @@ -= title_tag t('line_referentials.edit.title', line_referential: @line_referential.name) - -= render 'form'
\ No newline at end of file +- page_header_content_for @line_referential += render 'form' diff --git a/app/views/line_referentials/show.html.slim b/app/views/line_referentials/show.html.slim index 9e25a202d..b4b32bc52 100644 --- a/app/views/line_referentials/show.html.slim +++ b/app/views/line_referentials/show.html.slim @@ -1,4 +1,5 @@  - breadcrumb :line_referential, @line_referential +- page_header_content_for @line_referential  - content_for :page_header_actions do    = link_to(t('actions.sync'), sync_line_referential_path(@line_referential), method: :post, class: 'btn btn-default') @@ -15,8 +16,6 @@          = Referential.human_attribute_name(:lines)          em.small = " (#{@line_referential.lines.size})" -= render partial: 'layouts/navigation/page_header', locals: {object: @line_referential} -  .page_content    .container-fluid      .row diff --git a/app/views/networks/edit.html.slim b/app/views/networks/edit.html.slim index ad9f61347..0a396361f 100644 --- a/app/views/networks/edit.html.slim +++ b/app/views/networks/edit.html.slim @@ -1,4 +1,3 @@  - breadcrumb :network, @network -= render partial: 'layouts/navigation/page_header', locals: {object: @network} - +- page_header_content_for @network  = render 'form' diff --git a/app/views/networks/index.html.slim b/app/views/networks/index.html.slim index ce3a10710..3a804bad0 100644 --- a/app/views/networks/index.html.slim +++ b/app/views/networks/index.html.slim @@ -3,8 +3,6 @@    - if policy(Chouette::Network).create?      = link_to(t('networks.actions.new'), new_line_referential_network_path(@line_referential), class: 'btn btn-primary') -= render partial: 'layouts/navigation/page_header' -  .page_content    .container-fluid      - if params[:q].present? or @networks.any? diff --git a/app/views/networks/new.html.slim b/app/views/networks/new.html.slim index 0461a3d8c..de5dd9121 100644 --- a/app/views/networks/new.html.slim +++ b/app/views/networks/new.html.slim @@ -1,3 +1,2 @@  - breadcrumb :networks, @line_referential -= render partial: 'layouts/navigation/page_header'  = render 'form' diff --git a/app/views/networks/show.html.slim b/app/views/networks/show.html.slim index 54f5e537e..f7d40a049 100644 --- a/app/views/networks/show.html.slim +++ b/app/views/networks/show.html.slim @@ -1,4 +1,5 @@  - breadcrumb :network, @network +- page_header_content_for @network  - content_for :page_header_content do    .row      .col-lg-12.text-right.mb-sm @@ -8,9 +9,6 @@              data: link.data,              class: 'btn btn-primary' do                = link.content - -= render partial: 'layouts/navigation/page_header', locals: {object: @network} -  .page_content    .container-fluid      .row diff --git a/app/views/referential_networks/edit.html.slim b/app/views/referential_networks/edit.html.slim index dded4b176..a77d2db34 100644 --- a/app/views/referential_networks/edit.html.slim +++ b/app/views/referential_networks/edit.html.slim @@ -1,4 +1,3 @@  - breadcrumb :referential_network, @referential, @network -= title_tag t('networks.edit.title', network: @network.name) - +- page_header_content_for @network  = render 'form' diff --git a/app/views/referential_networks/index.html.slim b/app/views/referential_networks/index.html.slim index 6a2df6d16..d556e7e5e 100644 --- a/app/views/referential_networks/index.html.slim +++ b/app/views/referential_networks/index.html.slim @@ -1,12 +1,8 @@  - breadcrumb :referential_networks, @referential -/ PageHeader -= pageheader 'reseau', -             t('networks.index.title'), -             'Lorem ipsum dolor sit amet', -             '', -             (policy(Chouette::Network).create? ? link_to(t('networks.actions.new'), new_referential_network_path(@referential), class: 'btn btn-default') : '') +- if policy(Chouette::Network).create? +  - content_for :page_header_actions do +      = link_to(t('networks.actions.new'), new_referential_network_path(@referential), class: 'btn btn-default') -/PageContent  .page_content    .container-fluid      - if params[:q].present? or @networks.any? diff --git a/app/views/referential_networks/new.html.slim b/app/views/referential_networks/new.html.slim index 4a737d9f7..9c2020eb3 100644 --- a/app/views/referential_networks/new.html.slim +++ b/app/views/referential_networks/new.html.slim @@ -1,5 +1,2 @@  - breadcrumb :referential_networks, @referential - -= title_tag t('networks.new.title') -  = render 'form' diff --git a/app/views/referential_networks/show.html.slim b/app/views/referential_networks/show.html.slim index c2cc79e0d..7de304671 100644 --- a/app/views/referential_networks/show.html.slim +++ b/app/views/referential_networks/show.html.slim @@ -1,11 +1,6 @@  - breadcrumb :referential_network, @referential, @network -/ PageHeader -= pageheader 'reseau', -             @network.name, -             'Lorem ipsum dolor sit amet', -             t('last_update', time: l(@network.updated_at, format: :short)) do - -  / Below is secundary actions & optional contents (filters, ...) +- page_header_content_for @network +- content_for :page_header_content do    .row      .col-lg-12.text-right.mb-sm        - @network.action_links.each do |link| diff --git a/app/views/referential_stop_areas/edit.html.slim b/app/views/referential_stop_areas/edit.html.slim index fc7220095..d88230b58 100644 --- a/app/views/referential_stop_areas/edit.html.slim +++ b/app/views/referential_stop_areas/edit.html.slim @@ -1,4 +1,3 @@  - breadcrumb :referential_stop_area, @referential, @stop_area -= title_tag t('stop_areas.edit.title', stop_area: @stop_area.name) - +- page_header_content_for @stop_area  = render 'form' diff --git a/app/views/referential_stop_areas/index.html.slim b/app/views/referential_stop_areas/index.html.slim index 718cbb472..ad04fb02e 100644 --- a/app/views/referential_stop_areas/index.html.slim +++ b/app/views/referential_stop_areas/index.html.slim @@ -1,5 +1,4 @@  - breadcrumb :referential_stop_areas, @referential -= title_tag t('stop_areas.index.title')  = search_form_for @q, :url => referential_stop_areas_path(@referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f|    .panel.panel-default diff --git a/app/views/referential_stop_areas/new.html.slim b/app/views/referential_stop_areas/new.html.slim index 87ba9b657..9342b673b 100644 --- a/app/views/referential_stop_areas/new.html.slim +++ b/app/views/referential_stop_areas/new.html.slim @@ -1,4 +1,2 @@  - breadcrumb :referential_stop_areas, @referential -= title_tag  t('stop_areas.new.title') -  = render 'form' diff --git a/app/views/referential_stop_areas/show.html.slim b/app/views/referential_stop_areas/show.html.slim index 7cc078ee0..0470b4654 100644 --- a/app/views/referential_stop_areas/show.html.slim +++ b/app/views/referential_stop_areas/show.html.slim @@ -1,9 +1,6 @@  - breadcrumb :referential_stop_area, @referential, @stop_area -/ PageHeader -= pageheader 'arret', -             @stop_area.name, -             'Lorem ipsum dolor sit amet' - +- 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| @@ -13,7 +10,6 @@              class: 'btn btn-primary' do                = link.content -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/referentials/edit.html.slim b/app/views/referentials/edit.html.slim index 1fac626e6..904dc5439 100644 --- a/app/views/referentials/edit.html.slim +++ b/app/views/referentials/edit.html.slim @@ -1,10 +1,6 @@ -/ PageHeader -= pageheader 'jeux-de-donnees', -             t('.title'), -             '', -             t('last_update', time: l(@referential.updated_at, format: :short)) +- breadcrumb @referential +- page_header_content_for @referential -/ PageContent  .page_content   .container-fluid     .row diff --git a/app/views/referentials/new.html.slim b/app/views/referentials/new.html.slim index f4a7e4707..2bed9f912 100644 --- a/app/views/referentials/new.html.slim +++ b/app/views/referentials/new.html.slim @@ -1,12 +1,3 @@ -/ PageHeader -- if @referential.created_from.present? -  = pageheader 'jeux-de-donnees', -               t('.duplicated.title') -- else -  = pageheader 'jeux-de-donnees', -               t('.title') - -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/referentials/select_compliance_control_set.html.slim b/app/views/referentials/select_compliance_control_set.html.slim index 2d3f2344c..87a888c0a 100644 --- a/app/views/referentials/select_compliance_control_set.html.slim +++ b/app/views/referentials/select_compliance_control_set.html.slim @@ -1,10 +1,3 @@ -/ PageHeader -- header_params = ['jeux-de-controle', -        t('referentials.select_compliance_control_set.title'), -        ''] -= pageheader(*header_params) do - -/ PageContent  .page_content    .container-fluid      .row @@ -17,4 +10,4 @@                  .col-sm-8.col-xs-7                    = select_tag :compliance_control_set, options_from_collection_for_select(@compliance_control_sets, "id", "name"), class: 'select optional form-control'                .separator -        = button_tag t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'select_compliance_control_set'
\ No newline at end of file +        = button_tag t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'select_compliance_control_set' diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim index 0abeb0669..9852fb0a3 100644 --- a/app/views/referentials/show.html.slim +++ b/app/views/referentials/show.html.slim @@ -1,12 +1,10 @@  - breadcrumb @referential -/ PageHeader -= pageheader 'jeux-de-donnees', -             @referential.name, -             'Lorem ipsum dolor sit amet', -             t('last_update', time: l(@referential.updated_at, format: :short)), -             ((@referential.archived? || !policy(@referential).edit?) ? '' : link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default')) do +- page_header_content_for @referential +- content_for :page_header_actions do +  - unless (@referential.archived? || !policy(@referential).edit?) +    = link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default') -  / Below is secondary actions & optional contents (filters, ...) +- content_for :page_header_content do    .row.mb-sm      .col-lg-12.text-right        - @referential.action_links.each do |link| @@ -19,7 +17,6 @@                class: 'btn btn-primary' do                  = link.content -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/routes/edit.html.slim b/app/views/routes/edit.html.slim index a69c5aeff..78f9a2e85 100644 --- a/app/views/routes/edit.html.slim +++ b/app/views/routes/edit.html.slim @@ -1,11 +1,6 @@  - breadcrumb :route, @referential, @route -/ PageHeader -= pageheader 'itineraire', -             @route.name, -             'Lorem ipsum dolor sit amet', -             t('last_update', time: l(@route.updated_at, format: :short)) +- page_header_content_for @route -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/routes/new.html.slim b/app/views/routes/new.html.slim index 3a8ceb963..9d5ca2e23 100644 --- a/app/views/routes/new.html.slim +++ b/app/views/routes/new.html.slim @@ -1,10 +1,4 @@  - breadcrumb :referential_line, @referential, @line -/ PageHeader -= pageheader 'itineraire', -             t('routes.new.title'), -             '' - -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim index 734d6ebf3..3adf3e2f6 100644 --- a/app/views/routes/show.html.slim +++ b/app/views/routes/show.html.slim @@ -1,12 +1,10 @@  - breadcrumb :route, @referential, @route -/ PageHeader -= pageheader 'itineraire', -        t('routes.index.title', route: @route.name), -             '', -             t('last_update', time: l(@route.updated_at, format: :short)), -             (policy(@route).edit? ? link_to(t('actions.edit'), edit_referential_line_route_path(@referential, @line, @route), class: 'btn btn-default') : '') do +- page_header_content_for @route +- content_for :page_header_actions do +  - if policy(@route).edit? +    = link_to(t('actions.edit'), edit_referential_line_route_path(@referential, @line, @route), class: 'btn btn-default') -  / Below is secundary actions & optional contents (filters, ...) +- content_for :page_header_content do    .row.mb-sm      .col-lg-12.text-right        - @route.action_links.each do |link| @@ -16,7 +14,6 @@              class: 'btn btn-primary' do                = link.content -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/routing_constraint_zones/edit.html.slim b/app/views/routing_constraint_zones/edit.html.slim index c9b9b0c41..e971ee5dd 100644 --- a/app/views/routing_constraint_zones/edit.html.slim +++ b/app/views/routing_constraint_zones/edit.html.slim @@ -1,11 +1,6 @@  - breadcrumb :routing_constraint_zone, @referential, @line, @routing_constraint_zone -/ PageHeader -= pageheader 'itl', -             t('.title', routing_constraint_zone: @routing_constraint_zone.name), -             '', -             t('last_update', time: l(@routing_constraint_zone.updated_at, format: :short)) +- page_header_content_for @routing_constraint_zone -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/routing_constraint_zones/index.html.slim b/app/views/routing_constraint_zones/index.html.slim index fcf904070..7c54fca68 100644 --- a/app/views/routing_constraint_zones/index.html.slim +++ b/app/views/routing_constraint_zones/index.html.slim @@ -1,12 +1,8 @@  - breadcrumb :routing_constraint_zones, @referential, @line -/ PageHeader -= pageheader 'itl', -             t('routing_constraint_zones.index.title'), -             '', -             '', -             ((policy(Chouette::RoutingConstraintZone).create? && @referential.organisation == current_organisation) ? link_to(t('actions.new'), new_referential_line_routing_constraint_zone_path(@referential, @line), class: 'btn btn-primary') : '') +- content_for :page_header_actions do +  - if (policy(Chouette::RoutingConstraintZone).create? && @referential.organisation == current_organisation) +    = link_to(t('actions.new'), new_referential_line_routing_constraint_zone_path(@referential, @line), class: 'btn btn-primary') -/ PageContent  .page_content    .container-fluid      - if params[:q].present? or @routing_constraint_zones.any? diff --git a/app/views/routing_constraint_zones/new.html.slim b/app/views/routing_constraint_zones/new.html.slim index d15de13a4..62ecf5e95 100644 --- a/app/views/routing_constraint_zones/new.html.slim +++ b/app/views/routing_constraint_zones/new.html.slim @@ -1,9 +1,5 @@  - breadcrumb :routing_constraint_zones, @referential, @line -/ PageHeader -= pageheader 'itl', -             t('.title') -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/routing_constraint_zones/show.html.slim b/app/views/routing_constraint_zones/show.html.slim index d0c0619c3..6235ade68 100644 --- a/app/views/routing_constraint_zones/show.html.slim +++ b/app/views/routing_constraint_zones/show.html.slim @@ -1,11 +1,6 @@  - breadcrumb :routing_constraint_zone, @referential, @line, @routing_constraint_zone -/ PageHeader -= pageheader 'itl', -             @routing_constraint_zone.name, -             '', -             t('last_update', time: l(@routing_constraint_zone.updated_at, format: :short)) do - -  / Below is secundary actions & optional contents +- page_header_content_for @routing_constraint_zone +- content_for :page_header_content do    .row      .col-lg-12.text-right.mb-sm        - @routing_constraint_zone.action_links.each do |link| @@ -15,7 +10,6 @@              class: 'btn btn-primary' do                = link.content -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/stop_areas/edit.html.slim b/app/views/stop_areas/edit.html.slim index 8005f5a08..e5d864d93 100644 --- a/app/views/stop_areas/edit.html.slim +++ b/app/views/stop_areas/edit.html.slim @@ -1,4 +1,3 @@  - breadcrumb :stop_area, @stop_area_referential, @stop_area -= title_tag t('stop_areas.edit.title', stop_area: @stop_area.name ) - +- page_header_content_for @stop_area  == render 'form' diff --git a/app/views/stop_areas/index.html.slim b/app/views/stop_areas/index.html.slim index 1b28f411e..1942756cf 100644 --- a/app/views/stop_areas/index.html.slim +++ b/app/views/stop_areas/index.html.slim @@ -1,12 +1,8 @@  - breadcrumb :stop_areas, @stop_area_referential -/ PageHeader -= pageheader 'arret', -             t('stop_areas.index.title'), -             '', -             '', -             (policy(Chouette::StopArea).create? ? link_to(t('stop_areas.actions.new'), new_stop_area_referential_stop_area_path(@stop_area_referential), class: 'btn btn-primary') : '') +- content_for :page_header_actions do +  - if policy(Chouette::StopArea).create? +    = link_to(t('stop_areas.actions.new'), new_stop_area_referential_stop_area_path(@stop_area_referential), class: 'btn btn-primary') -/ PageContent  .page_content    .container-fluid      - if params[:q].present? or @stop_areas.any? diff --git a/app/views/stop_areas/new.html.slim b/app/views/stop_areas/new.html.slim index e0c5b7a61..78aa98585 100644 --- a/app/views/stop_areas/new.html.slim +++ b/app/views/stop_areas/new.html.slim @@ -1,4 +1,2 @@  - breadcrumb :stop_areas, @stop_area_referential -= title_tag t('stop_areas.new.title') -  == render 'form' diff --git a/app/views/stop_areas/select_parent.html.slim b/app/views/stop_areas/select_parent.html.slim index 1289eafef..e387e83b8 100644 --- a/app/views/stop_areas/select_parent.html.slim +++ b/app/views/stop_areas/select_parent.html.slim @@ -1,5 +1,3 @@ -= title_tag t('stop_areas.select_parent.title', stop_area: @stop_area.name ) -  = semantic_form_for [@referential, @stop_area] do |form|    div      = form.inputs do @@ -10,4 +8,4 @@        = form.action :cancel, as: :link  - content_for :sidebar do -  ul.actions
\ No newline at end of file +  ul.actions diff --git a/app/views/stop_areas/show.html.slim b/app/views/stop_areas/show.html.slim index 7f7c2e07f..af673bb25 100644 --- a/app/views/stop_areas/show.html.slim +++ b/app/views/stop_areas/show.html.slim @@ -1,9 +1,6 @@  - breadcrumb :stop_area, @stop_area_referential, @stop_area -/ PageHeader -= pageheader 'arret', -             @stop_area.name, -             'Lorem ipsum dolor sit amet' - +- 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| diff --git a/app/views/time_tables/edit.html.slim b/app/views/time_tables/edit.html.slim index a1ebb2c72..6ad572906 100644 --- a/app/views/time_tables/edit.html.slim +++ b/app/views/time_tables/edit.html.slim @@ -1,11 +1,6 @@  - breadcrumb :time_table, @referential, @time_table -/ PageHeader -= pageheader 'calendrier-application', -             @time_table.comment, -             '', -             '' +- page_header_content_for @time_table -/ PageContent  .page_content    .container-fluid      #periods diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim index edbf89c43..b684b0bcb 100644 --- a/app/views/time_tables/index.html.slim +++ b/app/views/time_tables/index.html.slim @@ -1,11 +1,8 @@  - breadcrumb :time_tables, @referential -/ PageHeader -= pageheader 'calendrier-application', -             t('time_tables.index.title'), -             '', -             ((policy(Chouette::TimeTable).create? && @referential.organisation == current_organisation) ? link_to(t('actions.add'), new_referential_time_table_path(@referential), class: 'btn btn-default') : '') +- content_for :page_header_actions do +  - if (policy(Chouette::TimeTable).create? && @referential.organisation == current_organisation) +    = link_to(t('actions.add'), new_referential_time_table_path(@referential), class: 'btn btn-default') -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/time_tables/new.html.slim b/app/views/time_tables/new.html.slim index c8c2658ba..ddb34e0b7 100644 --- a/app/views/time_tables/new.html.slim +++ b/app/views/time_tables/new.html.slim @@ -1,11 +1,4 @@  - breadcrumb :time_tables, @referential -/ PageHeader -= pageheader 'calendrier-application', -             t("time_tables.#{params[:action]}.title"), -             '', -             '' - -/ PageContent  .page_content    .container-fluid      .row diff --git a/app/views/time_tables/show.html.slim b/app/views/time_tables/show.html.slim index 85de7f8ec..8326a4d05 100644 --- a/app/views/time_tables/show.html.slim +++ b/app/views/time_tables/show.html.slim @@ -1,14 +1,12 @@  - require 'calendar_helper'  - breadcrumb :time_table, @referential, @time_table -/ PageHeader +- page_header_content_for @time_table -= pageheader 'calendrier-application', -             @time_table.comment, -             '', -             t('last_update', time: l(@time_table.updated_at, format: :short)), -             (policy(@time_table).edit? ? link_to(t('actions.edit'), edit_referential_time_table_path(@referential, @time_table), class: 'btn btn-default') : '') +- content_for :page_header_actions do +  - if policy(@time_table).edit? +    = link_to(t('actions.edit'), edit_referential_time_table_path(@referential, @time_table), class: 'btn btn-default') -  / Below is secundary actions & optional contents (filters, ...) +- content_for :page_header_content do    .row.mb-sm      .col-lg-12.text-right        - @time_table.action_links.each do |link| @@ -18,7 +16,7 @@              class: 'btn btn-primary' do                = link.content -/ PageContent +  .page_content    .container-fluid      .row diff --git a/app/views/workbenches/index.html.slim b/app/views/workbenches/index.html.slim index d35ed8121..14fc79222 100644 --- a/app/views/workbenches/index.html.slim +++ b/app/views/workbenches/index.html.slim @@ -1,8 +1,5 @@ -/ PageHeader -= pageheader 'tableau-de-bord', -             t('.title', organisation: current_organisation.name) -  / Below is secundary actions & optional contents (filters, ...) +- content_for :page_header_content do    .row.mb-sm     .col-lg-12.text-right       - if policy(Api::V1::ApiKey).create? diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim index 66eedb68d..22869b2d7 100644 --- a/app/views/workbenches/show.html.slim +++ b/app/views/workbenches/show.html.slim @@ -1,17 +1,12 @@  - breadcrumb @workbench -/ PageHeader -= pageheader 'jeux-de-donnees', -             t('referentials.index.title'), -             '', -             '' do -  / Below is secundary actions & optional contents (filters, ...) +- page_header_content_for @workbench +- content_for :page_header_content do    .row.mb-sm      .col-lg-12.text-right        - if policy(Referential).create?          = link_to t('actions.import'), workbench_imports_path(@workbench), class: 'btn btn-primary'          = link_to t('actions.add'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary' -/ PageContent  .page_content    .container-fluid      - if params[:q].present? or @wbench_refs.any? diff --git a/config/locales/line_referentials.en.yml b/config/locales/line_referentials.en.yml index c6e498b50..5663ed691 100644 --- a/config/locales/line_referentials.en.yml +++ b/config/locales/line_referentials.en.yml @@ -5,7 +5,7 @@ en:        sync: "Launch a new codifligne synchronization"        cancel_sync: "Cancel codifligne synchronization"      edit: -      title: "Edit %{line_referential} referential" +      title: "Edit %{name} referential"      show:        title: "iLICO synchronization"        synchronized: Synchronized diff --git a/config/locales/line_referentials.fr.yml b/config/locales/line_referentials.fr.yml index 1711fdf9c..630a3e170 100644 --- a/config/locales/line_referentials.fr.yml +++ b/config/locales/line_referentials.fr.yml @@ -5,7 +5,7 @@ fr:        sync: "Lancer une synchronisation Codifligne"        cancel_sync: "Annuler la synchronisation Codifligne"      edit: -      title: "Editer le référentiel %{line_referential}" +      title: "Editer le référentiel %{name}"      show:        title: 'Synchronisation iLICO'        synchronized: Synchronisé diff --git a/config/locales/routes.en.yml b/config/locales/routes.en.yml index ba4f76daa..d82ba98dd 100644 --- a/config/locales/routes.en.yml +++ b/config/locales/routes.en.yml @@ -16,7 +16,7 @@ en:      new:        title: "Add a new route"      edit: -      title: "Update route %{route}" +      title: "Update route %{name}"        select2:          placeholder: "Select a stop point..."        map: @@ -37,7 +37,7 @@ en:            normal: Normal alighting            forbidden: Forbidden alighting      show: -      title: "Route %{route}" +      title: "Route %{name}"        stop_points: "Stop point on route list"        stop_areas:          title: "Stop area list" @@ -45,7 +45,7 @@ en:        no_opposite_route: "No reversed route associated"        undefined: "Undefined"      index: -      title: "Routes %{route}" +      title: "Routes"        selection: "Selection"        selection_all: "All"      edit_boarding_alighting: diff --git a/config/locales/routes.fr.yml b/config/locales/routes.fr.yml index 3bcc33320..457345ae8 100644 --- a/config/locales/routes.fr.yml +++ b/config/locales/routes.fr.yml @@ -16,7 +16,7 @@ fr:      new:        title: "Ajouter un itinéraire"      edit: -      title: "Editer l'itinéraire %{route}" +      title: "Editer l'itinéraire %{name}"        select2:          placeholder: "Sélectionnez un arrêt existant..."        map: @@ -37,7 +37,7 @@ fr:            normal: Descente autorisée            forbidden: Descente interdite      show: -      title: "Itinéraire %{route} de la ligne %{line}" +      title: "Itinéraire %{name}"        stop_points: "Liste des arrêts de l'itinéraire"        stop_areas:          title: "Liste des arrêts" @@ -45,7 +45,7 @@ fr:        no_opposite_route: "Aucun itinéraire associé"        undefined: "Non défini"      index: -      title: "Itinéraire %{route}" +      title: "Itinéraire"        selection: "Sélection"        selection_all: "Tous"      edit_boarding_alighting: diff --git a/config/locales/routing_constraint_zones.en.yml b/config/locales/routing_constraint_zones.en.yml index cc0a15e0c..34a10ac67 100644 --- a/config/locales/routing_constraint_zones.en.yml +++ b/config/locales/routing_constraint_zones.en.yml @@ -31,8 +31,8 @@ en:      new:        title: Add a new routings constraint zone      edit: -      title: "Update routing constraint zone %{routing_constraint_zone}" +      title: "Update routing constraint zone %{name}"      show: -      title: "Routing constraint zone %{routing_constraint_zone}" +      title: "Routing constraint zone %{name}"      index:        title: "Interdictions of local trafficous" diff --git a/config/locales/routing_constraint_zones.fr.yml b/config/locales/routing_constraint_zones.fr.yml index 10c6d37f7..80bbad8cf 100644 --- a/config/locales/routing_constraint_zones.fr.yml +++ b/config/locales/routing_constraint_zones.fr.yml @@ -31,8 +31,8 @@ fr:      new:        title: Créer une ITL      edit: -      title: "Editer l'ITL : %{routing_constraint_zone}" +      title: "Editer l'ITL : %{name}"      show: -      title: "Zone de contrainte %{routing_constraint_zone}" +      title: "Zone de contrainte %{name}"      index:        title: "Interdictions de trafic local" diff --git a/config/locales/stop_areas.fr.yml b/config/locales/stop_areas.fr.yml index 216516e5b..bf4dd832f 100644 --- a/config/locales/stop_areas.fr.yml +++ b/config/locales/stop_areas.fr.yml @@ -44,9 +44,9 @@ fr:        address: "246 Boulevard Saint-Germain, 75007 Paris"        geolocalize: "Géolocalisez "      edit: -      title: "Editer l'arrêt %{stop_area}" +      title: "Editer l'arrêt %{name}"      show: -      title: "Arrêt %{stop_area}" +      title: "Arrêt %{name}"        geographic_data: "Données géographiques"        no_geographic_data: "Aucune"        itl_managment: "Gestion des liens de l'ITL" | 
