internetee/registry

View on GitHub
app/views/admin/disputes/index.html.erb

Summary

Maintainability
Test Coverage
<% content_for :actions do %>
<%= link_to(t('.new_btn'), new_admin_dispute_path, class: 'btn btn-primary') %>
<% end %>
<%= render 'shared/title', name: t('.title') %>
<div class="row">
    <div class="col-md-12">
        <%= search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f| %>
        <div class="row">
            <div class="col-md-3">
                <div class="form-group">
                    <%= f.label :domain_name %>
                    <%= f.search_field :domain_name_matches, value: params[:q][:domain_name_matches], class: 'form-control', placeholder: t(:name) %>
                </div>
            </div>
            <div class="col-md-3">
                <div class="form-group">
                    <%= f.label t(:created_at_from) %>
                    <%= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:created_at_from) %>
                </div>
            </div>
            <div class="col-md-3">
                <div class="form-group">
                    <%= f.label t(:created_at_until) %>
                    <%= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:created_at_until) %>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-3">
                <div class="form-group">
                    <%= label_tag t(:results_per_page) %>
                    <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %>
                </div>
            </div>
            <div class="col-md-4" style="padding-top: 25px;">
                <button class="btn btn-primary">
                    &nbsp;
                    <span class="glyphicon glyphicon-search"></span>
                    &nbsp;
                </button>
                <%= link_to(t('.csv_btn'), admin_disputes_path(format: :csv, params: params.permit!), class: 'btn btn-default') %>
                <%= link_to(t('.reset_btn'), admin_disputes_path, class: 'btn btn-default') %>
            </div>
        </div>
        <% end %>
    </div>
</div>
<hr />
<p>Active disputes</p>
<div class="row">
    <div class="col-md-12">
        <div class="table-responsive">
            <table class="table table-hover table-bordered table-condensed">
                <thead>
                    <tr>
                        <th class="col-xs-2">
                            <%= sort_link(@q, 'domain_name') %>
                        </th>
                        <th class="col-xs-2">
                            <%= sort_link(@q, 'password') %>
                        </th>
                        <th class="col-xs-2">
                            <%= sort_link(@q, 'starts_at') %>
                        </th>
                        <th class="col-xs-2">
                            <%= sort_link(@q, 'expires_at') %>
                        </th>
                        <th class="col-xs-2">
                            <%= sort_link(@q, 'comment') %>
                        </th>
                        <th class="col-xs-2">
                            <%= t(:actions) %>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <% @disputes.each do |x| %>
                    <tr>
                        <td>
                            <%= x.domain_name %>
                        </td>
                        <td>
                            <%= x.password %>
                        </td>
                        <td>
                            <%= x.starts_at %>
                        </td>
                        <td>
                            <%= x.expires_at %>
                        </td>
                        <td>
                            <%= x.comment %>
                        </td>
                        <td>
                            <%= link_to t(:edit), edit_admin_dispute_path(id: x.id),
                                        class: 'btn btn-primary btn-xs' %>
                            <%= link_to t(:delete), delete_admin_dispute_path(id: x.id),
                                        data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs' %>
                        </td>
                    </tr>
                    <% end %>
                </tbody>
            </table>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-6">
        <%= paginate @disputes %>
    </div>
    <div class="col-md-6 text-right">
        <div class="pagination">
            <%= t(:result_count, count: @disputes.total_count) %>
        </div>
    </div>
</div>
<hr />
<p>Expired / Closed disputes</p>
<div class="row">
    <div class="col-md-12">
        <div class="table-responsive">
            <table class="table table-hover table-bordered table-condensed">
                <thead>
                    <tr>
                        <th class="col-xs-2">
                            <%= sort_link(@q, 'domain_name') %>
                        </th>
                        <th class="col-xs-2">
                            <%= sort_link(@q, 'initiator') %>
                        </th>
                        <th class="col-xs-2">
                            <%= sort_link(@q, 'starts_at') %>
                        </th>
                        <th class="col-xs-2">
                            <%= sort_link(@q, 'closed') %>
                        </th>
                        <th class="col-xs-2">
                            <%= sort_link(@q, 'comment') %>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <% @closed_disputes.each do |x| %>
                    <tr>
                        <td>
                            <%= x.domain_name %>
                        </td>
                        <td>
                            <%= x.initiator %>
                        </td>
                        <td>
                            <%= x.starts_at %>
                        </td>
                        <td>
                            <%= x.closed %>
                        </td>
                        <td>
                            <%= x.comment %>
                        </td>
                    </tr>
                    <% end %>
                </tbody>
            </table>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-6">
        <%= paginate @closed_disputes, param_name: :closed_page %>
    </div>
    <div class="col-md-6 text-right">
        <div class="pagination">
            <%= t(:result_count, count: @closed_disputes.total_count) %>
        </div>
    </div>
</div>