internetee/registry

View on GitHub
app/views/admin/registrars/show/_white_ips.html.erb

Summary

Maintainability
Test Coverage
<div class="panel panel-default white_ips">
    <div class="panel-heading">
        <%= t '.header' %>
    </div>

    <table class="table table-hover table-bordered table-condensed">
        <thead>
            <tr>
                <th class="col-xs-4"><%= WhiteIp.human_attribute_name :ipv4 %></th>
                <th class="col-xs-6"><%= WhiteIp.human_attribute_name :ipv6 %></th>
                <th class="col-xs-2"><%= WhiteIp.human_attribute_name :interfaces %></th>
                <th class="col-xs-2"><%= WhiteIp.human_attribute_name :committed %></th>
            </tr>
        </thead>

        <tbody>
            <% registrar.white_ips.each do |white_ip| %>
                <tr>
                    <td>
                        <% if white_ip.ipv4.present? %>
                            <%= link_to(white_ip.ipv4, [:admin, registrar, white_ip]) %>
                        <% end %>
                    </td>
                    <td>
                        <% if white_ip.ipv6.present? %>
                            <%= link_to(white_ip.ipv6, [:admin, registrar, white_ip]) %>
                        <% end %>
                    </td>
                    <td><%= white_ip.interfaces.join(', ').upcase %></td>
                    <td class="text-right"><%= white_ip.committed %></td>
                </tr>
            <% end %>
        </tbody>
    </table>

    <div class="panel-footer text-right">
        <%= link_to t('.new_btn'), new_admin_registrar_white_ip_path(registrar),
                    class: 'btn btn-default btn-xs' %>
        <%= link_to 'Export to CSV', export_admin_registrar_path(registrar, records: 'white_ips', format: :csv),
                    class: 'btn btn-default btn-xs' if registrar.white_ips.any? %>
    </div>
</div>