af83/chouette-core

View on GitHub
app/views/lines/show.html.slim

Summary

Maintainability
Test Coverage
- breadcrumb :line, @workbench, @line
- page_header_content_for @line

.page_content
  .container-fluid
    .row
      .col-md-6.col-sm-12
        = simple_block_for @line, title: t("lines.form.sections.identification") do |d|
          = d.attribute :objectid, value: @line.get_objectid.short_id
          = d.attribute :name
          = d.attribute :published_name
          = d.attribute :number
          = d.attribute :transport_mode, as: :enumerize
          = d.attribute :transport_submode, as: :enumerize
          = d.attribute :flexible_service, as: :boolean
          = d.attribute :seasonal, as: :boolean

        = simple_block_for @line, title: t("lines.form.sections.hierarchy") do |d|
          = d.attribute :company, as: :association, link: ->(company) { workbench_line_referential_company_path(@workbench, company) }
          = d.attribute :secondary_companies, as: :associations, link: ->(company) { workbench_line_referential_company_path(@workbench, company) }
          = d.attribute :network, as: :association, link: ->(network) { workbench_line_referential_network_path(@workbench, network) }

        = simple_block_for @line, title: Chouette::Line.tmf('is_referent') do |d|
          - if @line.is_referent
            = d.attribute :particulars, as: :count, value: @line.particulars, link: workbench_line_referential_lines_path(@workbench, :'q[referent_id_eq]' => @line.id)
            - if @line.particulars.present?
              table.table.table-bordered.mt-5
                thead
                  tr
                    th scope="col"
                      = Chouette::Line.tmf('id')
                    th scope="col"
                      = Chouette::Line.tmf('name')
                tbody
                  - @line.particulars.limit(5).each do |c|
                    tr
                      td
                        = c.get_objectid.short_id
                      td
                        = link_to(c.name, workbench_line_referential_line_path(@workbench, c))
          - else
            = d.attribute :referent, as: :association, link: ->(referent) { workbench_line_referential_line_path(@workbench, referent) }

        = simple_block_for @line, title: t("lines.form.sections.internals") do |d|
          = d.attribute :line_provider, as: :association, link: ->(line_provider) { workbench_line_referential_line_provider_path(@workbench, @line.line_provider_id) }
          = d.attribute :comment

        = render 'codes/block', model: @line

      .col-lg-6.col-md-6.col-sm-12.col-xs-12
        = simple_block_for @line, title: t("lines.form.sections.activation") do |d|
          = d.attribute :status, value_method: :human_status
          = d.attribute :active_from, as: :date
          = d.attribute :active_until, as: :date

        = simple_block_for @line, title: t("lines.form.sections.publication_data") do |d|
          = d.attribute :color, value: color_icon(@line.color)
          = d.attribute :text_color, value: color_icon(@line.text_color)
          = d.attribute :url, link: @line.url

        = simple_block_for @line, title: t("lines.form.sections.accessibility") do |d|
          = d.attribute :mobility_impaired_accessibility, as: :enumerize
          = d.attribute :wheelchair_accessibility, as: :enumerize
          = d.attribute :step_free_accessibility, as: :enumerize
          = d.attribute :escalator_free_accessibility, as: :enumerize
          = d.attribute :lift_free_accessibility, as: :enumerize
          = d.attribute :audible_signals_availability, as: :enumerize
          = d.attribute :visual_signs_availability, as: :enumerize
          = d.attribute :accessibility_limitation_description

        = render 'shared/documentable/documents', documentable: @line, document_memberships_path: workbench_line_referential_line_document_memberships_path(@workbench, @line)