From f148fb9aa0c1e459270f9a76e1b32d68b5a90dc4 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Mon, 15 Jan 2018 11:05:15 +0200 Subject: [PATCH] Extract partial --- app/views/admin/domains/_search_form.html.erb | 70 ++++++++++++++++++ app/views/admin/domains/index.html.erb | 71 +------------------ config/locales/admin/domains.en.yml | 4 +- 3 files changed, 74 insertions(+), 71 deletions(-) create mode 100644 app/views/admin/domains/_search_form.html.erb diff --git a/app/views/admin/domains/_search_form.html.erb b/app/views/admin/domains/_search_form.html.erb new file mode 100644 index 000000000..e1a91af57 --- /dev/null +++ b/app/views/admin/domains/_search_form.html.erb @@ -0,0 +1,70 @@ +<%= search_form_for [:admin, @q], html: { class: 'search-form', autocomplete: 'off' } do |f| %> +
+
+
+ <%= f.label :name %> + <%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name) %> +
+
+
+
+ <%= f.label t(:registrant_ident) %> + <%= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident) %> +
+
+
+
+ <%= f.label t(:contact_ident) %> + <%= f.search_field :contacts_ident_eq, class: 'form-control', placeholder: t(:contact_ident) %> +
+
+
+
+ <%= f.label t(:nameserver_hostname) %> + <%= f.search_field :nameservers_hostname_eq, class: 'form-control', placeholder: t(:nameserver_hostname) %> +
+
+
+
+
+
+ <%= f.label t(:registrar_name) %> + <%= f.select :registrar_id_eq, Registrar.all.map { |x| [x, x.id] }, { include_blank: true }, class: 'form-control selectize', placeholder: t(:choose) %> +
+
+
+
+ <%= f.label t(:valid_to_from) %> + <%= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_from) %> +
+
+
+
+ <%= f.label t(:valid_to_until) %> + <%= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_until) %> +
+
+
+
+
+
+ <%= label_tag t(:status) %> + <%= select_tag :statuses_contains, options_for_select(DomainStatus::STATUSES, params[:statuses_contains]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' } %> +
+
+
+
+ <%= label_tag t(:results_per_page) %> + <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %> +
+
+
+ + <%= link_to(t('.reset_btn'), admin_domains_path, class: 'btn btn-default') %> +
+
+<% end %> diff --git a/app/views/admin/domains/index.html.erb b/app/views/admin/domains/index.html.erb index 4480b9cd9..39199872e 100644 --- a/app/views/admin/domains/index.html.erb +++ b/app/views/admin/domains/index.html.erb @@ -4,76 +4,7 @@
- <%= search_form_for [:admin, @q], html: { class: 'search-form', autocomplete: 'off' } do |f| %> -
-
-
- <%= f.label :name %> - <%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name) %> -
-
-
-
- <%= f.label t(:registrant_ident) %> - <%= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident) %> -
-
-
-
- <%= f.label t(:contact_ident) %> - <%= f.search_field :contacts_ident_eq, class: 'form-control', placeholder: t(:contact_ident) %> -
-
-
-
- <%= f.label t(:nameserver_hostname) %> - <%= f.search_field :nameservers_hostname_eq, class: 'form-control', placeholder: t(:nameserver_hostname) %> -
-
-
-
-
-
- <%= f.label t(:registrar_name) %> - <%= f.select :registrar_id_eq, Registrar.all.map { |x| [x, x.id] }, { include_blank: true }, class: 'form-control selectize', placeholder: t(:choose) %> -
-
-
-
- <%= f.label t(:valid_to_from) %> - <%= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_from) %> -
-
-
-
- <%= f.label t(:valid_to_until) %> - <%= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_until) %> -
-
-
-
-
-
- <%= label_tag t(:status) %> - <%= select_tag :statuses_contains, options_for_select(DomainStatus::STATUSES, params[:statuses_contains]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' } %> -
-
-
-
- <%= label_tag t(:results_per_page) %> - <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %> -
-
-
- - <%= link_to(t('.reset_btn'), admin_domains_path, class: 'btn btn-default') %> -
-
- <% end %> + <%= render 'search_form' %>

diff --git a/config/locales/admin/domains.en.yml b/config/locales/admin/domains.en.yml index 58d2bdc55..be26a5542 100644 --- a/config/locales/admin/domains.en.yml +++ b/config/locales/admin/domains.en.yml @@ -3,9 +3,11 @@ en: domains: index: header: Domains - reset_btn: Reset registrant: Registrant + search_form: + reset_btn: Reset + edit: add_new_status_btn: Add new status back_btn: Back to domain