af83/chouette-core

View on GitHub
app/views/document_memberships/_unassociated_documents.html.slim

Summary

Maintainability
Test Coverage
- if @unassociated_documents.any?
  .col-lg-12
    = table_builder_2 @unassociated_documents,
      [ \
        TableBuilderHelper::Column.new( \
          key: :uuid, \
          attribute: :uuid, \
          sortable: false, \
        ), \
        TableBuilderHelper::Column.new( \
          key: :name, \
          attribute: :name, \
          sortable: false, \
          link_to: -> (doc) { workbench_document_path(@workbench, doc) } \
        ), \
        TableBuilderHelper::Column.new( \
          key: :document_type_id, \
          attribute: -> (doc) { doc.document_type.name }, \
          sortable: false, \
        ), \
        TableBuilderHelper::Column.new( \
          key: :from, \
          attribute: -> (doc) { doc.validity_period&.from.present? ? l(doc.validity_period.from) : '-' }, \
          sortable: false,\
        ), \
        TableBuilderHelper::Column.new( \
          key: :to, \
          attribute: -> (doc) { doc.validity_period&.to.present? ? l(doc.validity_period.to) : '-' }, \
          sortable: false,\
        ), \
      ].compact,
      cls: 'table has-filter has-search'
    = new_pagination @unassociated_documents, 'pull-right', renderer: WillPaginate::RemoteLinkRenderer

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