Skip to content

Commit

Permalink
move selector to partial
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriyAndriyovuch committed Sep 19, 2023
1 parent 0ef8a09 commit a813665
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
6 changes: 1 addition & 5 deletions app/views/account/calculators/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
i.fa.fa-plus.mr-2
span =t('.add_calculator_button')

p.d-inline.mr-3
= t('sort.sort_by')
div.d-inline-block
= form_with method: :get do |form|
= form.select :sort, calculators_criterias, { selected: params[:sort], include_blank: true }, class: 'form-control mr-5', onchange: 'this.form.submit()'
= render 'account/shared/sort_selector', criterias: calculators_criterias

table.table.admin-table
thead
Expand Down
6 changes: 1 addition & 5 deletions app/views/account/products/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
i.fa.fa-plus.mr-2
span =t('.add_product_button')

p.d-inline.mr-3
= t('sort.sort_by')
div.d-inline-block
= form_with method: :get do |form|
= form.select :sort, products_criterias, { selected: params[:sort], include_blank: true }, class: 'form-control mr-5', onchange: 'this.form.submit()'
= render 'account/shared/sort_selector', criterias: products_criterias

table.table
thead
Expand Down
9 changes: 9 additions & 0 deletions app/views/account/shared/_sort_selector.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<p class="d-inline mr-3">
<%= t('sort.sort_by') %>
</p>

<div class="d-inline-block">
<%= form_with method: :get do |form| %>
<%= form.select :sort, criterias, { selected: params[:sort], include_blank: true }, class: 'form-control mr-5', onchange: 'this.form.submit()' %>
<% end %>
</div>
8 changes: 1 addition & 7 deletions app/views/account/users/index.html.slim
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
div class="container home"


.row
.col
p.d-inline.mr-3
= t('sort.sort_by')
div.d-inline-block
= form_with method: :get do |form|
= form.select :sort, users_criterias, { selected: params[:sort], include_blank: true }, class: 'form-control mr-5', onchange: 'this.form.submit()'
= render 'account/shared/sort_selector', criterias: users_criterias

h3.d-inline.float-right.mt-3
= link_to icon('fa-solid', 'download'), account_users_path(format: "csv")
Expand Down

0 comments on commit a813665

Please sign in to comment.