Extracts code to partial. Adds remote links
This commit is contained in:
77
app/views/admin/budget_investments/_investments.html.erb
Normal file
77
app/views/admin/budget_investments/_investments.html.erb
Normal file
@@ -0,0 +1,77 @@
|
||||
<h3><%= page_entries_info @investments %></h3>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.budget_investments.index.table_id") %></th>
|
||||
<th><%= t("admin.budget_investments.index.table_title") %></th>
|
||||
<th><%= t("admin.budget_investments.index.table_admin") %></th>
|
||||
<th><%= t("admin.budget_investments.index.table_valuator") %></th>
|
||||
<th><%= t("admin.budget_investments.index.table_geozone") %></th>
|
||||
<th><%= t("admin.budget_investments.index.table_feasibility") %></th>
|
||||
<th class="text-center"><%= t("admin.budget_investments.index.table_valuation_finished") %></th>
|
||||
<th class="text-center"><%= t("admin.budget_investments.index.table_selection") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<% @investments.each do |investment| %>
|
||||
<tr id="<%= dom_id(investment) %>" class="budget_investment">
|
||||
<td class="text-right">
|
||||
<strong><%= investment.id %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to investment.title, admin_budget_budget_investment_path(budget_id: @budget.id, id: investment.id, params: Budget::Investment.filter_params(params)) %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<% if investment.administrator.present? %>
|
||||
<span title="<%= t('admin.budget_investments.index.assigned_admin') %>"><%= investment.administrator.name %></span>
|
||||
<% else %>
|
||||
<%= t("admin.budget_investments.index.no_admin_assigned") %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<% if investment.valuators.size == 0 %>
|
||||
<%= t("admin.budget_investments.index.no_valuators_assigned") %>
|
||||
<% else %>
|
||||
<%= investment.valuators.collect(&:description_or_name).join(', ') %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= investment.heading.name %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= t("admin.budget_investments.index.feasibility.#{investment.feasibility}",
|
||||
price: investment.formatted_price)
|
||||
%>
|
||||
</td>
|
||||
<td class="small text-center">
|
||||
<%= investment.valuation_finished? ? "✔ ": "✘" %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<% if investment.selected? %>
|
||||
<%= link_to toggle_selection_admin_budget_budget_investment_path(@budget,
|
||||
investment,
|
||||
filter: params[:filter],
|
||||
page: params[:page]),
|
||||
method: :patch,
|
||||
remote: true,
|
||||
class: "button small expanded" do %>
|
||||
<%= t("admin.budget_investments.index.selected") %>
|
||||
<% end %>
|
||||
<% elsif investment.feasible? && investment.valuation_finished? %>
|
||||
<%= link_to toggle_selection_admin_budget_budget_investment_path(@budget,
|
||||
investment,
|
||||
filter: params[:filter],
|
||||
page: params[:page]),
|
||||
method: :patch,
|
||||
remote: true,
|
||||
class: "button small hollow expanded" do %>
|
||||
<%= t("admin.budget_investments.index.select") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<%= paginate @investments %>
|
||||
@@ -36,63 +36,9 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= render 'shared/filter_subnav', i18n_namespace: "admin.budget_investments.index" %>
|
||||
<%= render '/shared/filter_subnav', i18n_namespace: "admin.budget_investments.index" %>
|
||||
|
||||
<h3><%= page_entries_info @investments %></h3>
|
||||
<div id="investments">
|
||||
<%= render '/admin/budget_investments/investments' %>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.budget_investments.index.table_id") %></th>
|
||||
<th><%= t("admin.budget_investments.index.table_title") %></th>
|
||||
<th><%= t("admin.budget_investments.index.table_admin") %></th>
|
||||
<th><%= t("admin.budget_investments.index.table_valuator") %></th>
|
||||
<th><%= t("admin.budget_investments.index.table_geozone") %></th>
|
||||
<th><%= t("admin.budget_investments.index.table_feasibility") %></th>
|
||||
<th class="text-center"><%= t("admin.budget_investments.index.table_selection") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<% @investments.each do |investment| %>
|
||||
<tr id="<%= dom_id(investment) %>" class="budget_investment">
|
||||
<td>
|
||||
<strong><%= investment.id %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to investment.title, admin_budget_budget_investment_path(budget_id: @budget.id, id: investment.id, params: Budget::Investment.filter_params(params)) %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<% if investment.administrator.present? %>
|
||||
<span title="<%= t('admin.budget_investments.index.assigned_admin') %>"><%= investment.administrator.name %></span>
|
||||
<% else %>
|
||||
<%= t("admin.budget_investments.index.no_admin_assigned") %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<% if investment.valuators.size == 0 %>
|
||||
<%= t("admin.budget_investments.index.no_valuators_assigned") %>
|
||||
<% else %>
|
||||
<%= investment.valuators.collect(&:description_or_name).join(', ') %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= investment.heading.name %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= t("admin.budget_investments.index.feasibility.#{investment.feasibility}", price: investment.price) %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<% if investment.feasible? %>
|
||||
<%= link_to "#", class: "button small hollow expanded" do %>
|
||||
<%= t("admin.budget_investments.index.select") %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to "#", class: "button small expanded" do %>
|
||||
<%= t("admin.budget_investments.index.selected") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<%= paginate @investments %>
|
||||
Reference in New Issue
Block a user