app/views/batches/edit.html.erb
<% add :menu, "Swap lanes editing" => filtered_batch_path(@batch) -%>
<% add :back_menu, "View all batches" => batch_path(@batch) -%>
<%= page_title('Batch', @batch.id) %>
<%= panel do %>
<dl class="descriptive-list-inline">
<dt>Created</dt> <dd><%= time_tag( @batch.created_at) %></dd>
<dt>Pipeline</dt> <dd><%= @batch.pipeline.name %></dd>
</dl>
<% end %>
<% if @requests.empty? -%>
<%= panel do %>
This batch is empty.
<% end %>
<% else -%>
<%= panel_no_body do %>
<div class="card-body"><p>Click on a request's position column and drag it to re-order. Then click 'Save' when done.</p></div>
<%= render partial: "shared/batch", locals: { requests: @requests, edit: true, stage: false } %>
<% end %>
<%- end -%>
<%= panel :info, title: 'Assign Batch to User' do %>
<p class="lead">Assign this batch to another user</p>
<div>
<%= form_for @batch, html: { class: 'form-inline' } do |form| -%>
<%= form.select :assignee_id, @users.pluck(:login,:id), { selected: @batch.assignee_id||current_user.id }, { class: 'select2' } %>
<%= form.submit "Assign", data: { disable_with: 'Assigning' } %>
<% end -%>
</div>
<% end %>
<% if @batch.pending? %>
<%= panel title: 'Reset Batch' do %>
<p class="lead">
This will release all requests in the batch back into the inbox. The batch itself will be destroyed,
target assets, such as lanes, will be removed.
</p>
<div>
<%= form_tag(controller: :batches, action: :reset_batch, id: @batch.id) do -%>
<%= submit_tag "Reset", confirm: 'Do you really want to do this?', class: 'btn-block' %>
<% end %>
</div>
<% end %>
<% end %>
<% if can? :rollback, @batch -%>
<%= panel :info, title: 'Rollback QC' do %>
<p class="lead">This will move the batch to it's previous QC state.</p>
<%= form_tag(controller: :batches, action: :previous_qc_state, id: @batch.id) do -%>
<%= submit_tag "Move to previous state", confirm: 'Do you really want to do this?', class: 'btn-block' %>
<% end %>
<% end %>
<% end %>