diff --git a/app/views/admin/poll/questions/_questions.html.erb b/app/views/admin/poll/questions/_questions.html.erb index c108ad6a3..b1703f955 100644 --- a/app/views/admin/poll/questions/_questions.html.erb +++ b/app/views/admin/poll/questions/_questions.html.erb @@ -10,14 +10,22 @@ - - + + + <% @questions.each do |question| %> +
<%= t("admin.questions.index.table_question") %><%= t("admin.actions.actions") %><%= t("admin.questions.index.table_question") %><%= t("admin.questions.index.table_poll") %><%= t("admin.actions.actions") %>
<%= link_to question.title, admin_question_path(question) %> + <% if question.poll.present? %> + <%= question.poll.name %> + <% else %> + <%= t("admin.questions.index.poll_not_assigned") %> + <% end %> +
<%= link_to t("shared.edit"), edit_admin_question_path(question), class: "button hollow expanded" %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index fda201f8a..edff8acf7 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -924,6 +924,8 @@ en: create_question: "Create question" table_proposal: "Proposal" table_question: "Question" + table_poll: "Poll" + poll_not_assigned: "Poll not assigned" edit: title: "Edit Question" new: diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 82e5109b9..c099bce58 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -923,6 +923,8 @@ es: create_question: "Crear pregunta para votación" table_proposal: "Propuesta" table_question: "Pregunta" + table_poll: "Votación" + poll_not_assigned: "Votación no asignada" edit: title: "Editar pregunta ciudadana" new: diff --git a/spec/features/admin/poll/questions_spec.rb b/spec/features/admin/poll/questions_spec.rb index 5fedcbb34..3c4d75727 100644 --- a/spec/features/admin/poll/questions_spec.rb +++ b/spec/features/admin/poll/questions_spec.rb @@ -12,13 +12,22 @@ feature 'Admin poll questions' do %w[title] scenario 'Index' do - question1 = create(:poll_question) - question2 = create(:poll_question) + poll1 = create(:poll) + poll2 = create(:poll) + question1 = create(:poll_question, poll: poll1) + question2 = create(:poll_question, poll: poll2) visit admin_questions_path - expect(page).to have_content(question1.title) - expect(page).to have_content(question2.title) + within("#poll_question_#{question1.id}") do + expect(page).to have_content(question1.title) + expect(page).to have_content(poll1.name) + end + + within("#poll_question_#{question2.id}") do + expect(page).to have_content(question2.title) + expect(page).to have_content(poll2.name) + end end scenario 'Show' do