Add population field to admin Budget Heading form and headings list table

This commit is contained in:
Bertocq
2017-06-21 20:23:14 +02:00
parent 8cd7c685dc
commit d77355de0d
3 changed files with 16 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
<table>
<thead>
<tr>
<th colspan="2" class="with-button">
<th colspan="3" 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>
@@ -21,6 +21,7 @@
<tr>
<th><%= t("admin.budgets.form.table_heading") %></th>
<th><%= t("admin.budgets.form.table_amount") %></th>
<th><%= t("admin.budgets.form.table_population") %></th>
</tr>
</thead>
<tbody>
@@ -45,6 +46,15 @@
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") %>
</div>
</div>
<%= f.submit t("admin.budgets.form.save_heading"), class: "button success" %>
<% end %>
@@ -60,6 +70,9 @@
<td>
<%= heading.price %>
</td>
<td>
<%= heading.population %>
</td>
</tr>
<% end %>
<!-- /. headings list -->

View File

@@ -1,5 +1,5 @@
class AddPopulationToBudgetHeadings < ActiveRecord::Migration
def change
add_column :budget_headings, :population, :integer, default: 0
add_column :budget_headings, :population, :integer, default: nil
end
end

View File

@@ -110,7 +110,7 @@ ActiveRecord::Schema.define(version: 20170621180611) do
t.integer "group_id"
t.string "name", limit: 50
t.integer "price", limit: 8
t.integer "population", default: 0
t.integer "population"
end
add_index "budget_headings", ["group_id"], name: "index_budget_headings_on_group_id", using: :btree