af83/chouette-core

View on GitHub
app/views/aggregates/_form.html.slim

Summary

Maintainability
Test Coverage
= simple_form_for aggregate, as: :aggregate, url: workgroup_aggregates_path(workgroup), html: {class: 'form-horizontal', id: 'wb_merge_form'}, wrapper: :horizontal_form do |form|
  - if form.error(:base).present?
    .row
      .col-lg-12
        .alert.alert-warning
          strong= form.error(:base)

    .separator

  .row
    .col-lg-12
      = form.hidden_field :referential_ids

  .row
    .col-lg-12
      = form.input :notification_target, collection: Aggregate.notification_target_options, selected: :user

  .row
    .col-lg-12
      .select-table
        = table_builder_2 @workgroup.workbenches.left_joins(output: :current).order("referentials.created_at desc nulls last, name asc"),
          [ \
            TableBuilderHelper::Column.new( \
              key: :name, \
              name: Workbench.ts.capitalize, \
              attribute: :name, \
              sortable: false\
            ), \
            TableBuilderHelper::Column.new( \
              name: Referential.tmf(:name), \
              attribute: Proc.new {|w| w.referential_to_aggregate && decorate_referential_name(w.referential_to_aggregate) || '-' }, \
              sortable: false\
            ), \
            TableBuilderHelper::Column.new( \
              name: false, \
              attribute: Proc.new {|w| w.locked_referential_to_aggregate.present? ? '<span class="fa fa-lock"></span>'.html_safe : '' }, \
              sortable: false\
            )], cls: 'table'

  = cancel_button
  = form.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'wb_merge_form'