18F/micropurchase

View on GitHub
app/views/admin/auctions/_publish_auction.html.erb

Summary

Maintainability
Test Coverage
<%= simple_form_for [:admin, status.auction], url: admin_auction_path, method: :patch do |f| %>
  <fieldset class="datetime">
    <legend>Auction starts</legend>
    <%= render partial: 'sidebar_datetime_fields',
      locals: { field: 'started', auction: status } %>
  </fieldset>

  <fieldset class="datetime">
    <legend>Auction ends</legend>
    <%= render partial: 'sidebar_datetime_fields',
      locals: { field: 'ended', auction: status } %>
  </fieldset>

  <fieldset class="datetime">
    <legend>Delivery deadline</legend>
    <div class="usa-width-one-third">
      <%= f.input :due_in_days, as: :select, collection: 5..10, default: 5 %>
    </div>

    <div class="usa-width-two-thirds">
      <div class="estimated-delivery-date">
        Estimated delivery date
        <div class="delivery-date">
          <%= status.estimated_delivery_due_at %>
        </div>
      </div>
    </div>
  </fieldset>

  <%= f.hidden_field :published, value: 'published', hidden: true %>
  <%= f.submit t('links_and_buttons.auctions.publish'),
    class: 'usa-button usa-button-outline action-button' %>
<% end %>