diff options
| author | jpl | 2017-02-17 13:16:04 +0100 | 
|---|---|---|
| committer | jpl | 2017-02-17 13:16:04 +0100 | 
| commit | 14797b3623b0a9b45f0098fa20812eba3cf65dfd (patch) | |
| tree | f87a3a05ec139f278a82ef7cb660432bbdd4be4c | |
| parent | bb53de085fe3d5870498673bc74d1331bac44e8d (diff) | |
| download | chouette-core-14797b3623b0a9b45f0098fa20812eba3cf65dfd.tar.bz2 | |
Refs #2609: updating codif. objects show pages
| -rw-r--r-- | app/views/companies/show.html.slim | 86 | ||||
| -rw-r--r-- | app/views/lines/show.html.slim | 171 | ||||
| -rw-r--r-- | app/views/networks/show.html.slim | 75 | ||||
| -rw-r--r-- | app/views/referential_lines/show.html.slim | 2 | 
4 files changed, 90 insertions, 244 deletions
| diff --git a/app/views/companies/show.html.slim b/app/views/companies/show.html.slim index 1c244a53a..a5c7347a8 100644 --- a/app/views/companies/show.html.slim +++ b/app/views/companies/show.html.slim @@ -1,58 +1,28 @@ -= title_tag t('companies.show.title', company: @company.name) - -.company_show -  .summary -    p -      label = "#{Chouette::Company.human_attribute_name('short_name')} : " -      = @company.short_name - -    p -      label = "#{Chouette::Company.human_attribute_name('organizational_unit')} : " -      = @company.organizational_unit - -    p -      label = "#{Chouette::Company.human_attribute_name('operating_department_name')} : " -      = @company.operating_department_name - -    p -      label = "#{Chouette::Company.human_attribute_name('code')} : " -      = @company.code - -    p -      label = "#{Chouette::Company.human_attribute_name('phone')} : " -      = @company.phone - -    p -      label = "#{Chouette::Company.human_attribute_name('fax')} : " -      = @company.fax - -    p -      label = "#{Chouette::Company.human_attribute_name('email')} : " -      = @company.email - -    p -      label = "#{Chouette::Company.human_attribute_name('time_zone')} : " -      = @company.time_zone - -    p -      label = "#{Chouette::Company.human_attribute_name('url')} : " -      = @company.url - -    p -      label = "#{Chouette::Company.human_attribute_name('registration_number')} : " -      = @company.registration_number - -- content_for :sidebar do -  ul.actions -    - if policy(Chouette::Company).create? -      li -        = link_to t('companies.actions.new'), new_line_referential_company_path(@line_referential), class: 'add' -    - if policy(@company).update? -      li -        = link_to t('companies.actions.edit'), edit_line_referential_company_path(@line_referential, @company), class: 'edit' -    - if policy(@company).destroy? -      li -        = link_to  t('companies.actions.destroy'), line_referential_company_path(@line_referential, @company), :method => :delete,  :data => {:confirm =>  t('companies.actions.destroy_confirm')}, class: 'remove' -      br - -  = creation_tag(@company) +/ PageHeader += pageheader 'map-marker', +             @company.name, +             'Lorem ipsum dolor sit amet', +             t('last_update', time: l(@company.updated_at, format: :short)) do + +  / Below is secundary actions & optional contents (filters, ...) +  .row +    .col-lg-12.text-right.mb-sm +      - if policy(Chouette::Company).create? +        = link_to t('companies.actions.new'), new_line_referential_company_path(@line_referential), class: 'btn btn-primary' +      - if policy(@company).update? +        = link_to t('companies.actions.edit'), edit_line_referential_company_path(@line_referential, @company), class: 'btn btn-primary' +      - if policy(@company).destroy? +        = link_to line_referential_company_path(@line_referential, @company), method: :delete, data: {confirm:  t('companies.actions.destroy_confirm')}, class: 'btn btn-primary' do +          span.fa.fa-trash +          span = t('companies.actions.destroy') + +/ PageContent +.page_content +  .container-fluid +    .row +      .col-lg-6.col-md-6.col-sm-12.col-xs-12 +        = definition_list t('metadatas'), +          { 'ID Codif' => @company.try(:objectid).try(:local_id), +            Chouette::Company.human_attribute_name(:phone) => @company.phone, +            Chouette::Company.human_attribute_name(:email) => @company.email, +            Chouette::Company.human_attribute_name(:url) => @company.url } diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim index 2b652754a..0589b1923 100644 --- a/app/views/lines/show.html.slim +++ b/app/views/lines/show.html.slim @@ -1,135 +1,36 @@ -- text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" -- bg_color = @line.color.blank? ? "white" : "##{@line.color}" - -= title_tag t('lines.show.title', line: @line.name) - -.line_show -  .summary -    - text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" -    - bg_color = @line.color.blank? ? "white" : "##{@line.color}" - -    - if colors?(@line) -      p -        label = "#{t('lines.index.color')} : " -        label.color style="#{number_style(@line)}" -          = line_sticker(@line) - -    - if @line.deactivated -      p -        = t('lines.index.deactivated') - -    p -      label = "#{@line.human_attribute_name(:network)} : " - -      - if @line.network.nil? -        = t('lines.index.unset') -      - else -        = link_to @line.network.name, [@line_referential, @line.network] -    p -      label = "#{@line.human_attribute_name(:company)} : " -      - if @line.company.nil? -        = t('lines.index.unset') -      - else -        = link_to @line.company.name, [@line_referential, @line.company] -    p -      label = "#{@line.human_attribute_name(:secondary_companies)} : " -      - @line.secondary_companies.each do |company| -        = link_to @company.name, [@line_referential, @company] -    p -      label = "#{@line.human_attribute_name('number')} : " -      = @line.number - -    p -      label = "#{@line.human_attribute_name('published_name')} : " -      = @line.published_name - -    p -      label = "#{@line.human_attribute_name('registration_number')} : " -      = @line.registration_number - -    p -      label = "#{@line.human_attribute_name('transport_mode')} : " -      - if @line.transport_mode -        = " " + t("enumerize.line.transport_mode.#{@line.transport_mode}") -      - else -        = " -" - -    p -      label = "#{@line.human_attribute_name('transport_submode')} : " -      - if @line.transport_submode -        = " " + t("enumerize.line.transport_submode.#{@line.transport_submode}") -      - else -        = " -" - -    / p -    /   label = "#{@line.human_attribute_name('stable_id')} : " -    /   = @line.stable_id - -    p -      label = "#{@line.human_attribute_name('url')} : " -      = @line.url - -    / p -    /   label = "#{@line.human_attribute_name('mobility_restricted_suitability')} : " -    / -    /   - if @line.mobility_restricted_suitability.nil? -    /     = @line.human_attribute_name("unspecified_mrs") -    /   - elsif @line.mobility_restricted_suitability? -    /     = @line.human_attribute_name("accessible") -    /   - else -    /     = @line.human_attribute_name("not_accessible") -    / -    /   br -    /   = "#{@line.human_attribute_name('number_of_mrs_vj')} : #{@line.vehicle_journeys.where('mobility_restricted_suitability = ?', true).count}" -    /   br -    /   = "#{@line.human_attribute_name('number_of_non_mrs_vj')} : #{@line.vehicle_journeys.where('mobility_restricted_suitability = ?', false).count}" -    /   br -    /   = @line.human_attribute_name("number_of_null_mrs_vj") -    /   = " : " -    /   = @line.vehicle_journeys.count - (@line.vehicle_journeys.where("mobility_restricted_suitability = ?", true).count + @line.vehicle_journeys.where("mobility_restricted_suitability = ?", false).count) -    / -    / p -    /   label = "#{@line.human_attribute_name('flexible_service')} : " -    / -    /   - if @line.flexible_service.nil? -    /     = @line.human_attribute_name("unspecified_fs") -    /   - elsif @line.flexible_service? -    /     = @line.human_attribute_name("on_demaond_fs") -    /   - else -    /     = @line.human_attribute_name("regular_fs") -    / -    /   br -    /   = "#{@line.human_attribute_name('number_of_fs_vj')} : #{@line.vehicle_journeys.where('flexible_service = ?', true).count}" -    /   br -    /   = "#{@line.human_attribute_name('number_of_non_fs_vj')} : #{@line.vehicle_journeys.where('flexible_service = ?', false).count}" -    /   br -    /   = @line.human_attribute_name("number_of_null_fs_vj") -    / -    /   - if @line.flexible_service.nil? -    /     = "(#{@line.human_attribute_name('default_fs_msg')})" -    / -    /   = " : " -    /   = @line.vehicle_journeys.count - (@line.vehicle_journeys.where("flexible_service = ?", true).count + @line.vehicle_journeys.where("flexible_service = ?", false).count) - -    / p -    /   label = "#{@line.human_attribute_name('comment')} : " -    /   = @line.comment - -    / .row -    /   #mobility_restricted_suitability.col-md-6 -    /   #flexible_service.col-md-6 - -- content_for :sidebar do -  ul.actions -    - if policy(Chouette::Line).create? && @line_referential.organisations.include?(current_organisation) -      li -        = link_to t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'add' -    / FIXME #2018 -    - if false && policy(@line).update? -      li -        = link_to t('lines.actions.edit'), edit_line_referential_line_path(@line_referential, @line), class: 'edit' -    - if policy(@line).destroy? -      li -        = link_to t('lines.actions.destroy'), line_referential_line_path(@line_referential, @line), method: :delete, :data => {:confirm =>  t('lines.actions.destroy_confirm')}, class: 'remove' - -  = creation_tag(@line) +/ PageHeader += pageheader 'map-marker', +             @line.name, +             'Lorem ipsum dolor sit amet', +             t('last_update', time: l(@line.updated_at, format: :short)) do + +  / Below is secundary actions & optional contents +  .row +    .col-lg-12.text-right.mb-sm +      = link_to t('lines.actions.show_network'), [@line_referential, @line.network], class: 'btn btn-primary' +      = link_to t('lines.actions.show_company'), [@line_referential, @line.company], class: 'btn btn-primary' + +      - if policy(Chouette::Line).create? && @line_referential.organisations.include?(current_organisation) +        = link_to t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'btn btn-primary' +      - if false && policy(@line).update? +        = link_to t('lines.actions.edit'), edit_line_referential_line_path(@line_referential, @line), class: 'btn btn-primary' +      - if policy(@line).destroy? +        = link_to line_referential_line_path(@line_referential, @line), method: :delete, data: {confirm:  t('lines.actions.destroy_confirm')}, class: 'btn btn-primary' do +          span.fa.fa-trash +          span = t('lines.actions.destroy') + +/ PageContent +.page_content +  .container-fluid +    .row +      .col-lg-6.col-md-6.col-sm-12.col-xs-12 +        = definition_list t('metadatas'), +          { 'Activé' => (@line.deactivated? ? t('false') : t('true')), +             @line.human_attribute_name(:network) => (@line.network.nil? ? t('lines.index.unset') : @line.network.name), +             @line.human_attribute_name(:company) => (@line.company.nil? ? t('lines.index.unset') : @line.company.name), +             @line.human_attribute_name(:number) => @line.number, +             @line.human_attribute_name(:published_name) => @line.published_name, +             @line.human_attribute_name(:registration_number) => @line.registration_number, +             @line.human_attribute_name(:transport_mode) => (@line.transport_mode ? t("enumerize.line.transport_mode.#{@line.transport_mode}") : '-'), +             @line.human_attribute_name(:transport_submode) => (@line.transport_submode ? t("enumerize.line.transport_submode.#{@line.transport_submode}") : '-'), +             @line.human_attribute_name(:url) => (@line.url ? @line.url : '-') } diff --git a/app/views/networks/show.html.slim b/app/views/networks/show.html.slim index 5d5b1cd74..1f24fc5c1 100644 --- a/app/views/networks/show.html.slim +++ b/app/views/networks/show.html.slim @@ -1,50 +1,25 @@ -= title_tag t('networks.show.title', network: @network.name) - -.network_show -  = @map.to_html - -  .summary -    p -      label = "#{Chouette::Network.human_attribute_name('registration_number')} : " -      = @network.registration_number - -    p -      label = "#{Chouette::Network.human_attribute_name('comment')} : " -      = @network.comment - -    p -      label = "#{Chouette::Network.human_attribute_name('version_date')} : " -      - if @network.version_date.present? -        = l @network.version_date - -    p -      label = "#{Chouette::Network.human_attribute_name('description')} : " -      = @network.description - -    p -      label = "#{Chouette::Network.human_attribute_name('source_name')} : " -      = @network.source_name - -    p -      label = "#{Chouette::Network.human_attribute_name('source_type_name')} : " -      - if @network.source_type_name.present? -        = t("source_types.label.#{@network.source_type_name}") - -    p -      label = "#{Chouette::Network.human_attribute_name('source_identifier')} : " -      = @network.source_identifier - -- content_for :sidebar do -  ul.actions -    - if policy(Chouette::Network).create? -      li -        = link_to t('networks.actions.new'), new_line_referential_network_path(@line_referential), class: 'add' -    - if policy(@network).update? -      li -        = link_to t('networks.actions.edit'), edit_line_referential_network_path(@line_referential, @network), class: 'edit' -    - if policy(@network).destroy? -      li -        = link_to t('networks.actions.destroy'), line_referential_network_path(@line_referential, @network), method: :delete, data: { :confirm => t('networks.actions.destroy_confirm')}, class: 'remove' -    br - -  = creation_tag(@network) +/ PageHeader += pageheader 'map-marker', +             @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, ...) +  .row +    .col-lg-12.text-right.mb-sm +      - if policy(Chouette::Network).create? +        = link_to t('networks.actions.new'), new_line_referential_network_path(@line_referential), class: 'btn btn-primary' +      - if policy(@network).update? +        = link_to t('networks.actions.edit'), edit_line_referential_network_path(@line_referential, @network), class: 'btn btn-primary' +      - if policy(@network).destroy? +        = link_to line_referential_network_path(@line_referential, @network), method: :delete, data: { confirm: t('networks.actions.destroy_confirm')}, class: 'btn btn-primary' do +          span.fa.fa-trash +          span = t('networks.actions.destroy') + +/ PageContent +.page_content +  .container-fluid +    .row +      .col-lg-6.col-md-6.col-sm-12.col-xs-12 +        = definition_list t('metadatas'), +          { 'ID Codif' => @network.try(:objectid).try(:local_id) } diff --git a/app/views/referential_lines/show.html.slim b/app/views/referential_lines/show.html.slim index 39dbccfa2..f81d7e0fc 100644 --- a/app/views/referential_lines/show.html.slim +++ b/app/views/referential_lines/show.html.slim @@ -4,7 +4,7 @@               'Lorem ipsum dolor sit amet',               t('last_update', time: l(@line.updated_at, format: :short)) do -  / Below is secundary actions & optional contents (filters, ...) +  / Below is secundary actions & optional contents    .row      .col-lg-12.text-right.mb-sm        = link_to t('lines.actions.show_network'), [@referential, @line.network], class: 'btn btn-primary' | 
