af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb @publication

- page_header_content_for @publication

.page_content
  .container-fluid
    .row
      .col-lg-6.col-md-6.col-sm-12.col-xs-12
        - metadatas = { Publication.tmf(:status) => operation_user_status(@publication) }
        - metadatas.update( PublicationSetup.ts => link_to(@publication_setup.name, [@workgroup, @publication_setup]) )
        - metadatas.update( Publication.tmf(:parent) => @publication.parent ? link_to("#{@publication.parent.model_name.human} #{@publication.parent.name}", workbench_referential_path(owner_workbench, @publication.parent.new)) : '-' )
        = definition_list t('metadatas'), metadatas
      = processing_helper(@publication)

    .row
      .col-lg-6.col-md-6.col-sm-12.col-xs-12
        - if @export.object
          = simple_block_for @export, title: @export.model_name.human do |d|
            = d.attribute :name, link: workgroup_export_path(@workgroup, @export)
            = d.attribute :type, value: @export.human_type
            = d.attribute :status, value: operation_status(@export.status, verbose: true)
            = d.attribute :exported_lines, value_method: :display_selected_lines_to_export
            = d.attribute :period, value_method: :display_period
            - if @export.type == "Export::NetexGeneric"
              = d.attribute :profile, value_method: :display_profile
            - if @export.type == "Export::Gtfs"
              = d.attribute :prefer_referent_stop_area, as: :boolean
              = d.attribute :prefer_referent_company, as: :boolean
              = d.attribute :prefer_referent_line, as: :boolean
              = d.attribute :ignore_single_stop_station, as: :boolean
              = d.attribute :ignore_parent_stop_places, as: :boolean
            - if @export.type == "Export::Ara"
              = d.attribute :include_stop_visits, as: :boolean

    .row
      .col-lg-12
        - if @publication.reports.empty?
          = replacement_msg t('destination_reports.search_no_results')
        - else
          .h3 = DestinationReport.t
          = table_builder_2 @publication.reports,
            [ \
              TableBuilderHelper::Column.new( \
                key: :type, \
                attribute: ->(r){ r.destination.is_a?(Destination::PublicationApi) ? link_to(r.destination.human_type, [@workgroup, r.destination.publication_api]) : r.destination.human_type } \
              ), \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: ->(r){ r.destination.is_a?(Destination::PublicationApi) ? link_to(r.destination.name, [@workgroup, r.destination.publication_api]) : r.destination.name } \
              ), \
              TableBuilderHelper::Column.new( \
                key: :status, \
                attribute: Proc.new { |n| operation_status(n.status) }, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :error_message, \
                attribute: :error_message, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :started_at, \
                attribute: ->(n){ n.started_at ? l(n.started_at, format: :time) : '-' } \
              ), \
              TableBuilderHelper::Column.new( \
                key: :ended_at, \
                attribute: ->(n){ n.ended_at ? l(n.ended_at, format: :time) : '-' } \
              ), \
              TableBuilderHelper::Column.new( \
                key: :duration, \
                attribute: Proc.new { |n| n.duration ? distance_of_time_in_words(n.duration) : "-" }, \
              ), \
            ],
            sortable: false,
            cls: 'table',
            action: :index