Refactor deprecated in rails 6.1 issues

This commit is contained in:
Alex Sherman 2021-05-03 13:40:42 +05:00
parent 83f3e14330
commit 39bbe6e06d
10 changed files with 122 additions and 50 deletions

View file

@ -35,14 +35,14 @@
.col-md-4.control-label
= f.label :country_code, t(:country), class: 'required'
.col-md-8
= f.select :country_code, SortedCountry.all_options(f.object.country_code), {}, required: true, class: 'form-control'
= f.select :country_code, ApplicationController.helpers.all_country_options(f.object.country_code), {}, required: true, class: 'form-control'
%hr
.form-group
.col-md-4.control-label
= f.label :role, nil, class: 'required'
.col-md-8
= select_tag 'admin_user[roles][]',
options_for_select(AdminUser::ROLES.map {|x| [t(x), x] },
= select_tag 'admin_user[roles][]',
options_for_select(AdminUser::ROLES.map {|x| [t(x), x] },
@admin_user.roles.try(:first)), class: 'form-control selectize'
%hr

View file

@ -28,7 +28,7 @@
.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' }
= select_tag '[q][country_code_eq]', ApplicationController.helpers.all_country_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' }
.col-md-6
.form-group
= label_tag t(:contact_type)

View file

@ -49,7 +49,7 @@
</div>
<div class="col-md-7">
<%= f.select :address_country_code,
SortedCountry.all_options(f.object.address_country_code), {},
ApplicationController.helpers.all_country_options(f.object.address_country_code), {},
required: true, class: 'form-control' %>
<span class="help-block"><%= t '.country_hint' %></span>
</div>
@ -59,4 +59,4 @@
</div>
</div>
</div>
</div>
</div>

View file

@ -40,7 +40,7 @@
<div class="col-md-3">
<div class="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' } %>
<%= select_tag '[q][country_code_eq]', ApplicationController.helpers.all_country_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' } %>
</div>
</div>

View file

@ -31,6 +31,6 @@
= f.label :country_code, t(:country) + '*'
.col-md-7
- country_selected = f.object.persisted? ? f.object.country_code : 'EE'
= f.select(:country_code, SortedCountry.all_options(country_selected),
= f.select(:country_code, SApplicationController.helpers.all_country_options(country_selected),
{ include_blank: true }, required: true)

View file

@ -19,7 +19,7 @@
= Country.new(f.object.ident_country_code).try(:to_s)
= " [#{f.object.ident_country_code}]"
- else
= f.select(:ident_country_code, SortedCountry.all_options(country_selected), {},
= f.select(:ident_country_code, ApplicationController.helpers.all_country_options(country_selected), {},
class: 'js-ident-country-code', required: true)
.form-group