Adds organization_name attribute to budget investments

This commit is contained in:
kikito
2017-01-06 18:43:55 +01:00
parent 54691fe7f4
commit 3c9e08b06f
9 changed files with 31 additions and 14 deletions

View File

@@ -80,7 +80,7 @@ module Budgets
end end
def investment_params def investment_params
params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id, :terms_of_service, :location) params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id, :terms_of_service, :location, :organization_name)
end end
def load_ballot def load_ballot

View File

@@ -3,30 +3,29 @@
<div class="row"> <div class="row">
<div class="small-12 medium-8 column"> <div class="small-12 medium-8 column">
<%= f.label :heading_id, t("budget.investments.form.heading") %> <%= f.select :heading_id, budget_heading_select_options(@budget), {include_blank: true, } %>
<%= f.select :heading_id, budget_heading_select_options(@budget), {include_blank: true, label: false} %>
</div> </div>
<div class="small-12 column"> <div class="small-12 column">
<%= f.label :title, t("budget.investments.form.title") %> <%= f.text_field :title, maxlength: SpendingProposal.title_max_length %>
<%= f.text_field :title, maxlength: SpendingProposal.title_max_length, placeholder: t("budget.investments.form.title"), label: false %>
</div> </div>
<%= f.invisible_captcha :subtitle %> <%= f.invisible_captcha :subtitle %>
<div class="ckeditor small-12 column"> <div class="ckeditor small-12 column">
<%= f.label :description, t("budget.investments.form.description") %> <%= f.cktext_area :description, maxlength: SpendingProposal.description_max_length, ckeditor: { language: I18n.locale } %>
<%= f.cktext_area :description, maxlength: SpendingProposal.description_max_length, ckeditor: { language: I18n.locale }, label: false %>
</div> </div>
<div class="small-12 column"> <div class="small-12 column">
<%= f.label :external_url, t("budget.investments.form.external_url") %> <%= f.text_field :external_url %>
<%= f.text_field :external_url, placeholder: t("budget.investments.form.external_url"), label: false %>
</div> </div>
<div class="small-12 column"> <div class="small-12 column">
<%= f.label :location, t("budget.investments.form.location") %> <%= f.text_field :location %>
<%= f.text_field :location, placeholder: t("budget.investments.form.location"), label: false %> </div>
<div class="small-12 column">
<%= f.text_field :organization_name %>
</div> </div>
<% unless current_user.manager? %> <% unless current_user.manager? %>
@@ -45,7 +44,7 @@
<% end %> <% end %>
<div class="actions small-12 medium-6 large-4 end column"> <div class="actions small-12 medium-6 large-4 end column">
<%= f.submit(class: "button expanded", value: t("budget.investments.form.submit_buttons.#{action_name}")) %> <%= f.submit(nil, class: "button expanded") %>
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@@ -24,11 +24,17 @@
</p> </p>
<% if investment.location.present? %> <% if investment.location.present? %>
<p id="investment_code"> <p>
<%= t("budget.investments.show.location_html", location: investment.location) %> <%= t("budget.investments.show.location_html", location: investment.location) %>
</p> </p>
<% end %> <% end %>
<% if investment.organization_name.present? %>
<p>
<%= t("budget.investments.show.organization_name_html", name: investment.organization_name) %>
</p>
<% end %>
<%= safe_html_with_links investment.description.html_safe %> <%= safe_html_with_links investment.description.html_safe %>
<% if investment.external_url.present? %> <% if investment.external_url.present? %>

View File

@@ -58,6 +58,8 @@ en:
external_url: "Link to additional documentation" external_url: "Link to additional documentation"
heading_id: "Heading" heading_id: "Heading"
title: "Title" title: "Title"
location: "Location"
organization_name: "If you are proposing in the name of a collective/organization, write its name"
comment: comment:
body: "Comment" body: "Comment"
user: "User" user: "User"

View File

@@ -58,6 +58,8 @@ es:
external_url: "Enlace a documentación adicional" external_url: "Enlace a documentación adicional"
heading_id: "Partida presupuestaria" heading_id: "Partida presupuestaria"
title: "Título" title: "Título"
location: "Ubicación"
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, escribe su nombre"
comment: comment:
body: "Comentario" body: "Comentario"
user: "Usuario" user: "Usuario"

View File

@@ -104,6 +104,7 @@ en:
unfeasibility_explanation: Unfeasibility explanation unfeasibility_explanation: Unfeasibility explanation
code_html: 'Investment project code: <strong>%{code}</strong>' code_html: 'Investment project code: <strong>%{code}</strong>'
location_html: 'Location: <strong>%{location}</strong>' location_html: 'Location: <strong>%{location}</strong>'
organization_name_html: 'Organization: <strong>%{name}</strong>'
location: Location location: Location
share: Share share: Share
wrong_price_format: Only integer numbers wrong_price_format: Only integer numbers

View File

@@ -104,6 +104,7 @@ es:
unfeasibility_explanation: Informe de inviabilidad unfeasibility_explanation: Informe de inviabilidad
code_html: 'Código propuesta de gasto: <strong>%{code}</strong>' code_html: 'Código propuesta de gasto: <strong>%{code}</strong>'
location_html: 'Ubicación: <strong>%{location}</strong>' location_html: 'Ubicación: <strong>%{location}</strong>'
organization_name_html: 'Organización: <strong>%{name}</strong>'
share: Compartir share: Compartir
wrong_price_format: Solo puede incluir caracteres numéricos wrong_price_format: Solo puede incluir caracteres numéricos
investment: investment:

View File

@@ -0,0 +1,5 @@
class AddOrganizationNameFieldToBudgetInvestment < ActiveRecord::Migration
def change
add_column :budget_investments, :organization_name, :string
end
end

View File

@@ -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: 20170103170147) do ActiveRecord::Schema.define(version: 20170106130838) 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"
@@ -142,6 +142,7 @@ ActiveRecord::Schema.define(version: 20170103170147) do
t.integer "group_id" t.integer "group_id"
t.boolean "selected", default: false t.boolean "selected", default: false
t.string "location" t.string "location"
t.string "organization_name"
end end
add_index "budget_investments", ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree add_index "budget_investments", ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree