af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :"#{documentable.class.name.demodulize.underscore}_document_memberships", @workbench, documentable
.page_content
    .container-fluid
        - if @document_memberships.any?
            .row
                .col-lg-12
                    = table_builder_2 @document_memberships,
                        [ \
                            TableBuilderHelper::Column.new( \
                                name: Document.human_attribute_name(:uuid), \
                                attribute: -> (document_membership) { document_membership.document.uuid }, \
                                sortable: false, \
                            ), \
                            TableBuilderHelper::Column.new( \
                                name: Document.human_attribute_name(:name), \
                                attribute: -> (document_membership) { document_membership.document.name }, \
                                sortable: false, \
                                link_to: -> (document_membership) { workbench_document_path(@workbench, document_membership.document) } \
                            ), \
                            TableBuilderHelper::Column.new( \
                                name: Document.human_attribute_name(:document_type_id), \
                                attribute: -> (document_membership) { document_membership.document.document_type.name }, \
                                sortable: false, \
                            ), \
                            TableBuilderHelper::Column.new( \
                                name: Document.human_attribute_name(:from), \
                                attribute: -> (document_membership) { document_membership.document.validity_period&.from.present? ? l(document_membership.document.validity_period.from) : '-' }, \
                                sortable: false,\
                            ), \
                            TableBuilderHelper::Column.new( \
                                name: Document.human_attribute_name(:to), \
                                attribute: -> (document_membership) { document_membership.document.validity_period&.to.present? ? l(document_membership.document.validity_period.to) : '-' }, \
                                sortable: false,\
                            ) \
                        ].compact,
                        cls: 'table memberships'

                    = new_pagination @document_memberships, 'pull-right', renderer: WillPaginate::RemoteLinkRenderer

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

        h2 = I18n.t('documentable.actions.associate_other_documents')
        .row
            = simple_form_for @unassociated_documents_search, url: request.path, method: "GET", remote: true, html: { class: 'form form-filter' }  do |f|
                .ffg-row
                    .input-group.search_bar
                        = f.input :name, label: false, class: 'form-control'
                        span.input-group-btn
                            button.btn.btn-default#search_btn type='submit'
                                span.fa.fa-search
                .actions
                    = link_to t('actions.erase'), request.path, class: 'btn btn-link', remote: true
                    = f.submit t('actions.filter'), class: 'btn btn-default'

        .unassociated_documents
          = render 'unassociated_documents'