diff --git a/app/views/polls/questions/show.html.erb b/app/views/polls/questions/show.html.erb
deleted file mode 100644
index f67633129..000000000
--- a/app/views/polls/questions/show.html.erb
+++ /dev/null
@@ -1,92 +0,0 @@
-<% provide :title do %><%= @question.title %><% end %>
-
-
-
-
- <%= back_link_to %>
-
-
<%= @question.title %>
-
- <% if @question.proposal.present? %>
-
- <%= link_to t('poll_questions.show.original_proposal'), @question.proposal %>
-
- <% end %>
-
- <% if can? :answer, @question %>
- <%= link_to t('poll_questions.show.answer_this_question'),
- @question.poll,
- class: 'large button' %>
- <% else %>
- <%= render 'polls/reasons_for_not_answering', poll: @question.poll %>
- <% end %>
-
-
-
-
-
- <%= t('poll_questions.show.author') %>
-
-
- <% if @question.author_visible_name.present? %>
- <%= @question.author_visible_name %>
- <% else %>
- <%= link_to @question.author.name, @question.author %>
- <% end %>
-
-
-
-
-
- <%= t('poll_questions.show.poll') %>
-
-
- <%= link_to @question.poll.name, @question.poll %>
-
-
-
-
- <%= t('poll_questions.show.dates_title') %>
-
-
- <%= poll_dates(@question.poll) %>
-
-
-
-
-
-<% if @question.video_url.present? %>
-
-
-
-
-
- <%= t('proposals.show.title_video_url') %>
-
- <%= text_with_links @question.video_url %>
-
-
-
-
-<% end %>
-
-
-
-
<%= t('poll_questions.show.more_info') %>
- <%= @question.description %>
-
-
-
-
- <%= render "polls/questions/filter_subnav" %>
-
-
-
-
- <%= render 'documents/documents',
- documents: @question.documents,
- max_documents_allowed: Poll::Question.max_documents_allowed %>
-
-
diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml
index a3751615a..c4694b310 100644
--- a/config/locales/en/admin.yml
+++ b/config/locales/en/admin.yml
@@ -593,7 +593,6 @@ en:
author: Author
title: Title
valid_answers: Valid answers
- description: Description
video_url: External video
documents: Documents (1)
recounts:
diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml
index ff8a77014..fbaa3e4d0 100644
--- a/config/locales/en/general.yml
+++ b/config/locales/en/general.yml
@@ -494,11 +494,6 @@ en:
create_question: "Create question"
default_valid_answers: "Yes, No"
show:
- answer_this_question: "Go to voting page"
- original_proposal: "Original proposal"
- author: "Created by"
- dates_title: "Participation dates"
- more_info: "More information"
not_logged_in: "You must %{signin} or %{signup} to participate."
signin: Sign in
signup: Sign up
@@ -509,7 +504,6 @@ en:
cant_answer_wrong_geozone: "This question is not available on your geozone."
vote_answer: "Vote %{answer}"
voted: "You have voted %{answer}"
- poll: "Poll"
proposal_notifications:
new:
title: "Send message"
@@ -524,9 +518,6 @@ en:
edit: 'Edit'
save: 'Save'
delete: 'Delete'
- comments:
- title: 'Comments'
- login_to_comment: 'You must %{signin} or %{signup} to leave a comment.'
"yes": "Yes"
"no": "No"
search_results: "Search results"
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index f95c2d39f..c1c2cbf9d 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -593,7 +593,6 @@ es:
author: Autor
title: Título
valid_answers: Respuestas válidas
- description: Descripción
video_url: Video externo
documents: Documentos (1)
recounts:
diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml
index aaa59a900..898826c0e 100644
--- a/config/locales/es/general.yml
+++ b/config/locales/es/general.yml
@@ -494,11 +494,6 @@ es:
create_question: "Crear pregunta para votación"
default_valid_answers: "Sí, No"
show:
- answer_this_question: "Responder a esta pregunta"
- original_proposal: "Propuesta original"
- author: "Creado por"
- dates_title: "Fechas de participación"
- more_info: "Más información"
not_logged_in: "Necesitas %{signin} o %{signup} para participar."
signin: iniciar sesión
signup: registrarte
@@ -509,7 +504,6 @@ es:
cant_answer_wrong_geozone: "Esta votación no está disponible en tu zona."
vote_answer: "Votar %{answer}"
voted: "Has votado %{answer}"
- poll: "Votación"
proposal_notifications:
new:
title: "Enviar mensaje"
@@ -524,9 +518,6 @@ es:
edit: 'Editar'
save: 'Guardar'
delete: 'Borrar'
- comments:
- title: 'Comentarios'
- login_to_comment: 'Necesitas %{signin} o %{signup} para comentar.'
"yes": "Sí"
"no": "No"
search_results: "Resultados de búsqueda"
diff --git a/config/routes.rb b/config/routes.rb
index 51e1f351d..2b9c4250c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -113,7 +113,7 @@ Rails.application.routes.draw do
end
resources :polls, only: [:show, :index] do
- resources :questions, only: [:show], controller: 'polls/questions', shallow: true do
+ resources :questions, controller: 'polls/questions', shallow: true do
post :answer, on: :member
end
end
diff --git a/db/migrate/20171003170029_remove_description_from_poll_questions.rb b/db/migrate/20171003170029_remove_description_from_poll_questions.rb
new file mode 100644
index 000000000..31e1b9578
--- /dev/null
+++ b/db/migrate/20171003170029_remove_description_from_poll_questions.rb
@@ -0,0 +1,5 @@
+class RemoveDescriptionFromPollQuestions < ActiveRecord::Migration
+ def change
+ remove_column :poll_questions, :description
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index a53b0c490..c0fccda89 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -675,7 +675,6 @@ ActiveRecord::Schema.define(version: 20171003223152) do
t.string "author_visible_name"
t.string "title"
t.string "valid_answers"
- t.text "description"
t.integer "comments_count"
t.datetime "hidden_at"
t.datetime "created_at"
diff --git a/spec/factories.rb b/spec/factories.rb
index a127d1bc9..9f1fca8ed 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -498,7 +498,6 @@ FactoryGirl.define do
poll
association :author, factory: :user
sequence(:title) { |n| "Question title #{n}" }
- sequence(:description) { |n| "Question description #{n}" }
valid_answers { Faker::Lorem.words(3).join(', ') }
end
diff --git a/spec/features/admin/poll/questions_spec.rb b/spec/features/admin/poll/questions_spec.rb
index ca3706a24..52e3783f0 100644
--- a/spec/features/admin/poll/questions_spec.rb
+++ b/spec/features/admin/poll/questions_spec.rb
@@ -24,7 +24,6 @@ feature 'Admin poll questions' do
visit admin_question_path(question)
expect(page).to have_content(question.title)
- expect(page).to have_content(question.description)
expect(page).to have_content(question.author.name)
expect(page).to have_content(question.valid_answers.join(" "))
end
@@ -45,13 +44,11 @@ feature 'Admin poll questions' do
select 'Movies', from: 'poll_question_poll_id'
fill_in 'poll_question_title', with: title
- fill_in 'poll_question_description', with: description
fill_in 'poll_question_video_url', with: video_url
click_button 'Save'
expect(page).to have_content(title)
- expect(page).to have_content(description)
expect(page).to have_content(video_url)
end
@@ -64,7 +61,6 @@ feature 'Admin poll questions' do
expect(current_path).to eq(new_admin_question_path)
expect(page).to have_field('poll_question_title', with: proposal.title)
- expect(page).to have_field('poll_question_description', with: proposal.description)
expect(page).to have_field('poll_question_valid_answers', with: "Yes, No")
select 'Proposals', from: 'poll_question_poll_id'
@@ -72,7 +68,6 @@ feature 'Admin poll questions' do
click_button 'Save'
expect(page).to have_content(proposal.title)
- expect(page).to have_content(proposal.description)
expect(page).to have_link(proposal.title, href: proposal_path(proposal))
expect(page).to have_link(proposal.author.name, href: user_path(proposal.author))
end
diff --git a/spec/features/polls/questions_spec.rb b/spec/features/polls/questions_spec.rb
index 06dd9df08..9e7efeedc 100644
--- a/spec/features/polls/questions_spec.rb
+++ b/spec/features/polls/questions_spec.rb
@@ -11,121 +11,4 @@ feature 'Poll Questions' do
expect(proposal_question.title).to appear_before(normal_question.title)
end
-
- scenario 'shows the author visible name instead of a link to the author' do
- poll = create(:poll)
- question_with_author = create(:poll_question, poll: poll)
- question_with_author_visible_name = create(:poll_question, poll: poll, author_visible_name: 'potato')
-
- visit question_path(question_with_author)
- expect(page).to have_link(question_with_author.author.name)
-
- visit question_path(question_with_author_visible_name)
- expect(page).to_not have_link(question_with_author_visible_name.author.name)
- expect(page).to have_content(question_with_author_visible_name.author_visible_name)
- end
-
- scenario '#show view has video_url present' do
- poll = create(:poll)
- normal_question = create(:poll_question, poll: poll, video_url: "https://puppyvideos.com")
-
- visit question_path(normal_question)
-
- expect(page).to have_link(normal_question.video_url)
- end
-
- scenario '#show view has document present' do
- poll = create(:poll)
- normal_question = create(:poll_question, poll: poll)
- document = create(:document, documentable: normal_question)
-
- visit question_path(normal_question)
-
- expect(page).to have_content(document.title)
- end
-
- context 'Answering' do
- let(:geozone) { create(:geozone) }
- let(:poll) { create(:poll, geozone_restricted: true, geozone_ids: [geozone.id]) }
-
- scenario 'Non-logged in users' do
- question = create(:poll_question, valid_answers: 'Han Solo, Chewbacca')
-
- visit question_path(question)
-
- expect(page).to have_content('You must Sign in or Sign up to participate')
- end
-
- scenario 'Level 1 users' do
- question = create(:poll_question, poll: poll, valid_answers: 'Han Solo, Chewbacca')
-
- login_as(create(:user, geozone: geozone))
- visit question_path(question)
-
- expect(page).to have_content('You must verify your account in order to answer')
- end
-
- scenario 'Level 2 users in an poll question for a geozone which is not theirs' do
-
- other_poll = create(:poll, geozone_restricted: true, geozone_ids: [create(:geozone).id])
- question = create(:poll_question, poll: other_poll, valid_answers: 'Vader, Palpatine')
-
- login_as(create(:user, :level_two, geozone: geozone))
- visit question_path(question)
-
- expect(page).to have_content('This question is not available on your geozone')
- end
-
- scenario 'Level 2 users who can answer' do
- question = create(:poll_question, poll: poll, valid_answers: 'Han Solo, Chewbacca')
-
- login_as(create(:user, :level_two, geozone: geozone))
- visit question_path(question)
-
- expect(page).to have_link('Go to voting page')
- end
-
- scenario 'Level 2 users who have already answered' do
- question = create(:poll_question, poll: poll, valid_answers: 'Han Solo, Chewbacca')
-
- user = create(:user, :level_two, geozone: geozone)
- create(:poll_answer, question: question, author: user, answer: 'Chewbacca')
-
- login_as user
- visit question_path(question)
-
- expect(page).to have_link('Go to voting page')
- end
-
- scenario 'Level 2 users answering', :js do
- question = create(:poll_question, poll: poll, valid_answers: 'Han Solo, Chewbacca')
- user = create(:user, :level_two, geozone: geozone)
-
- login_as user
- visit question_path(question)
-
- expect(page).to have_link('Go to voting page')
- end
-
- scenario 'Records participation', :js do
- question = create(:poll_question, poll: poll, valid_answers: 'Han Solo, Chewbacca')
- user = create(:user, :level_two, geozone: geozone, gender: 'female', date_of_birth: 33.years.ago)
-
- login_as user
- visit question_path(question)
-
- click_link 'Go to voting page'
- click_link 'Han Solo'
-
- expect(page).to_not have_link('Han Solo')
-
- voter = poll.voters.first
- expect(voter.document_number).to eq(user.document_number)
- expect(voter.geozone_id).to eq(user.geozone_id)
- expect(voter.gender).to eq(user.gender)
- expect(voter.age).to eq(33)
- expect(voter.poll_id).to eq(poll.id)
- end
-
- end
end
diff --git a/spec/features/polls/voter_spec.rb b/spec/features/polls/voter_spec.rb
index c12a9f0e4..d925d3394 100644
--- a/spec/features/polls/voter_spec.rb
+++ b/spec/features/polls/voter_spec.rb
@@ -10,12 +10,13 @@ feature "Voter" do
user = create(:user, :level_two)
login_as user
- visit question_path(question)
+ visit poll_path(poll)
- click_link 'Go to voting page'
- click_link 'Yes'
+ within("#poll_question_#{question.id}_answers") do
+ click_link 'Yes'
+ expect(page).to_not have_link('Yes')
+ end
- expect(page).to_not have_link('Yes')
expect(Poll::Voter.count).to eq(1)
expect(Poll::Voter.first.origin).to eq("web")
end
@@ -56,7 +57,7 @@ feature "Voter" do
scenario "Trying to vote in web and then in booth", :js do
login_as user
- vote_for_poll_via_web
+ vote_for_poll_via_web(poll, question)
click_link "Sign out"
@@ -79,9 +80,7 @@ feature "Voter" do
click_link "Sign out"
login_as user
- visit question_path(question)
-
- click_link 'Go to voting page'
+ visit poll_path(poll)
expect(page).to_not have_link('Yes')
expect(page).to have_content "You have already participated in a booth for this poll."
diff --git a/spec/shared/features/nested_documentable.rb b/spec/shared/features/nested_documentable.rb
index 10a2c9fbf..8780936a7 100644
--- a/spec/shared/features/nested_documentable.rb
+++ b/spec/shared/features/nested_documentable.rb
@@ -322,5 +322,4 @@ end
def documentable_fill_new_valid_poll_question
page.select documentable.poll.name, from: 'poll_question_poll_id'
fill_in 'poll_question_title', with: "Star Wars: Episode IV - A New Hope"
- fill_in_ckeditor "poll_question_description", with: "Description"
end
diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb
index eda55986f..256b070e4 100644
--- a/spec/support/common_actions.rb
+++ b/spec/support/common_actions.rb
@@ -298,13 +298,14 @@ module CommonActions
end
end
- def vote_for_poll_via_web
- visit question_path(question)
+ def vote_for_poll_via_web(poll, question)
+ visit poll_path(poll)
- click_link 'Go to voting page'
- click_link 'Yes'
+ within("#poll_question_#{question.id}_answers") do
+ click_link 'Yes'
+ expect(page).to_not have_link('Yes')
+ end
- expect(page).to_not have_link('Yes')
expect(Poll::Voter.count).to eq(1)
end
- <%= t("shared.comments.title") %> - (<%= @commentable.comments_count %>) -
- - <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> - - <% if user_signed_in? %> - <%= render 'comments/form', {commentable: @commentable, parent_id: nil, toggeable: false} %> - <% else %> -- -