internetee/registry

View on GitHub
app/views/admin/reserved_domains/index2.haml

Summary

Maintainability
Test Coverage
- content_for :actions do
  = link_to(t('.new_btn'), new_admin_reserved_domain_path, class: 'btn btn-primary')
= render 'shared/title', name: t('.title')

.row
  .col-md-12
    = search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
      .row
        .col-md-3
          .form-group
            = f.label :name
            = f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
        .col-md-3
          .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)
        .col-md-3
          .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)
      .row
        .col-md-3
          .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)
        .col-md-4{style: 'padding-top: 25px;'}
          %button.btn.btn-primary
             
            %span.glyphicon.glyphicon-search
             
          = link_to(t('.csv_btn'), admin_reserved_domains_path(format: :csv, params: params.permit!), class: 'btn btn-default')
          = link_to(t('.reset_btn'), admin_reserved_domains_path, class: 'btn btn-default')
          = link_to 'Send to auction',release_to_auction_admin_reserved_domains_path, method: :post, class: 'btn btn-default', style: 'margin-top: 5px;'
%hr
.row
  .col-md-12
    .table-responsive
      %table.table.table-hover.table-bordered.table-condensed
        %thead
          %tr
            %th{class: 'col-xs-1'}
            %th{class: 'col-xs-2'}
              = sort_link(@q, 'name')
            %th{class: 'col-xs-2'}
              = sort_link(@q, 'password')
            %th{class: 'col-xs-2'}
              = sort_link(@q, 'created_at', t(:created_at))
            %th{class: 'col-xs-2'}
              = sort_link(@q, 'updated_at', t(:updated_at))
            %th{class: 'col-xs-2'}
              = t(:actions)
        %tbody
          - @domains.each do |x|
            %tr
              %td{class: 'text-center'}
                = check_box_tag "reserved_domains[domain_ids][]", x.id, false
              %td= x.name
              %td= x.password
              %td= l(x.created_at, format: :short)
              %td= l(x.updated_at, format: :short)
              %td
                = link_to(t(:edit_pw), edit_admin_reserved_domain_path(id: x.id),
                  class: 'btn btn-primary btn-xs')
                = link_to(t(:delete), delete_admin_reserved_domain_path(id: x.id),
                  data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs')
.row
  .col-md-6
    = paginate @domains
  .col-md-6.text-right
    .pagination
      = t(:result_count, count: @domains.total_count)