From 4af630967c5194c6266dc2db595ef2376ba534e8 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Tue, 5 Nov 2019 15:21:31 +0200 Subject: [PATCH] Extract partial --- .../account_activities/_search_form.html.haml | 36 ++++++++++++++++++ app/views/admin/account_activities/index.haml | 37 +------------------ .../locales/admin/account_activities.en.yml | 2 +- 3 files changed, 38 insertions(+), 37 deletions(-) create mode 100644 app/views/admin/account_activities/_search_form.html.haml diff --git a/app/views/admin/account_activities/_search_form.html.haml b/app/views/admin/account_activities/_search_form.html.haml new file mode 100644 index 000000000..d022542b1 --- /dev/null +++ b/app/views/admin/account_activities/_search_form.html.haml @@ -0,0 +1,36 @@ +.row + .col-md-12 + = search_form_for @q, url: [:admin, :account_activities], html: { style: 'margin-bottom: 0;' } do |f| + .row + .col-md-12 + .form-group + = f.label t(:registrar_name) + = f.select :account_registrar_id_in, Registrar.all.map { |x| [x, x.id] }, {}, class: 'form-control js-combobox', placeholder: t(:choose), multiple: true + .row + .col-md-6 + .form-group + = f.label t(:activity_type) + = f.select :activity_type_in, AccountActivity.types_for_select, {}, class: 'form-control js-combobox', placeholder: t(:choose), multiple: true + .col-md-6 + .form-group + = f.label t(:description) + = f.search_field :description_cont, class: 'form-control', placeholder: t(:description), autocomplete: 'off' + .row + .col-md-3 + .form-group + = f.label t(:receipt_date_from) + = f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:receipt_date_from) + .col-md-3 + .form-group + = f.label t(:receipt_date_until) + = f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:receipt_date_until) + .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-default.search +   + %span.glyphicon.glyphicon-search +   + = link_to(t('.reset_btn'), admin_account_activities_path, class: 'btn btn-default') diff --git a/app/views/admin/account_activities/index.haml b/app/views/admin/account_activities/index.haml index 1f201f255..df84b2757 100644 --- a/app/views/admin/account_activities/index.haml +++ b/app/views/admin/account_activities/index.haml @@ -2,43 +2,8 @@ = link_to(t(:export_csv), url_for(params.merge(format: 'csv')), class: 'btn btn-default') = render 'shared/title', name: t(:account_activities) += render 'search_form' -.row - .col-md-12 - = search_form_for @q, url: [:admin, :account_activities], html: { style: 'margin-bottom: 0;' } do |f| - .row - .col-md-12 - .form-group - = f.label t(:registrar_name) - = f.select :account_registrar_id_in, Registrar.all.map { |x| [x, x.id] }, {}, class: 'form-control js-combobox', placeholder: t(:choose), multiple: true - .row - .col-md-6 - .form-group - = f.label t(:activity_type) - = f.select :activity_type_in, AccountActivity.types_for_select, {}, class: 'form-control js-combobox', placeholder: t(:choose), multiple: true - .col-md-6 - .form-group - = f.label t(:description) - = f.search_field :description_cont, class: 'form-control', placeholder: t(:description), autocomplete: 'off' - .row - .col-md-3 - .form-group - = f.label t(:receipt_date_from) - = f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:receipt_date_from) - .col-md-3 - .form-group - = f.label t(:receipt_date_until) - = f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:receipt_date_until) - .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-default.search -   - %span.glyphicon.glyphicon-search -   - = link_to(t('.reset_btn'), admin_account_activities_path, class: 'btn btn-default') .row .col-md-3 .col-md-3 diff --git a/config/locales/admin/account_activities.en.yml b/config/locales/admin/account_activities.en.yml index 2e91e7a8f..2006f2f36 100644 --- a/config/locales/admin/account_activities.en.yml +++ b/config/locales/admin/account_activities.en.yml @@ -1,5 +1,5 @@ en: admin: account_activities: - index: + search_form: reset_btn: Reset