Refactor Admin::Budget::Investment search form to use one form tag
This commit is contained in:
@@ -1,45 +0,0 @@
|
|||||||
<%= link_to "#advanced_filters_content",
|
|
||||||
data: {toggle: "advanced_filters"},
|
|
||||||
class: "advanced-filters float-right clear" do %>
|
|
||||||
<%= t("admin.budget_investments.index.advanced_filters") %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div id="advanced_filters" class="row expanded advanced-filters-content hide" data-toggler=".hide">
|
|
||||||
<%= form_tag(admin_budget_budget_investments_path(budget: @budget,
|
|
||||||
filter: params[:filter],
|
|
||||||
sort_by: params[:sort_by],
|
|
||||||
max_per_heading: params[:max_per_heading],
|
|
||||||
advanced_filters: params[:advanced_filters],
|
|
||||||
page: 1), method: :get, remote: true, enforce_utf8: false) do %>
|
|
||||||
<div class="small-12 medium-8 large-10 column">
|
|
||||||
<span class="filter">
|
|
||||||
<%= check_box_tag "advanced_filters[]", "feasible" %>
|
|
||||||
<%= t("#{i18n_namespace}.filters.feasible") %>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span class="filter">
|
|
||||||
<%= check_box_tag "advanced_filters[]", "selected" %>
|
|
||||||
<%= t("#{i18n_namespace}.filters.selected") %>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span class="filter">
|
|
||||||
<%= check_box_tag "advanced_filters[]", "undecided" %>
|
|
||||||
<%= t("#{i18n_namespace}.filters.undecided") %>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span class="filter">
|
|
||||||
<%= check_box_tag "advanced_filters[]", "unfeasible" %>
|
|
||||||
<%= t("#{i18n_namespace}.filters.unfeasible") %>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span class="filter">
|
|
||||||
<strong><%= t("#{i18n_namespace}.filters.max_per_heading") %></strong>
|
|
||||||
<%= text_field_tag :max_per_heading %>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="small-12 medium-4 large-2 column">
|
|
||||||
<%= submit_tag t("admin.budget_investments.index.buttons.filter"), class: "button expanded" %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
@@ -1,12 +1,64 @@
|
|||||||
<div class="small-12 medium-6">
|
<% i18n_namespace = "admin.budget_investments.index" %>
|
||||||
<%= form_for(Budget::Investment.new, url: admin_budget_budget_investments_path(budget: @budget),
|
|
||||||
method: :get,
|
<%= form_tag(admin_budget_budget_investments_path(budget: @budget), method: :get, enforce_utf8: false) do %>
|
||||||
remote: true) do |f| %>
|
<div class="row">
|
||||||
|
<div class="small-12 medium-8 large-12 column">
|
||||||
|
<%= link_to "#advanced_filters_content",
|
||||||
|
data: {toggle: "advanced_filters"},
|
||||||
|
class: "advanced-filters float-right clear" do %>
|
||||||
|
<%= t("#{i18n_namespace}.advanced_filters") %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="advanced_filters" class="row advanced-filters-content hide" data-toggler=".hide">
|
||||||
|
<% ["feasible", "selected", "undecided", "unfeasible"].each do |option| %>
|
||||||
|
<div class="small-2 medium-2 large-2 column">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<%= text_field_tag :title_or_id, "", placeholder: t("admin.budget_investments.index.placeholder") %>
|
<%= check_box_tag "advanced_filters[]", option, false, id: "advanced_filters_#{option}" %>
|
||||||
<div class="input-group-button">
|
<%= t("#{i18n_namespace}.filters.#{option}") %>
|
||||||
<%= f.submit t("admin.budget_investments.index.buttons.search"), class: "button" %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<div class="small-4 medium-4 large-4 column">
|
||||||
|
<div class="input-group">
|
||||||
|
<%= text_field_tag :max_per_heading, "", placeholder: t("#{i18n_namespace}.filters.max_per_heading") %>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" >
|
||||||
|
<div class="small-12 medium-3 column">
|
||||||
|
<%= select_tag :administrator_id,
|
||||||
|
options_for_select(admin_select_options, params[:administrator_id]),
|
||||||
|
{ prompt: t("#{i18n_namespace}.administrator_filter_all"),
|
||||||
|
label: false} %>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-3 column">
|
||||||
|
<%= select_tag :valuator_or_group_id,
|
||||||
|
options_for_select(valuator_or_group_select_options, params[:valuator_or_group_id]),
|
||||||
|
{ prompt: t("#{i18n_namespace}.valuator_filter_all"),
|
||||||
|
label: false} %>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-3 column">
|
||||||
|
<%= select_tag :heading_id,
|
||||||
|
options_for_select(budget_heading_select_options(@budget), params[:heading_id]),
|
||||||
|
{ prompt: t("#{i18n_namespace}.heading_filter_all"),
|
||||||
|
label: false} %>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-3 column">
|
||||||
|
<%= select_tag :tag_name,
|
||||||
|
options_for_select(investment_tags_select_options(@budget), params[:tag_name]),
|
||||||
|
{ prompt: t("#{i18n_namespace}.tags_filter_all"),
|
||||||
|
label: false} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" >
|
||||||
|
<div class="small-12 medium-6 column">
|
||||||
|
<div class="input-group">
|
||||||
|
<%= text_field_tag :title_or_id, "", placeholder: t("#{i18n_namespace}.placeholder") %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-6 column">
|
||||||
|
<%= submit_tag t("#{i18n_namespace}.buttons.filter"), class: "button expanded" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|||||||
@@ -8,42 +8,6 @@
|
|||||||
|
|
||||||
<%= render "search_form" %>
|
<%= render "search_form" %>
|
||||||
|
|
||||||
<%= form_tag(admin_budget_budget_investments_path(budget: @budget), method: :get, enforce_utf8: false) do %>
|
|
||||||
<div class="small-12 medium-3 column">
|
|
||||||
<%= select_tag :administrator_id,
|
|
||||||
options_for_select(admin_select_options, params[:administrator_id]),
|
|
||||||
{ prompt: t("admin.budget_investments.index.administrator_filter_all"),
|
|
||||||
label: false,
|
|
||||||
class: "js-submit-on-change" } %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="small-12 medium-3 column">
|
|
||||||
<%= select_tag :valuator_or_group_id,
|
|
||||||
options_for_select(valuator_or_group_select_options, params[:valuator_or_group_id]),
|
|
||||||
{ prompt: t("admin.budget_investments.index.valuator_filter_all"),
|
|
||||||
label: false,
|
|
||||||
class: "js-submit-on-change" } %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="small-12 medium-3 column">
|
|
||||||
<%= select_tag :heading_id,
|
|
||||||
options_for_select(budget_heading_select_options(@budget), params[:heading_id]),
|
|
||||||
{ prompt: t("admin.budget_investments.index.heading_filter_all"),
|
|
||||||
label: false,
|
|
||||||
class: "js-submit-on-change" } %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="small-12 medium-3 column">
|
|
||||||
<%= select_tag :tag_name,
|
|
||||||
options_for_select(investment_tags_select_options(@budget), params[:tag_name]),
|
|
||||||
{ prompt: t("admin.budget_investments.index.tags_filter_all"),
|
|
||||||
label: false,
|
|
||||||
class: "js-submit-on-change" } %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= render "advanced_filters", i18n_namespace: "admin.budget_investments.index" %>
|
|
||||||
|
|
||||||
<%= render "/shared/filter_subnav", i18n_namespace: "admin.budget_investments.index" %>
|
<%= render "/shared/filter_subnav", i18n_namespace: "admin.budget_investments.index" %>
|
||||||
|
|
||||||
<div id="investments">
|
<div id="investments">
|
||||||
|
|||||||
Reference in New Issue
Block a user