adds geozone to spending_proposals
This commit is contained in:
@@ -26,7 +26,7 @@ class SpendingProposalsController < ApplicationController
|
||||
private
|
||||
|
||||
def spending_proposal_params
|
||||
params.require(:spending_proposal).permit(:title, :description, :external_url, :terms_of_service, :captcha, :captcha_key)
|
||||
params.require(:spending_proposal).permit(:title, :description, :external_url, :geozone_id, :terms_of_service, :captcha, :captcha_key)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -5,6 +5,7 @@ class SpendingProposal < ActiveRecord::Base
|
||||
apply_simple_captcha
|
||||
|
||||
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
|
||||
belongs_to :geozone
|
||||
|
||||
validates :title, presence: true
|
||||
validates :author, presence: true
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
<%= f.text_field :external_url, placeholder: t("spending_proposals.form.external_url"), label: false %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.label :geozone_id, t("spending_proposals.form.geozone") %>
|
||||
<%= f.select :geozone_id, Geozone.all.collect { |g| [ g.name, g.id ] }, {include_blank: t("geozones.none"), label: false} %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<% if @spending_proposal.new_record? %>
|
||||
<%= f.label :terms_of_service do %>
|
||||
|
||||
@@ -263,9 +263,12 @@ en:
|
||||
title: "Spending proposal title"
|
||||
description: "Description"
|
||||
external_url: "Link to additional documentation"
|
||||
geozone: "Area of operation"
|
||||
submit_buttons:
|
||||
new: Create
|
||||
create: Create
|
||||
geozones:
|
||||
none: "All city"
|
||||
comments:
|
||||
show:
|
||||
return_to_commentable: "Go back to "
|
||||
|
||||
@@ -263,9 +263,12 @@ es:
|
||||
title: "Título de la propuesta de gasto"
|
||||
description: "Descripción detallada"
|
||||
external_url: "Enlace a documentación adicional"
|
||||
geozone: "Nivel de actuación"
|
||||
submit_buttons:
|
||||
new: Crear
|
||||
create: Crear
|
||||
geozones:
|
||||
none: "Toda la ciudad"
|
||||
comments:
|
||||
show:
|
||||
return_to_commentable: "Volver a "
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class AddGeozoneToSpendingProposal < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :spending_proposals, :geozone_id, :integer, default: nil
|
||||
add_index :spending_proposals, :geozone_id
|
||||
end
|
||||
end
|
||||
@@ -288,9 +288,11 @@ ActiveRecord::Schema.define(version: 20160108133501) do
|
||||
t.string "external_url"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "geozone_id"
|
||||
end
|
||||
|
||||
add_index "spending_proposals", ["author_id"], name: "index_spending_proposals_on_author_id", using: :btree
|
||||
add_index "spending_proposals", ["geozone_id"], name: "index_spending_proposals_on_geozone_id", using: :btree
|
||||
|
||||
create_table "taggings", force: :cascade do |t|
|
||||
t.integer "tag_id"
|
||||
|
||||
@@ -17,6 +17,7 @@ feature 'Spending proposals' do
|
||||
fill_in 'spending_proposal_description', with: 'I want to live in a high tower over the clouds'
|
||||
fill_in 'spending_proposal_external_url', with: 'http://http://skyscraperpage.com/'
|
||||
fill_in 'spending_proposal_captcha', with: correct_captcha_text
|
||||
select 'All city', from: 'spending_proposal_geozone_id'
|
||||
check 'spending_proposal_terms_of_service'
|
||||
|
||||
click_button 'Create'
|
||||
|
||||
Reference in New Issue
Block a user