af83/chouette-core

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

Summary

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

/ PageContent
.page_content
  .container-fluid
    .row
      .col-lg-6.col-md-6.col-sm-12.col-xs-12
        = simple_block_for @source, title: t('sources.form.sections.identification') do |d|
          = d.attribute :name
          = d.attribute :url, as: :url
          = d.attribute :downloader_type, as: :enumerize

      .col-lg-6.col-md-6.col-sm-12.col-xs-12
        = simple_block_for @source, title: t('sources.form.sections.import_options') do |d|
          = d.attribute :import_option_automatic_merge, as: :boolean
          = d.attribute :import_option_archive_on_fail, as: :boolean
          - if resource_policy.update_workgroup_providers?
            = d.attribute :import_option_update_workgroup_providers, as: :boolean
          - if has_feature?("import_netex_store_xml")
            = d.attribute :import_option_store_xml, as: :boolean
          = d.attribute :import_option_disable_missing_resources, as: :boolean
          = d.attribute :import_option_strict_mode, as: :boolean
          = d.attribute :import_option_ignore_particulars, as: :boolean
          = d.attribute :import_option_process_gtfs_route_ids, as: :array
          = d.attribute :import_option_stop_area_provider, as: :association
          = d.attribute :import_option_line_provider, as: :association
          - if has_feature?("import_with_code_space")
            = d.attribute :import_option_code_space, as: :association
    .row
      .col-lg-6.col-md-6.col-sm-12.col-xs-12
        = simple_block_for @source, title: t('sources.form.sections.retrieval') do |d|
          = d.attribute :retrieval_frequency, as: :enumerize
          - if @source.retrieval_frequency_daily?
            = d.attribute :retrieval_time_of_day, as: :time_of_day
          = d.attribute :ignore_checksum, as: :boolean
          = d.attribute :next_retrieval, as: :datetime
          = d.attribute :retrieval_days_of_week, value: %w(monday tuesday wednesday thursday friday saturday sunday).collect{ |c| content_tag(:span, t("calendars.days.#{c}"), class: "label label-default #{@source.retrieval_days_of_week.send(c + '?') ? '' : 'disabled'}") }.join.html_safe

      .row
        .col-lg-12
          .h3 = t('sources.form.sections.last_retrieval')
          - if @retrievals.any?
            = table_builder_2 @retrievals,
              [ \
                TableBuilderHelper::Column.new( \
                  key: :started_at, \
                  attribute: Proc.new { |n| l(n.started_at, format: :short_with_time) if n.started_at }, \
                ), \
                TableBuilderHelper::Column.new( \
                  key: :status, \
                  attribute: Proc.new { |n| n.user_status.text } \
                ), \
                TableBuilderHelper::Column.new( \
                  key: :message_key, \
                  attribute: Proc.new { |n| n.user_message } \
                ), \
                TableBuilderHelper::Column.new( \
                  key: :import, \
                  attribute: Proc.new { |retrieval| retrieval.import ? (operation_status(retrieval.import&.status) + retrieval.import&.name) : "" }, \
                  link_to: lambda do |retrieval| \
                    workbench_import_path( \
                      @workbench, \
                      retrieval.import \
                    ) if retrieval.import \
                  end \
                ), \
              ],
              sortable: false,
              cls: 'table'
            / = new_pagination @source.retrievals, 'pull-right'
          - else
            .row.mt-xs
              .col-lg-12
                = replacement_msg t('imports.search_no_results')