af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :route, @workbench, @referential, @route
- page_header_content_for @route
- javascript_additional_packs 'routes/show'

.page_content
  .container-fluid
    .row
      .col-md-6.col-sm-12.col-xs-12
        = definition_list t('metadatas'),
          { t('objectid') => @route.get_objectid.short_id,
            t('activerecord.attributes.route.published_name') => (@route.published_name ? @route.published_name : '-'),
            @route.human_attribute_name(:wayback) => (@route.wayback ? @route.wayback_text : '-' ),
            @route.human_attribute_name(:opposite_route) => (@route.opposite_route ? @route.opposite_route.name : '-'),
            @route.human_attribute_name(:checksum) => @route.checksum }

      - if @route_sp.any?
        .col-md-6.col-sm-12.col-xs-12
          h4.underline= t('lines.show.map')
          #route_map.map.mb-lg

    .row
      .col-lg-12
        .h3 = t('routes.show.stop_areas.title')
        - if @route_sp.any?
          - rows = [ \
            TableBuilderHelper::Column.new( \
              name: t('id_reflex'), \
              attribute: Proc.new { |s| s.try(:stop_area).try(:local_id) } \
            ), \
            TableBuilderHelper::Column.new( \
              key: :name, \
              attribute: Proc.new { |s| content_tag :span, s.stop_area&.name, class: s.stop_area&.area_type }, \
              link_to: lambda do |stop_point| \
                workbench_stop_area_referential_stop_area_path(@workbench, stop_point.stop_area) \
              end \
            ), \
            TableBuilderHelper::Column.new( \
              key: :status, \
              name: Chouette::StopArea.tmf('status'), \
              attribute: Proc.new { |s| stop_area_status(s.try(:stop_area).try(:status) ) } \
            ) \
          ]

          - referential.stop_area_referential.enabled_stops_selection_displayed_fields.each do |f|
            - next if f == 'local_id'
            - rows << TableBuilderHelper::Column.new( \
                        name: StopAreaReferential.tmf(f), \
                        key: f, \
                        attribute: Proc.new { |s| s.try(:stop_area).try(f)&.html_safe } \
                      )

          - rows += [ \
              TableBuilderHelper::Column.new( \
                key: :for_boarding, \
                attribute: Proc.new { |s| t("stop_points.stop_point.for_boarding.#{s.for_boarding}") } \
              ), \
              TableBuilderHelper::Column.new( \
                key: :for_alighting, \
                attribute: Proc.new { |s| t("stop_points.stop_point.for_alighting.#{s.for_alighting}") } \
              ) \
            ]

          = table_builder_2 @route_sp,
            rows,
            sortable: false,
            cls: 'table has-stoppoints',
            action: :index

        - else
          = replacement_msg t('stop_areas.filters.search_no_results')