coopdevs/timeoverflow

View on GitHub
app/views/multi_transfers/steps/_select_source.html.erb

Summary

Maintainability
Test Coverage
<div class="alert alert-info" role="alert">
  <%= t('multi_transfers.step.set_source.description') %>
</div>

<div class="form-group">
  <%= select_tag('from[]',
    options_for_select(
      TransferSourcesOptions.new(@accounts).to_a,
      selected: @from,
    ), id: 'select2-multi-from', multiple: @type_of_transfer == :many_to_one, required: true)
  %>
</div>

<script type="text/javascript">
  (function () {
    var options = <%= ({
      disabledOptions: @to,
      value: @from
    }).to_json.html_safe %>;

    initializeSelect2(
      "#select2-multi-from",
      options
    );
  })()
</script>