internetee/registry

View on GitHub
app/views/admin/registrars/_form.html.erb

Summary

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

    <div class="row">
        <div class="col-md-8">
            <div class="panel panel-default">
                <div class="panel-heading clearfix">
                    <div class="pull-left">
                        <%= t(:general) %>
                    </div>
                </div>
                <div class="panel-body">
                    <div class="form-group">
                        <div class="col-md-4 control-label">
                            <%= f.label :name %>
                        </div>
                        <div class="col-md-7">
                            <%= f.text_field :name, required: true, autofocus: true, class: 'form-control' %>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-4 control-label">
                            <%= f.label :reg_no %>
                        </div>
                        <div class="col-md-7">
                            <%= f.text_field :reg_no, required: true, class: 'form-control' %>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-4 control-label">
                            <%= f.label :phone %>
                        </div>
                        <div class="col-md-7">
                            <%= f.text_field(:phone, class: 'form-control') %>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-4 control-label">
                            <%= f.label :website %>
                        </div>
                        <div class="col-md-7">
                            <%= f.url_field :website, class: 'form-control' %>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-4 control-label">
                            <%= f.label :email %>
                        </div>
                        <div class="col-md-7">
                            <%= f.email_field :email, required: true, class: 'form-control' %>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <%= render 'admin/registrars/form/address', f: f %>
    <%= render 'admin/registrars/form/billing', f: f, registry_vat_rate: registry_vat_rate %>

    <div class="row">
        <div class="col-md-8">
            <div class="panel panel-default">
                <div class="panel-heading clearfix">
                    <div class="pull-left">
                        <%= t('.misc') %>
                    </div>
                </div>

                <div class="panel-body">
                    <div class="form-group">
                        <div class="col-md-4 control-label">
                            <%= f.label :code %>
                        </div>
                        <div class="col-md-7">
                            <%= f.text_field :code, required: f.object.new_record?,
                                             disabled: f.object.persisted?,
                                             class: 'form-control' %>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-4 control-label">
                            <%= f.label :test_registrar %>
                        </div>
                        <div class="col-md-7">
                            <%= f.check_box :test_registrar, class: 'form-control' %>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-4 control-label">
                            <%= f.label t('.legaldoc_optout') %>
                        </div>
                        <div class="col-md-7">
                            <%= f.check_box :legaldoc_optout, class: 'form-control' %>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-4 control-label">
                            <%= f.label t('.legaldoc_optout_comment') %>
                        </div>
                        <div class="col-md-7">
                            <%= f.text_area :legaldoc_optout_comment, class: 'form-control', rows: 3 %>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-8">
            <%= render 'admin/registrars/form/preferences', f: f %>
        </div>
    </div>

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