internetee/registry

View on GitHub
app/views/admin/billing/prices/_form.html.erb

Summary

Maintainability
Test Coverage
<%= form_for [:admin, price], html: { class: 'form-horizontal' } do |f| %>
    <%= render 'form_errors', target: price %>

    <div class="form-group">
        <%= f.label :zone_id, class: 'col-sm-2 control-label' %>

        <div class="col-sm-3">
            <%= f.collection_select :zone_id, zones, :id, :origin, {}, class: 'form-control', required: true %>
        </div>
    </div>

    <div class="form-group">
        <%= f.label :operation_category, class: 'col-sm-2 control-label' %>

        <div class="col-sm-3">
            <%= f.select :operation_category, operation_categories, {}, class: 'form-control', required: true %>
        </div>
    </div>

    <div class="form-group">
        <%= f.label :duration, class: 'col-sm-2 control-label' %>

        <div class="col-sm-3">
            <%= f.select :duration, durations, {}, class: 'form-control', required: true %>
        </div>
    </div>

    <div class="form-group">
        <%= f.label :price, class: 'col-sm-2 control-label' %>

        <div class="col-sm-3">
            <div class="input-group">
                <%= f.money_field :price, class: 'form-control', required: true %>
                <div class="input-group-addon"><%= Money::default_currency.symbol %></div>
            </div>
        </div>
    </div>

    <div class="form-group">
        <%= f.label :valid_from, class: 'col-sm-2 control-label' %>

        <div class="col-sm-6">
            <div class="input-group">
                <%= f.text_field :valid_from, value: f.object.valid_from.try(:to_date),
                                 class: 'form-control js-datepicker' %>
                <span class="input-group-addon">-</span>
                <%= f.text_field :valid_to, value: f.object.valid_to.try(:to_date),
                                 class: 'form-control js-datepicker' %>
            </div>
        </div>
    </div>

    <hr>

    <div class="row">
        <div class="col-md-8 text-right">
            <%= f.submit t(".#{f.object.new_record? ? 'create' : 'update'}_btn"), class: 'btn btn-success', name: nil %>
        </div>
    </div>
<% end %>