Merge branch 'master' into budgets-ui
This commit is contained in:
7
app/views/admin/budget_headings/_errors.html.erb
Normal file
7
app/views/admin/budget_headings/_errors.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<div id='error_explanation' class='callout alert'>
|
||||
<ul>
|
||||
<% errors.each do |error| %>
|
||||
<li><%= error %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
1
app/views/admin/budget_headings/edit.js.erb
Normal file
1
app/views/admin/budget_headings/edit.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#heading-<%=@heading.id%>").html("<td colspan='4'><%= j render("admin/budgets/heading_form", group: @budget_group, budget: @budget, heading: @heading) %></td>");
|
||||
1
app/views/admin/budget_headings/update.js.erb
Normal file
1
app/views/admin/budget_headings/update.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#<%= dom_id(@budget_group) %>").html('<%= j render("admin/budgets/group", group: @budget_group, headings: @budget_group.headings) %>');
|
||||
@@ -3,7 +3,8 @@
|
||||
class: "float-right small" %>
|
||||
|
||||
<% if @investments.any? %>
|
||||
<h3 class="inline-block"><%= page_entries_info @investments %></h3>
|
||||
<h3><%= page_entries_info @investments %></h3>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -28,14 +29,20 @@
|
||||
<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)) %>
|
||||
<%= 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>
|
||||
<span title="<%= t('admin.budget_investments.index.assigned_admin') %>">
|
||||
<%= investment.administrator.name %>
|
||||
</span>
|
||||
<% else %>
|
||||
<%= t("admin.budget_investments.index.no_admin_assigned") %>
|
||||
<% end %>
|
||||
@@ -59,7 +66,27 @@
|
||||
<%= investment.valuation_finished? ? t('shared.yes'): t('shared.no') %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= investment_selected_link(investment) %>
|
||||
<% 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],
|
||||
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],
|
||||
page: params[:page]),
|
||||
method: :patch,
|
||||
remote: true,
|
||||
class: "button small hollow expanded" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% if params[:filter] == 'selected' %>
|
||||
<td class="small text-center">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" class="with-button">
|
||||
<th colspan="4" class="with-button">
|
||||
<%= group.name %>
|
||||
<%= link_to t("admin.budgets.form.add_heading"), "#", class: "button float-right js-toggle-link", data: { "toggle-selector" => "#group-#{group.id}-new-heading-form" } %>
|
||||
</th>
|
||||
@@ -11,7 +11,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<td colspan="4">
|
||||
<div class="callout primary">
|
||||
<%= t("admin.budgets.form.no_heading") %>
|
||||
</div>
|
||||
@@ -22,6 +22,7 @@
|
||||
<th><%= t("admin.budgets.form.table_heading") %></th>
|
||||
<th><%= t("admin.budgets.form.table_amount") %></th>
|
||||
<th><%= t("admin.budgets.form.table_population") %></th>
|
||||
<th><%= t("admin.actions.actions") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -29,62 +30,14 @@
|
||||
|
||||
<!-- new heading form -->
|
||||
<tr id="group-<%= group.id %>-new-heading-form" style="display:none">
|
||||
<td colspan="3">
|
||||
<%= form_for [:admin, @budget, group, Budget::Heading.new], remote: true do |f| %>
|
||||
<label><%= t("admin.budgets.form.heading") %></label>
|
||||
<%= f.text_field :name,
|
||||
label: false,
|
||||
maxlength: 50,
|
||||
placeholder: t("admin.budgets.form.heading") %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<label><%= t("admin.budgets.form.amount") %></label>
|
||||
<%= f.text_field :price,
|
||||
label: false,
|
||||
maxlength: 8,
|
||||
placeholder: t("admin.budgets.form.amount") %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<label><%= t("admin.budgets.form.population") %></label>
|
||||
<p class="help-text" id="budgets-population-help-text">
|
||||
<%= t("admin.budgets.form.population_help_text") %>
|
||||
</p>
|
||||
<%= f.number_field :population,
|
||||
label: false,
|
||||
maxlength: 8,
|
||||
min: 1,
|
||||
placeholder: t("admin.budgets.form.population"),
|
||||
data: {toggle_focus: "population-info"},
|
||||
aria: {describedby: "budgets-population-help-text"} %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column " >
|
||||
<div id="population-info" class="is-hidden" data-toggler="is-hidden">
|
||||
<%= t("admin.budgets.form.population_info") %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.submit t("admin.budgets.form.save_heading"), class: "button success" %>
|
||||
<% end %>
|
||||
<td colspan="4">
|
||||
<%= render "admin/budgets/heading_form", group: group, budget: @budget, heading: Budget::Heading.new %>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- /. new heading form -->
|
||||
<!-- headings list -->
|
||||
<% headings.each do |heading| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= heading.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= heading.price %>
|
||||
</td>
|
||||
<td>
|
||||
<%= heading.population %>
|
||||
</td>
|
||||
</tr>
|
||||
<%= render "admin/budgets/heading", group: group, budget: @budget, heading: heading %>
|
||||
<% end %>
|
||||
<!-- /. headings list -->
|
||||
</tbody>
|
||||
|
||||
27
app/views/admin/budgets/_heading.html.erb
Normal file
27
app/views/admin/budgets/_heading.html.erb
Normal file
@@ -0,0 +1,27 @@
|
||||
<tr id="heading-<%=heading.id%>">
|
||||
<td>
|
||||
<%= heading.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= heading.price %>
|
||||
</td>
|
||||
<td>
|
||||
<%= heading.population %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to t("admin.actions.edit"),
|
||||
edit_admin_budget_budget_group_budget_heading_path(budget_id: group.budget.id, budget_group_id: group.id, id: heading.id),
|
||||
class: "button hollow",
|
||||
remote: true %>
|
||||
<%= link_to t("admin.budget_investments.index.title"),
|
||||
admin_budget_budget_investments_path(budget_id: group.budget.id, heading_id: heading.id),
|
||||
class: "button hollow" %>
|
||||
<% if heading.can_be_deleted? %>
|
||||
<%= link_to t('admin.administrators.administrator.delete'),
|
||||
#admin_budget_budget_group_budget_headings_path(group.budget.id, group.id),
|
||||
[:admin, group.budget, group, heading],
|
||||
method: :delete,
|
||||
class: "button hollow alert" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
35
app/views/admin/budgets/_heading_form.html.erb
Normal file
35
app/views/admin/budgets/_heading_form.html.erb
Normal file
@@ -0,0 +1,35 @@
|
||||
<%= form_for [:admin, budget, group, heading], remote: true do |f| %>
|
||||
<%= render 'shared/errors', resource: heading %>
|
||||
<label><%= t("admin.budgets.form.heading") %></label>
|
||||
<%= f.text_field :name,
|
||||
label: false,
|
||||
maxlength: 50,
|
||||
placeholder: t("admin.budgets.form.heading") %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<label><%= t("admin.budgets.form.amount") %></label>
|
||||
<%= f.text_field :price,
|
||||
label: false,
|
||||
maxlength: 8,
|
||||
placeholder: t("admin.budgets.form.amount") %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<label><%= t("admin.budgets.form.population") %></label>
|
||||
<%= f.text_field :population,
|
||||
label: false,
|
||||
maxlength: 8,
|
||||
placeholder: t("admin.budgets.form.population"),
|
||||
data: {toggle_focus: "population-info"} %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column " >
|
||||
<div id="population-info" class="is-hidden" data-toggler="is-hidden">
|
||||
<%= t("admin.budgets.form.population_info") %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.submit t("admin.budgets.form.save_heading"), class: "button success" %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user