changed from multiple to single feature in registrar field

This commit is contained in:
Oleg Hasjanov 2021-07-06 11:36:49 +03:00
parent 13650ae37e
commit 83ae6e1584
4 changed files with 4 additions and 21 deletions

View file

@ -1,6 +1,5 @@
module Admin
class DomainsController < BaseController
include AdminDomains
before_action :set_domain, only: %i[show edit update keep]
authorize_resource
@ -14,9 +13,6 @@ module Admin
domains = Domain.includes(:registrar, :registrant)
end
domains = return_domains_which_related_to_registrars
normalize_search_parameters do
@q = domains.search(params[:q])
@domains = @q.result.page(params[:page])

View file

@ -1,13 +0,0 @@
module AdminDomains
extend ActiveSupport::Concern
def return_domains_which_related_to_registrars
if params[:registrar_id_eq]
domains = Domain.includes(:registrar, :registrant).where(
registrar: params[:registrar_id_eq]
)
else
domains = Domain.includes(:registrar, :registrant)
end
end
end

View file

@ -28,7 +28,7 @@
.col-md-3
.form-group
= label_tag t(:country)
= select_tag '[q][country_code_eq]', options_for_select(ApplicationController.helpers.all_country_options(params[:q][:country_code_eq]), params[:q][:country_code_eq]), { multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' }
= select_tag '[q][country_code_eq]', options_for_select(ApplicationController.helpers.all_country_options(params[:q][:country_code_eq]), params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control' }
.col-md-6
.form-group
= label_tag t(:contact_type)
@ -37,7 +37,7 @@
.col-md-3
.form-group
= f.label t(:registrar_name)
= f.select :registrar_id_eq, Registrar.all.map { |x| [x, x.id] }, { include_blank: true }, class: 'form-control js-combobox', placeholder: t(:choose)
= f.select :registrar_id_eq, Registrar.all.map { |x| [x, x.id] }, { include_blank: true }, class: 'form-control', placeholder: t(:choose)
.col-md-3
.form-group
= f.label t(:created_at_from)

View file

@ -29,7 +29,7 @@
<div class="col-md-5">
<div class="form-group">
<%= f.label :registrar_name, for: nil %>
<%= select_tag :registrar_id_eq, options_for_select(Registrar.all.map { |x| [x, x.id] }, params[:registrar_id_eq]), { multiple: true, class: 'form-control js-combobox' } %>
<%= select_tag 'q[registrar_id_eq]', options_for_select(Registrar.all.map { |x| [x, x.id] }, params[:q][:registrar_id_eq]), { include_blank:true, class: 'form-control' } %>
</div>
</div>
<div class="col-md-3">
@ -71,4 +71,4 @@
</div>
</div>
<% end %>
<% end %>