internetee/registry

View on GitHub
app/views/admin/epp_logs/index.haml

Summary

Maintainability
Test Coverage
= render 'shared/title', name: t('.title')

.row
  .col-md-12
    %hr
    = search_form_for @q, url: [:admin, :epp_logs], html: { style: 'margin-bottom: 0;', class: 'js-form' } do |f|
      .row
        .col-md-3
          .form-group
            = f.label :request_command
            = f.select :request_command_eq, [[t(:choose),''], 'hello', 'login', 'logout', 'info', 'create', 'update', 'delete', 'check', 'renew', 'transfer', 'poll'], {}, class: 'form-control js-combobox', placeholder: t(:choose)
        .col-md-3
          .form-group
            - opts  = [[t(:choose),''], 'contact', 'domain', 'poll']
            - opts += [params[:q][:request_object_cont]] if params[:q].present? && params[:q][:request_object_cont].present?
            = f.label :request_object
            = f.select :request_object_cont, opts, {}, class: 'form-control selectize_create', placeholder: t(:choose)
        .col-md-3
          .form-group
            = f.label :request_successful
            = f.select :request_successful_true, [[t(:choose), ''], 'true', 'false'], {}, class: 'form-control js-combobox', placeholder: t(:choose)
        .col-md-3
          .form-group
            = f.label :api_user
            = f.search_field :api_user_name_matches, value: params[:q][:api_user_name_matches], class: 'form-control', placeholder: t(:api_user), autocomplete: 'off'
      .row
        .col-md-3
          .form-group
            = f.label :registrar
            = f.select :api_user_registrar_matches, Registrar.all.map { |x| [x, x.name] }, { include_blank: true }, class: 'form-control', placeholder: t(:choose)
        .col-md-3
          .form-group
            = f.label t(:created_after)
            = f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:created_after)
        .col-md-3
          .form-group
            = f.label t(:created_before)
            = f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:created_before)
        .col-md-3{style: 'padding-top: 25px;float:right;padding-right: 0px;'}
          %button.btn.btn-primary
             
            %span.glyphicon.glyphicon-search
             
          = link_to(t('.csv_btn'), admin_epp_logs_path(format: :csv, params: params.permit!), class: 'btn btn-default')
          = link_to(t('.reset_btn'), admin_epp_logs_path, class: 'btn btn-default')
.row
  .col-md-12
    %hr
    = paginate @epp_logs
    .pull-right
      .pagination
        = t(:result_count, count: @epp_logs.total_count) if @epp_logs.total_count.positive?
    .row
    .table-responsive
      %table.table.table-hover.table-bordered.table-condensed
        %thead
          %tr
            %th{class: 'col-xs-2'}= t(:request_command)
            %th{class: 'col-xs-2'}= t(:request_object)
            %th{class: 'col-xs-2'}= t(:request_successful)
            %th{class: 'col-xs-2'}= t(:api_user)
            %th{class: 'col-xs-2'}= t(:registrar_name)
            %th{class: 'col-xs-2'}
              = sort_link(@q, 'created_at')
        %tbody
          - @epp_logs.each do |x|
            %tr
              %td= link_to(x.request_command, admin_epp_log_path(x))
              %td= x.request_object
              %td= x.request_successful
              %td= x.api_user_name
              %td= x.api_user_registrar
              %td= l(x.created_at)
.row
  .col-md-12
    = paginate @epp_logs
    .pull-right
      .pagination
        = t(:result_count, count: @epp_logs.total_count) if @epp_logs.total_count.positive?