diff --git a/app/views/admin/spending_proposals/show.html.erb b/app/views/admin/spending_proposals/show.html.erb index cbdfbb2ad..6be63d9ff 100644 --- a/app/views/admin/spending_proposals/show.html.erb +++ b/app/views/admin/spending_proposals/show.html.erb @@ -62,6 +62,10 @@
<%= t("admin.spending_proposals.show.price") %> (<%= t("admin.spending_proposals.show.currency") %>): <%= @spending_proposal.price.present? ? @spending_proposal.price : t("admin.spending_proposals.show.undefined") %>
+<%= t("admin.spending_proposals.show.price_first_year") %> (<%= t("admin.spending_proposals.show.currency") %>): + <%= @spending_proposal.price_first_year.present? ? @spending_proposal.price_first_year : t("admin.spending_proposals.show.undefined") %> +
+ <%= simple_format(safe_html_with_links(@spending_proposal.price_explanation.html_safe), {}, sanitize: false) if @spending_proposal.price_explanation.present? %><%= t("admin.spending_proposals.show.feasibility") %>: diff --git a/app/views/valuation/spending_proposals/show.html.erb b/app/views/valuation/spending_proposals/show.html.erb index cc0c8bca6..636249d31 100644 --- a/app/views/valuation/spending_proposals/show.html.erb +++ b/app/views/valuation/spending_proposals/show.html.erb @@ -57,6 +57,9 @@
<%= t("valuation.spending_proposals.show.price") %> (<%= t("valuation.spending_proposals.show.currency") %>): <%= @spending_proposal.price.present? ? @spending_proposal.price : t("valuation.spending_proposals.show.undefined") %>
+<%= t("valuation.spending_proposals.show.price_first_year") %> (<%= t("valuation.spending_proposals.show.currency") %>): + <%= @spending_proposal.price_first_year.present? ? @spending_proposal.price_first_year : t("valuation.spending_proposals.show.undefined") %> +
<%= simple_format(safe_html_with_links(@spending_proposal.price_explanation.html_safe), {}, sanitize: false) if @spending_proposal.price_explanation.present? %><%= t("valuation.spending_proposals.show.feasibility") %>: diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index bd31ad1ad..07f236456 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -173,6 +173,7 @@ en: geozone: Scope dossier: Dossier price: Price + price_first_year: Cost during the first year currency: "€" feasibility: Feasibility feasible: Feasible diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 53f615c1a..442294de0 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -173,6 +173,7 @@ es: geozone: Ámbito dossier: Informe price: Coste + price_first_year: Coste en el primer año currency: "€" feasibility: Viabilidad feasible: Viable diff --git a/config/locales/valuation.en.yml b/config/locales/valuation.en.yml index a9f7fb393..c48153516 100644 --- a/config/locales/valuation.en.yml +++ b/config/locales/valuation.en.yml @@ -29,6 +29,7 @@ en: geozone: Scope dossier: Dossier price: Price + price_first_year: Cost during the first year currency: "€" feasibility: Feasibility feasible: Feasible diff --git a/config/locales/valuation.es.yml b/config/locales/valuation.es.yml index a30abc252..81c082c87 100644 --- a/config/locales/valuation.es.yml +++ b/config/locales/valuation.es.yml @@ -29,6 +29,7 @@ es: geozone: Ámbito dossier: Informe price: Coste + price_first_year: Coste en el primer año currency: "€" feasibility: Viabilidad feasible: Viable diff --git a/db/migrate/20160305113707_add_price_fields_to_spending_proposals.rb b/db/migrate/20160305113707_add_price_fields_to_spending_proposals.rb new file mode 100644 index 000000000..dad22583d --- /dev/null +++ b/db/migrate/20160305113707_add_price_fields_to_spending_proposals.rb @@ -0,0 +1,5 @@ +class AddPriceFieldsToSpendingProposals < ActiveRecord::Migration + def change + add_column :spending_proposals, :price_first_year, :float + end +end diff --git a/db/schema.rb b/db/schema.rb index bd85c43a6..ffe2a9a8b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160225171916) do +ActiveRecord::Schema.define(version: 20160305113707) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -309,6 +309,7 @@ ActiveRecord::Schema.define(version: 20160225171916) do t.text "explanations_log" t.integer "administrator_id" t.integer "valuation_assignments_count", default: 0 + t.float "price_first_year" end add_index "spending_proposals", ["author_id"], name: "index_spending_proposals_on_author_id", using: :btree diff --git a/spec/features/admin/spending_proposals_spec.rb b/spec/features/admin/spending_proposals_spec.rb index f4bd4582c..3fe32dfbb 100644 --- a/spec/features/admin/spending_proposals_spec.rb +++ b/spec/features/admin/spending_proposals_spec.rb @@ -169,6 +169,7 @@ feature 'Admin spending proposals' do geozone: create(:geozone), association_name: 'People of the neighbourhood', price: 1234.56, + price_first_year: 1000, feasible: false, feasible_explanation: 'It is impossible', administrator: administrator) @@ -184,6 +185,7 @@ feature 'Admin spending proposals' do expect(page).to have_content(spending_proposal.association_name) expect(page).to have_content(spending_proposal.geozone.name) expect(page).to have_content('1234.56') + expect(page).to have_content('1000') expect(page).to have_content('Not feasible') expect(page).to have_content('It is impossible') expect(page).to have_select('spending_proposal[administrator_id]', selected: 'Ana (ana@admins.org)')