@@ -126,6 +126,22 @@
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if answer.videos.present? %>
|
||||
<div class="video-link">
|
||||
<p>
|
||||
<span class="icon-video"></span>
|
||||
<strong><%= t("polls.show.videos") %></strong>
|
||||
</p>
|
||||
|
||||
<% answer.videos.each do |video| %>
|
||||
<%= link_to video.title,
|
||||
video.url,
|
||||
target: "_blank",
|
||||
rel: "nofollow" %><br>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -497,6 +497,7 @@ en:
|
||||
read_more: "Read more about %{answer}"
|
||||
read_less: "Read less about %{answer}"
|
||||
participate_in_other_polls: Participate in other polls
|
||||
videos: "External video"
|
||||
poll_questions:
|
||||
create_question: "Create question"
|
||||
default_valid_answers: "Yes, No"
|
||||
|
||||
@@ -497,6 +497,7 @@ es:
|
||||
read_more: "Leer más sobre %{answer}"
|
||||
read_less: "Leer menos sobre %{answer}"
|
||||
participate_in_other_polls: Participar en otras votaciones
|
||||
videos: "Vídeo externo"
|
||||
poll_questions:
|
||||
create_question: "Crear pregunta para votación"
|
||||
default_valid_answers: "Sí, No"
|
||||
|
||||
@@ -512,6 +512,12 @@ FactoryGirl.define do
|
||||
sequence(:description) { |n| "Answer description #{n}" }
|
||||
end
|
||||
|
||||
factory :poll_answer_video, class: 'Poll::Question::Answer::Video' do
|
||||
association :answer, factory: :poll_question_answer
|
||||
title "Sample video title"
|
||||
url "https://youtu.be/nhuNb0XtRhQ"
|
||||
end
|
||||
|
||||
factory :poll_booth, class: 'Poll::Booth' do
|
||||
sequence(:name) { |n| "Booth #{n}" }
|
||||
sequence(:location) { |n| "Street #{n}" }
|
||||
|
||||
@@ -41,6 +41,31 @@ feature 'Answers' do
|
||||
expect(page).to have_content "Adding more trees, creating a play area..."
|
||||
end
|
||||
|
||||
|
||||
scenario 'Add video to answer' do
|
||||
question = create(:poll_question)
|
||||
answer1 = create(:poll_question_answer, question: question)
|
||||
answer2 = create(:poll_question_answer, question: question)
|
||||
|
||||
visit admin_question_path(question)
|
||||
|
||||
within("#poll_question_answer_#{answer1.id}") do
|
||||
click_link "Video list"
|
||||
end
|
||||
|
||||
click_link "Add video"
|
||||
|
||||
fill_in "poll_question_answer_video_title", with: "Awesome project video"
|
||||
fill_in "poll_question_answer_video_url", with: "https://www.youtube.com/watch?v=123"
|
||||
|
||||
click_button "Save"
|
||||
|
||||
within("#poll_question_answer_video_#{answer1.id}") do
|
||||
expect(page).to have_content "Awesome project video"
|
||||
expect(page).to have_content "https://www.youtube.com/watch?v=123"
|
||||
end
|
||||
end
|
||||
|
||||
pending "Update"
|
||||
pending "Destroy"
|
||||
|
||||
|
||||
@@ -65,6 +65,16 @@ feature 'Polls' do
|
||||
let(:geozone) { create(:geozone) }
|
||||
let(:poll) { create(:poll, summary: "Summary", description: "Description") }
|
||||
|
||||
scenario 'Show answers with videos' do
|
||||
question = create(:poll_question, poll: poll)
|
||||
answer = create(:poll_question_answer, question: question, title: 'Chewbacca')
|
||||
video = create(:poll_answer_video, answer: answer, title: "Awesome project video", url: "https://www.youtube.com/watch?v=123")
|
||||
|
||||
visit poll_path(poll)
|
||||
|
||||
expect(page).to have_link("Awesome project video", href: "https://www.youtube.com/watch?v=123")
|
||||
end
|
||||
|
||||
scenario 'Lists questions from proposals as well as regular ones' do
|
||||
normal_question = create(:poll_question, poll: poll)
|
||||
proposal_question = create(:poll_question, poll: poll, proposal: create(:proposal))
|
||||
|
||||
Reference in New Issue
Block a user