af83/chouette-core

View on GitHub
app/views/publication_setups/index.html.slim

Summary

Maintainability
Test Coverage
- breadcrumb :publication_setups, @workgroup
- content_for :page_header_content do
  .row.mb-sm
    .col-lg-12.text-right
      - if parent_policy.create?(PublicationSetup)
        = link_to t('publication_setups.actions.create'), new_workgroup_publication_setup_path(@workgroup), class: 'btn btn-primary'

.page_content
  .container-fluid
    .row
      .col-lg-12
        = search_form_for @q, url: [@workgroup, :publication_setups], html: { method: :get }, class: 'form form-filter' do |f|
          .ffg-row
            .form-group.togglable class=filter_item_class(params[:q], :export_type_eq_any)
              = f.label PublicationSetup.tmf(:export_type), required: false, class: 'control-label'
              / = f.input :export_type_eq_any, collection: workgroup_exports(@workgroup), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>#{l.human_name}</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
          .actions
            = link_to t('actions.erase'), [@workgroup, :publication_setups], class: 'btn btn-link'
            = f.submit t('actions.filter'), class: 'btn btn-default'

    - if @publication_setups.any?
      .row
        .col-lg-12
          = table_builder_2 @publication_setups,
            [ \
              TableBuilderHelper::Column.new( \
                key: :enabled, \
                attribute: ->(p){ boolean_icon(p.enabled) }, \
                sortable: false, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: 'name', \
                link_to: lambda do |publication_setup| \
                  [@workgroup, publication_setup] \
                end \
              ), \
              TableBuilderHelper::Column.new( \
                key: :export_type, \
                attribute: ->(p){ p.human_export_name}, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :destinations, \
                attribute: ->(p){ p.destinations.map(&:name).to_sentence }, \
                sortable: false, \
              ), \
            ],
            cls: 'table has-filter'

          = new_pagination @publication_setups, 'pull-right'

    - else
      .row.mt-xs
        .col-lg-12
          = replacement_msg t('publication_setups.search_no_results')