mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Add statuses to domain search #2122
This commit is contained in:
parent
0bdb0f17b5
commit
79617da2c3
4 changed files with 18 additions and 3 deletions
|
@ -8,5 +8,6 @@
|
||||||
#= require selectize
|
#= require selectize
|
||||||
#= require shared/jquery.validate.bootstrap
|
#= require shared/jquery.validate.bootstrap
|
||||||
#= require jquery-ui/datepicker
|
#= require jquery-ui/datepicker
|
||||||
|
#= require select2
|
||||||
#= require shared/general
|
#= require shared/general
|
||||||
#= require admin/application
|
#= require admin/application
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
//= require 'shared/general-manifest'
|
//= require 'shared/general-manifest'
|
||||||
//= require 'admin/admin-bootstrap'
|
//= require 'admin/admin-bootstrap'
|
||||||
//= require 'jquery-ui/datepicker'
|
//= require 'jquery-ui/datepicker'
|
||||||
|
//= require 'select2'
|
||||||
|
//= require 'select2-bootstrap'
|
||||||
@import shared/fonts
|
@import shared/fonts
|
||||||
@import shared/general
|
@import shared/general
|
||||||
@import nprogress
|
@import nprogress
|
||||||
|
|
|
@ -3,7 +3,15 @@ class Admin::DomainsController < AdminController
|
||||||
before_action :set_domain, only: [:show, :edit, :update, :zonefile]
|
before_action :set_domain, only: [:show, :edit, :update, :zonefile]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@q = Domain.includes(:registrar, :registrant).search(params[:q])
|
params[:q] ||= {}
|
||||||
|
if params[:q][:statuses_contains]
|
||||||
|
domains = Domain.includes(:registrar, :registrant).where(
|
||||||
|
"statuses @> ?::varchar[]", "{#{params[:q][:statuses_contains].join(',')}}"
|
||||||
|
)
|
||||||
|
else
|
||||||
|
domains = Domain.includes(:registrar, :registrant)
|
||||||
|
end
|
||||||
|
@q = domains.search(params[:q])
|
||||||
@domains = @q.result.page(params[:page])
|
@domains = @q.result.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,15 +8,19 @@
|
||||||
.form-group
|
.form-group
|
||||||
= f.label :name
|
= f.label :name
|
||||||
= f.search_field :name_cont, class: 'form-control', placeholder: t(:name)
|
= f.search_field :name_cont, class: 'form-control', placeholder: t(:name)
|
||||||
|
.col-md-8
|
||||||
|
.form-group
|
||||||
|
= label_tag t(:status)
|
||||||
|
= select_tag 'q[statuses_contains]', options_for_select(DomainStatus::STATUSES, params[:q][:statuses_contains]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
|
||||||
|
.row
|
||||||
.col-md-4
|
.col-md-4
|
||||||
.form-group
|
.form-group
|
||||||
= f.label t(:registrar)
|
= f.label t(:registrar)
|
||||||
= f.select :registrar_id_eq, Registrar.all.map { |x| [x, x.id] }, {}, class: 'form-control selectize', placeholder: t(:choose)
|
= f.select :registrar_id_eq, Registrar.all.map { |x| [x, x.id] }, { include_blank: true }, class: 'form-control selectize', placeholder: t(:choose)
|
||||||
.col-md-4
|
.col-md-4
|
||||||
.form-group
|
.form-group
|
||||||
= f.label t(:registrant_ident)
|
= f.label t(:registrant_ident)
|
||||||
= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident)
|
= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident)
|
||||||
.row
|
|
||||||
.col-md-3
|
.col-md-3
|
||||||
.form-group
|
.form-group
|
||||||
= f.label t(:valid_to_from)
|
= f.label t(:valid_to_from)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue