diff --git a/app/controllers/admin/budget_investments_controller.rb b/app/controllers/admin/budget_investments_controller.rb index c4d68ae43..cb760d43b 100644 --- a/app/controllers/admin/budget_investments_controller.rb +++ b/app/controllers/admin/budget_investments_controller.rb @@ -6,19 +6,18 @@ class Admin::BudgetInvestmentsController < Admin::BaseController feature_flag :budgets has_orders %w[oldest], only: [:show, :edit] - has_filters %w[all], only: [:index, :toggle_selection] + has_filters %w[all], only: :index before_action :load_budget before_action :load_investment, only: [:show, :edit, :update, :toggle_selection] before_action :load_ballot, only: [:show, :index] before_action :parse_valuation_filters - before_action :load_investments, only: [:index, :toggle_selection] + before_action :load_investments, only: :index def index load_tags respond_to do |format| format.html - format.js format.csv do send_data Budget::Investment::Exporter.new(@investments).to_csv, filename: "budget_investments.csv" @@ -65,7 +64,6 @@ class Admin::BudgetInvestmentsController < Admin::BaseController authorize! :toggle_selection, @investment @investment.toggle :selected @investment.save! - load_investments end private diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb index 05559b935..073abb90d 100644 --- a/app/views/admin/budget_investments/_investments.html.erb +++ b/app/views/admin/budget_investments/_investments.html.erb @@ -1,62 +1,64 @@ -<%= link_to t("admin.budget_investments.index.download_current_selection"), - admin_budget_budget_investments_path(csv_params), - class: "float-right small clear" %> +
+ <%= link_to t("admin.budget_investments.index.download_current_selection"), + admin_budget_budget_investments_path(csv_params), + class: "float-right small clear" %> -<% if params[:advanced_filters].include?("winners") %> - <%= render Admin::Budgets::CalculateWinnersButtonComponent.new(@budget, from_investments: true) %> -<% end %> + <% if params[:advanced_filters].include?("winners") %> + <%= render Admin::Budgets::CalculateWinnersButtonComponent.new(@budget, from_investments: true) %> + <% end %> -<% if @investments.any? %> -

<%= page_entries_info @investments %>

- <%= render "admin/shared/columns_selector", - cookie: "investments-columns", - default: %w[id title supports admin valuator geozone feasibility price valuation_finished visible_to_valuators selected incompatible] %> -
+ <% if @investments.any? %> +

<%= page_entries_info @investments %>

+ <%= render "admin/shared/columns_selector", + cookie: "investments-columns", + default: %w[id title supports admin valuator geozone feasibility price valuation_finished visible_to_valuators selected incompatible] %> +
- <%= render "filters_description", i18n_namespace: "admin.budget_investments.index" %> + <%= render "filters_description", i18n_namespace: "admin.budget_investments.index" %> - - - - - - - - - - - - <% if @budget.show_money? %> - +
<%= link_to_investments_sorted_by :id %><%= link_to_investments_sorted_by :title %><%= link_to_investments_sorted_by :supports %><%= t("admin.budget_investments.index.list.admin") %> - <%= t("admin.budget_investments.index.list.author") %> - - <%= t("admin.budget_investments.index.list.valuation_group") %> / - <%= t("admin.budget_investments.index.list.valuator") %> - <%= t("admin.budget_investments.index.list.geozone") %><%= t("admin.budget_investments.index.list.feasibility") %><%= t("admin.budget_investments.index.list.price") %>
+ + + + + + + + + + + <% if @budget.show_money? %> + + <% end %> + + + + <% if params[:advanced_filters]&.include?("selected") %> + + <% end %> + + + + + <% @investments.each do |investment| %> + <%= render Admin::BudgetInvestments::RowComponent.new(investment) %> <% end %> - - - - <% if params[:advanced_filters]&.include?("selected") %> - - <% end %> - - + +
<%= link_to_investments_sorted_by :id %><%= link_to_investments_sorted_by :title %><%= link_to_investments_sorted_by :supports %><%= t("admin.budget_investments.index.list.admin") %> + <%= t("admin.budget_investments.index.list.author") %> + + <%= t("admin.budget_investments.index.list.valuation_group") %> / + <%= t("admin.budget_investments.index.list.valuator") %> + <%= t("admin.budget_investments.index.list.geozone") %><%= t("admin.budget_investments.index.list.feasibility") %><%= t("admin.budget_investments.index.list.price") %> + <%= t("admin.budget_investments.index.list.valuation_finished") %> + + <%= t("admin.budget_investments.index.list.visible_to_valuators") %> + <%= t("admin.budget_investments.index.list.selected") %><%= t("admin.budget_investments.index.list.incompatible") %>
- <%= t("admin.budget_investments.index.list.valuation_finished") %> - - <%= t("admin.budget_investments.index.list.visible_to_valuators") %> - <%= t("admin.budget_investments.index.list.selected") %><%= t("admin.budget_investments.index.list.incompatible") %>
- - <% @investments.each do |investment| %> - <%= render Admin::BudgetInvestments::RowComponent.new(investment) %> - <% end %> - - - - <%= paginate @investments %> -<% else %> -
- <%= t("admin.budget_investments.index.no_budget_investments") %> -
-<% end %> + <%= paginate @investments %> + <% else %> +
+ <%= t("admin.budget_investments.index.no_budget_investments") %> +
+ <% end %> +
diff --git a/app/views/admin/budget_investments/index.html.erb b/app/views/admin/budget_investments/index.html.erb index 4878421cd..bfd50f9e8 100644 --- a/app/views/admin/budget_investments/index.html.erb +++ b/app/views/admin/budget_investments/index.html.erb @@ -12,6 +12,4 @@ <%= render "/shared/filter_subnav", i18n_namespace: "admin.budget_investments.index" %> -
- <%= render "investments" %> -
+<%= render "investments" %> diff --git a/app/views/admin/budget_investments/index.js.erb b/app/views/admin/budget_investments/index.js.erb deleted file mode 100644 index c1569cc59..000000000 --- a/app/views/admin/budget_investments/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$("#investments").html("<%= j render("admin/budget_investments/investments") %>");