partial added, render an investment
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -34,3 +34,4 @@
|
|||||||
public/sitemap.xml
|
public/sitemap.xml
|
||||||
public/system/
|
public/system/
|
||||||
/public/ckeditor_assets/
|
/public/ckeditor_assets/
|
||||||
|
.idea/
|
||||||
|
|||||||
@@ -57,87 +57,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% @investments.each do |investment| %>
|
<% @investments.each do |investment| %>
|
||||||
<tr id="<%= dom_id(investment) %>" class="budget_investment">
|
<tr id="<%= dom_id(investment) %>" class="budget_investment">
|
||||||
<td class="text-right">
|
<%= render '/admin/budget_investments/select_investment', investment: investment %>
|
||||||
<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)),
|
|
||||||
target: "_blank" %>
|
|
||||||
</td>
|
|
||||||
<td class="text-center">
|
|
||||||
<%= investment.total_votes %>
|
|
||||||
</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">
|
|
||||||
<% no_valuation_groups = t("admin.budget_investments.index.no_valuation_groups") %>
|
|
||||||
<%= investment.assigned_valuation_groups || no_valuation_groups %>
|
|
||||||
<br>
|
|
||||||
<% no_valuators_assigned = t("admin.budget_investments.index.no_valuators_assigned") %>
|
|
||||||
<%= investment.assigned_valuators || no_valuators_assigned %>
|
|
||||||
</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? ? t("shared.yes"): t("shared.no") %>
|
|
||||||
</td>
|
|
||||||
<td class="small text-center">
|
|
||||||
<%= form_for [:admin, investment.budget, investment], remote: true do |f| %>
|
|
||||||
<%= f.check_box :visible_to_valuators,
|
|
||||||
label: false,
|
|
||||||
class: "js-submit-on-change",
|
|
||||||
id: "budget_investment_visible_to_valuators" %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
<td class="small text-center">
|
|
||||||
<% if investment.selected? %>
|
|
||||||
<%= link_to_unless investment.budget.finished?,
|
|
||||||
t("admin.budget_investments.index.selected"),
|
|
||||||
toggle_selection_admin_budget_budget_investment_path(@budget,
|
|
||||||
investment,
|
|
||||||
filter: params[:filter],
|
|
||||||
sort_by: params[:sort_by],
|
|
||||||
min_total_supports: params[:min_total_supports],
|
|
||||||
advanced_filters: params[:advanced_filters],
|
|
||||||
page: params[:page]),
|
|
||||||
method: :patch,
|
|
||||||
remote: true,
|
|
||||||
class: "button small expanded" %>
|
|
||||||
<% elsif investment.feasible? && investment.valuation_finished? %>
|
|
||||||
<%= link_to_unless investment.budget.finished?,
|
|
||||||
t("admin.budget_investments.index.select"),
|
|
||||||
toggle_selection_admin_budget_budget_investment_path(@budget,
|
|
||||||
investment,
|
|
||||||
filter: params[:filter],
|
|
||||||
sort_by: params[:sort_by],
|
|
||||||
min_total_supports: params[:min_total_supports],
|
|
||||||
advanced_filters: params[:advanced_filters],
|
|
||||||
page: params[:page]),
|
|
||||||
method: :patch,
|
|
||||||
remote: true,
|
|
||||||
class: "button small hollow expanded" %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
<% if params[:filter] == "selected" %>
|
|
||||||
<td class="small text-center">
|
|
||||||
<%= investment.incompatible? ? t("shared.yes"): t("shared.no") %>
|
|
||||||
</td>
|
|
||||||
<% end %>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<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)),
|
||||||
|
target: "_blank" %>
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<%= investment.total_votes %>
|
||||||
|
</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">
|
||||||
|
<% no_valuation_groups = t("admin.budget_investments.index.no_valuation_groups") %>
|
||||||
|
<%= investment.assigned_valuation_groups || no_valuation_groups %>
|
||||||
|
<br>
|
||||||
|
<% no_valuators_assigned = t("admin.budget_investments.index.no_valuators_assigned") %>
|
||||||
|
<%= investment.assigned_valuators || no_valuators_assigned %>
|
||||||
|
</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? ? t("shared.yes"): t("shared.no") %>
|
||||||
|
</td>
|
||||||
|
<td class="small text-center">
|
||||||
|
<%= form_for [:admin, investment.budget, investment], remote: true do |f| %>
|
||||||
|
<%= f.check_box :visible_to_valuators,
|
||||||
|
label: false,
|
||||||
|
class: "js-submit-on-change",
|
||||||
|
id: "budget_investment_visible_to_valuators" %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="small text-center">
|
||||||
|
<% if investment.selected? %>
|
||||||
|
<%= link_to_unless investment.budget.finished?,
|
||||||
|
t("admin.budget_investments.index.selected"),
|
||||||
|
toggle_selection_admin_budget_budget_investment_path(@budget,
|
||||||
|
investment,
|
||||||
|
filter: params[:filter],
|
||||||
|
sort_by: params[:sort_by],
|
||||||
|
min_total_supports: params[:min_total_supports],
|
||||||
|
advanced_filters: params[:advanced_filters],
|
||||||
|
page: params[:page]),
|
||||||
|
method: :patch,
|
||||||
|
remote: true,
|
||||||
|
class: "button small expanded" %>
|
||||||
|
<% elsif investment.feasible? && investment.valuation_finished? %>
|
||||||
|
<%= link_to_unless investment.budget.finished?,
|
||||||
|
t("admin.budget_investments.index.select"),
|
||||||
|
toggle_selection_admin_budget_budget_investment_path(@budget,
|
||||||
|
investment,
|
||||||
|
filter: params[:filter],
|
||||||
|
sort_by: params[:sort_by],
|
||||||
|
min_total_supports: params[:min_total_supports],
|
||||||
|
advanced_filters: params[:advanced_filters],
|
||||||
|
page: params[:page]),
|
||||||
|
method: :patch,
|
||||||
|
remote: true,
|
||||||
|
class: "button small hollow expanded" %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<% if params[:filter] == "selected" %>
|
||||||
|
<td class="small text-center">
|
||||||
|
<%= investment.incompatible? ? t("shared.yes"): t("shared.no") %>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
@@ -1 +1 @@
|
|||||||
$("#investments").html('<%= j render("admin/budget_investments/investments") %>');
|
$("#<%= dom_id(@investment) %>").html('<%= j render("select_investment", investment: @investment) %>');
|
||||||
|
|||||||
Reference in New Issue
Block a user