mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 08:43:37 +02:00
Add more search fields to contact #2866
This commit is contained in:
parent
bc6c4213f7
commit
3600a9487e
3 changed files with 41 additions and 32 deletions
|
@ -9,7 +9,7 @@ class Admin::ContactsController < AdminController
|
|||
|
||||
if params[:statuses_contains]
|
||||
contacts = Contact.includes(:registrar).where(
|
||||
"statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
||||
"contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
||||
)
|
||||
else
|
||||
contacts = Contact.includes(:registrar)
|
||||
|
|
|
@ -1,18 +1,5 @@
|
|||
= render 'shared/title', name: t(:contacts)
|
||||
|
||||
/ .row
|
||||
/ .col-md-12
|
||||
/ = search_form_for [:admin, @q], html: { class: 'form-horizontal' } do |f|
|
||||
/ .col-md-11
|
||||
/ .form-group
|
||||
/ = f.search_field :name_cont, class: 'form-control'
|
||||
/ .col-md-1.text-right.text-center-xs
|
||||
/ .form-group
|
||||
/ %button.btn.btn-primary
|
||||
/
|
||||
/ %span.glyphicon.glyphicon-search
|
||||
/
|
||||
/ %hr
|
||||
.row
|
||||
.col-md-12
|
||||
= search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
|
||||
|
@ -29,10 +16,28 @@
|
|||
.form-group
|
||||
= f.label t(:ident)
|
||||
= f.search_field :ident_matches, class: 'form-control', placeholder: t(:ident)
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag t(:ident_type)
|
||||
= select_tag '[q][ident_type_eq]', options_for_select(Contact::IDENT_TYPES, params[:q][:ident_type_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' }
|
||||
.row
|
||||
.col-md-3
|
||||
.form-group
|
||||
= f.label t(:email)
|
||||
= f.search_field :email_matches, class: 'form-control', placeholder: t(:email)
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag t(:country)
|
||||
= select_tag '[q][country_code_eq]', SortedCountry.all_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' }
|
||||
.col-md-3
|
||||
.form-group
|
||||
= f.label t(:is_registrant)
|
||||
%div
|
||||
= f.check_box :registrant_domains_id_not_null
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag t(:contact_type)
|
||||
= select_tag '[q][domain_contacts_type_in]', options_for_select([['admin', 'AdminDomainContact'], ['tech', 'TechDomainContact']], params[:q][:domain_contacts_type_in]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
|
||||
.row
|
||||
.col-md-6
|
||||
.form-group
|
||||
|
@ -51,21 +56,17 @@
|
|||
.form-group
|
||||
= label_tag t(:status)
|
||||
= select_tag :statuses_contains, options_for_select(Contact::STATUSES, params[:statuses_contains]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
|
||||
.col-md-6
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag t(:status)
|
||||
= select_tag '[q][domain_contacts_type_in]', options_for_select(['AdminDomainContact', 'TechDomainContact'], params[:q][:domain_contacts_type_in]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
|
||||
/ .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-3{style: 'padding-top: 25px;'}
|
||||
%button.btn.btn-primary
|
||||
|
||||
%span.glyphicon.glyphicon-search
|
||||
|
||||
%button.btn.btn-default.js-reset-form
|
||||
= t(:clear_fields)
|
||||
= 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-3{style: 'padding-top: 25px;'}
|
||||
%button.btn.btn-primary
|
||||
|
||||
%span.glyphicon.glyphicon-search
|
||||
|
||||
%button.btn.btn-default.js-reset-form
|
||||
= t(:clear_fields)
|
||||
%hr
|
||||
.row
|
||||
.col-md-12
|
||||
|
@ -80,7 +81,7 @@
|
|||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'ident', t(:ident))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'email', t(:email))
|
||||
= sort_link(@q, 'email', t(:created_at))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'registrar_name', t(:registrar))
|
||||
%tbody
|
||||
|
@ -89,11 +90,19 @@
|
|||
%td= link_to(contact, admin_contact_path(contact))
|
||||
%td= contact.code
|
||||
%td= ident_for(contact)
|
||||
%td= contact.email
|
||||
%td= l(contact.created_at, format: :short)
|
||||
%td
|
||||
- if contact.registrar
|
||||
= link_to(contact.registrar, admin_registrar_path(contact.registrar))
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
.col-md-6
|
||||
= paginate @contacts
|
||||
.col-md-6.text-right
|
||||
.pagination
|
||||
= t(:result_count, count: @contacts.total_count)
|
||||
|
||||
:coffee
|
||||
$(".js-reset-form").on "click", (e) ->
|
||||
e.preventDefault();
|
||||
window.location = "#{admin_contacts_path}"
|
||||
|
|
|
@ -641,7 +641,6 @@ en:
|
|||
value: 'Value'
|
||||
phone: 'Phone'
|
||||
org_name: Org name
|
||||
ident_type: Ident code
|
||||
country: Country
|
||||
period: Period
|
||||
birthday_format: 'Insert birthday in format: YYYY-MM-DD'
|
||||
|
@ -913,3 +912,4 @@ en:
|
|||
hidden: '[hidden]'
|
||||
created_at_from: 'Created at from'
|
||||
created_at_until: 'Created at until'
|
||||
is_registrant: 'Is registrant'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue