sanger/limber

View on GitHub
app/views/labware/_simple_state_change.html.erb

Summary

Maintainability
Test Coverage
<%# TODO This form code breaks the semantic presenter model pattern.
    The form should use attriutes on the presenter class not the labware directly.
%>

<% presenter.default_state_change do |transition| %>
  <%= form_for(presenter.labware) do |f|%>
    <%= hidden_field_tag :purpose_uuid, presenter.purpose.uuid %>
    <%= hidden_field_tag :labware_barcode, presenter.human_barcode %>
    <%= hidden_field_tag :state, transition.to %>
    <%= hidden_field transition.to, :reason, value: t(transition.to,scope: [:state_machine, presenter.state_transition_name_scope, :transitions]) %>
    <%= f.submit t(transition.to,scope: [:state_machine, presenter.state_transition_name_scope, :transitions]),
        class: 'btn btn-lg btn-block btn-warning',
        data: { disable_with: t(transition.to,scope: [:state_machine, presenter.state_transition_name_scope, :transitioning]) }
    %>
  <% end %>
<% end %>