adds video_url to proposals

This commit is contained in:
Juanjo Bazán
2015-09-14 21:40:03 +02:00
parent c9ec81a854
commit 817b5806ba
8 changed files with 26 additions and 14 deletions

View File

@@ -75,7 +75,7 @@ class ProposalsController < ApplicationController
private private
def proposal_params def proposal_params
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :responsible_name, :tag_list, :terms_of_service, :captcha, :captcha_key) params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url, :responsible_name, :tag_list, :terms_of_service, :captcha, :captcha_key)
end end
def load_featured_tags def load_featured_tags

View File

@@ -27,13 +27,13 @@
<%= f.cktext_area :description, maxlength: Proposal.description_max_length, ckeditor: { language: I18n.locale }, label: false %> <%= f.cktext_area :description, maxlength: Proposal.description_max_length, ckeditor: { language: I18n.locale }, label: false %>
</div> </div>
<!-- link for external video URL -->
<!-- <div class="small-12 column"> <div class="small-12 column">
<%#= f.label :external_url, t("proposals.form.proposal_external_video_url") %> <%= f.label :video_url, t("proposals.form.proposal_video_url") %>
<span class="note"><%#= t("proposals.form.proposal_external_video_url_note") %></span> <span class="note"><%= t("proposals.form.proposal_video_url_note") %></span>
<%#= f.text_field :external_url, placeholder: t("proposals.form.proposal_external_video_url"), label: false %> <%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"), label: false %>
</div> --> </div>
<!-- /. link for external video URL -->
<div class="small-12 column"> <div class="small-12 column">
<%= f.label :external_url, t("proposals.form.proposal_external_url") %> <%= f.label :external_url, t("proposals.form.proposal_external_url") %>
<%= f.text_field :external_url, placeholder: t("proposals.form.proposal_external_url"), label: false %> <%= f.text_field :external_url, placeholder: t("proposals.form.proposal_external_url"), label: false %>

View File

@@ -65,7 +65,11 @@
<%= safe_html_with_links @proposal.description %> <%= safe_html_with_links @proposal.description %>
<% if @proposal.external_url.present? %> <% if @proposal.external_url.present? %>
<div><%= link_to(@proposal.external_url) %></div> <div><%= text_with_links @proposal.external_url %></div>
<% end %>
<% if @proposal.video_url.present? %>
<div><%= text_with_links @proposal.video_url %></div>
<% end %> <% end %>
<h4><%= @proposal.question %></h4> <h4><%= @proposal.question %></h4>

View File

@@ -178,8 +178,8 @@ en:
proposal_question_example_html: "Debe ser resumida en una pregunta cuya respuesta sea Sí o No. <em>Ej. '¿Está usted de acuerdo en peatonalizar la calle Mayor?'</em>" proposal_question_example_html: "Debe ser resumida en una pregunta cuya respuesta sea Sí o No. <em>Ej. '¿Está usted de acuerdo en peatonalizar la calle Mayor?'</em>"
proposal_text: Initial text for proposal proposal_text: Initial text for proposal
proposal_external_url: Link to additional documentation proposal_external_url: Link to additional documentation
proposal_external_video_url: "Enlace a vídeo externo" proposal_video_url: "Enlace a vídeo externo"
proposal_external_video_url_note: "Puedes añadir un enlace a YouTube o Vimeo" proposal_video_url_note: "Puedes añadir un enlace a YouTube o Vimeo"
proposal_summary: "Proposal summary" proposal_summary: "Proposal summary"
proposal_summary_note: "200 chars. maximum" proposal_summary_note: "200 chars. maximum"
proposal_responsible_name: "First and last name of the person making this proposal" proposal_responsible_name: "First and last name of the person making this proposal"

View File

@@ -180,8 +180,8 @@ es:
proposal_summary_note: "(máximo 200 caracteres)" proposal_summary_note: "(máximo 200 caracteres)"
proposal_text: Texto desarrollado de la propuesta proposal_text: Texto desarrollado de la propuesta
proposal_external_url: Enlace a documentación adicional proposal_external_url: Enlace a documentación adicional
proposal_external_video_url: "Enlace a vídeo externo" proposal_video_url: "Enlace a vídeo externo"
proposal_external_video_url_note: "Puedes añadir un enlace a YouTube o Vimeo" proposal_video_url_note: "Puedes añadir un enlace a YouTube o Vimeo"
proposal_responsible_name: "Nombre y apellidos de la persona que hace esta propuesta" proposal_responsible_name: "Nombre y apellidos de la persona que hace esta propuesta"
proposal_responsible_name_note: "(individualmente o como representante de un colectivo; no se mostrará públicamente)" proposal_responsible_name_note: "(individualmente o como representante de un colectivo; no se mostrará públicamente)"
tags_label: Temas tags_label: Temas

View File

@@ -0,0 +1,5 @@
class AddVideoUrlToProposal < ActiveRecord::Migration
def change
add_column :proposals, :video_url, :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: 20150914184018) do ActiveRecord::Schema.define(version: 20150914191003) 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"
@@ -211,6 +211,7 @@ ActiveRecord::Schema.define(version: 20150914184018) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "responsible_name", limit: 60 t.string "responsible_name", limit: 60
t.text "summary" t.text "summary"
t.string "video_url"
end end
add_index "proposals", ["author_id", "hidden_at"], name: "index_proposals_on_author_id_and_hidden_at", using: :btree add_index "proposals", ["author_id", "hidden_at"], name: "index_proposals_on_author_id_and_hidden_at", using: :btree

View File

@@ -63,6 +63,7 @@ feature 'Proposals' do
fill_in 'proposal_summary', with: 'In summary, what we want is...' fill_in 'proposal_summary', with: 'In summary, what we want is...'
fill_in 'proposal_description', with: 'This is very important because...' fill_in 'proposal_description', with: 'This is very important because...'
fill_in 'proposal_external_url', with: 'http://rescue.org/refugees' fill_in 'proposal_external_url', with: 'http://rescue.org/refugees'
fill_in 'proposal_video_url', with: 'http://youtube.com'
fill_in 'proposal_responsible_name', with: 'Isabel Garcia' fill_in 'proposal_responsible_name', with: 'Isabel Garcia'
fill_in 'proposal_captcha', with: correct_captcha_text fill_in 'proposal_captcha', with: correct_captcha_text
check 'proposal_terms_of_service' check 'proposal_terms_of_service'
@@ -75,6 +76,7 @@ feature 'Proposals' do
expect(page).to have_content 'In summary, what we want is...' expect(page).to have_content 'In summary, what we want is...'
expect(page).to have_content 'This is very important because...' expect(page).to have_content 'This is very important because...'
expect(page).to have_content 'http://rescue.org/refugees' expect(page).to have_content 'http://rescue.org/refugees'
expect(page).to have_content 'http://youtube.com'
expect(page).to have_content author.name expect(page).to have_content author.name
expect(page).to have_content I18n.l(Proposal.last.created_at.to_date) expect(page).to have_content I18n.l(Proposal.last.created_at.to_date)
end end