Merge pull request #899 from consul/report-info-for-spending-proposals
Dossier info for spending proposals
This commit is contained in:
@@ -41,4 +41,26 @@ class SpendingProposal < ActiveRecord::Base
|
|||||||
def unresolved?
|
def unresolved?
|
||||||
resolution.blank?
|
resolution.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def legality
|
||||||
|
case legal
|
||||||
|
when true
|
||||||
|
"legal"
|
||||||
|
when false
|
||||||
|
"not_legal"
|
||||||
|
else
|
||||||
|
"undefined"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def feasibility
|
||||||
|
case feasible
|
||||||
|
when true
|
||||||
|
"feasible"
|
||||||
|
when false
|
||||||
|
"not_feasible"
|
||||||
|
else
|
||||||
|
"undefined"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,3 +26,12 @@
|
|||||||
class: "button radius tiny warning" %>
|
class: "button radius tiny warning" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<h2><%= t("admin.spending_proposals.show.dossier") %>:</h2>
|
||||||
|
|
||||||
|
<p><strong><%= t("admin.spending_proposals.show.price") %>:</strong> <%= @spending_proposal.price %></p>
|
||||||
|
<p><strong><%= t("admin.spending_proposals.show.legality") %>:</strong> <%= t("admin.spending_proposals.show.#{@spending_proposal.legality}") %></p>
|
||||||
|
<p><strong><%= t("admin.spending_proposals.show.feasibility") %>:</strong> <%= t("admin.spending_proposals.show.#{@spending_proposal.feasibility}") %></p>
|
||||||
|
|
||||||
|
<%= safe_html_with_links(@spending_proposal.explanation.html_safe) if @spending_proposal.explanation %>
|
||||||
|
|||||||
@@ -150,6 +150,15 @@ en:
|
|||||||
show:
|
show:
|
||||||
by: Sent by
|
by: Sent by
|
||||||
geozone: Scope
|
geozone: Scope
|
||||||
|
dossier: Dossier
|
||||||
|
price: Price
|
||||||
|
legality: Legality
|
||||||
|
legal: Legal
|
||||||
|
not_legal: Not legal
|
||||||
|
feasibility: Feasibility
|
||||||
|
feasible: Feasible
|
||||||
|
not_feasible: Not feasible
|
||||||
|
undefined: Undefined
|
||||||
stats:
|
stats:
|
||||||
show:
|
show:
|
||||||
stats_title: Stats
|
stats_title: Stats
|
||||||
|
|||||||
@@ -149,7 +149,16 @@ es:
|
|||||||
title: Propuestas de gasto para presupuestos participativos
|
title: Propuestas de gasto para presupuestos participativos
|
||||||
show:
|
show:
|
||||||
by: Enviada por
|
by: Enviada por
|
||||||
geozone: "Ámbito"
|
geozone: Ámbito
|
||||||
|
dossier: Informe
|
||||||
|
price: Coste
|
||||||
|
legality: Legalidad
|
||||||
|
legal: Legal
|
||||||
|
not_legal: No legal
|
||||||
|
feasibility: Viabilidad
|
||||||
|
feasible: Viable
|
||||||
|
not_feasible: No viable
|
||||||
|
undefined: Sin definir
|
||||||
stats:
|
stats:
|
||||||
show:
|
show:
|
||||||
stats_title: Estadísticas
|
stats_title: Estadísticas
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
class AddReportingFieldsToSpendingProposal < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :spending_proposals, :price, :float
|
||||||
|
add_column :spending_proposals, :legal, :boolean, default: nil
|
||||||
|
add_column :spending_proposals, :feasible, :boolean, default: nil
|
||||||
|
add_column :spending_proposals, :explanation, :text
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160207205252) do
|
ActiveRecord::Schema.define(version: 20160216121051) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -299,6 +299,10 @@ ActiveRecord::Schema.define(version: 20160207205252) do
|
|||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.integer "geozone_id"
|
t.integer "geozone_id"
|
||||||
t.string "resolution"
|
t.string "resolution"
|
||||||
|
t.float "price"
|
||||||
|
t.boolean "legal"
|
||||||
|
t.boolean "feasible"
|
||||||
|
t.text "explanation"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "spending_proposals", ["author_id"], name: "index_spending_proposals_on_author_id", using: :btree
|
add_index "spending_proposals", ["author_id"], name: "index_spending_proposals_on_author_id", using: :btree
|
||||||
|
|||||||
@@ -103,7 +103,12 @@ feature 'Admin spending proposals' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Show' do
|
scenario 'Show' do
|
||||||
spending_proposal = create(:spending_proposal, geozone: create(:geozone))
|
spending_proposal = create(:spending_proposal,
|
||||||
|
geozone: create(:geozone),
|
||||||
|
price: 1234.56,
|
||||||
|
legal: true,
|
||||||
|
feasible: false,
|
||||||
|
explanation: "It's impossible")
|
||||||
visit admin_spending_proposals_path
|
visit admin_spending_proposals_path
|
||||||
|
|
||||||
click_link spending_proposal.title
|
click_link spending_proposal.title
|
||||||
@@ -112,6 +117,10 @@ feature 'Admin spending proposals' do
|
|||||||
expect(page).to have_content(spending_proposal.description)
|
expect(page).to have_content(spending_proposal.description)
|
||||||
expect(page).to have_content(spending_proposal.author.name)
|
expect(page).to have_content(spending_proposal.author.name)
|
||||||
expect(page).to have_content(spending_proposal.geozone.name)
|
expect(page).to have_content(spending_proposal.geozone.name)
|
||||||
|
expect(page).to have_content("1234.56")
|
||||||
|
expect(page).to have_content("Legal")
|
||||||
|
expect(page).to have_content("Not feasible")
|
||||||
|
expect(page).to have_content("It's impossible")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Accept from show' do
|
scenario 'Accept from show' do
|
||||||
|
|||||||
@@ -42,6 +42,42 @@ describe SpendingProposal do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "dossier info" do
|
||||||
|
describe "#legality" do
|
||||||
|
it "can be legal" do
|
||||||
|
spending_proposal.legal = true
|
||||||
|
expect(spending_proposal.legality).to eq "legal"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "can be not-legal" do
|
||||||
|
spending_proposal.legal = false
|
||||||
|
expect(spending_proposal.legality).to eq "not_legal"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "can be undefined" do
|
||||||
|
spending_proposal.legal = nil
|
||||||
|
expect(spending_proposal.legality).to eq "undefined"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#feasibility" do
|
||||||
|
it "can be feasible" do
|
||||||
|
spending_proposal.feasible = true
|
||||||
|
expect(spending_proposal.feasibility).to eq "feasible"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "can be not-feasible" do
|
||||||
|
spending_proposal.feasible = false
|
||||||
|
expect(spending_proposal.feasibility).to eq "not_feasible"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "can be undefined" do
|
||||||
|
spending_proposal.feasible = nil
|
||||||
|
expect(spending_proposal.feasibility).to eq "undefined"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "resolution status" do
|
describe "resolution status" do
|
||||||
it "should be valid" do
|
it "should be valid" do
|
||||||
spending_proposal.resolution = "accepted"
|
spending_proposal.resolution = "accepted"
|
||||||
|
|||||||
Reference in New Issue
Block a user