diff --git a/app/views/admin/poll/polls/_questions.html.erb b/app/views/admin/poll/polls/_questions.html.erb index 1629e8c5b..ee5f174ed 100644 --- a/app/views/admin/poll/polls/_questions.html.erb +++ b/app/views/admin/poll/polls/_questions.html.erb @@ -21,6 +21,14 @@ <%= link_to question.title, admin_question_path(question) %> + <% if question.proposal.present? %> + + <%= link_to t("admin.polls.show.see_proposal"), + proposal_path(question.proposal), + target: "_blank" %> + + <% end %> +
<%= link_to t("admin.polls.show.edit_answers"), admin_question_path(question), diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index cbb25e08c..fbaea1a92 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -975,6 +975,7 @@ en: questions_title: "List of questions" table_title: "Title" edit_answers: Edit answers + see_proposal: "(See proposal)" flash: question_added: "Question added to this poll" error_on_question_added: "Question could not be assigned to this poll" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 7bbfbbc41..541212c13 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -974,6 +974,7 @@ es: questions_title: "Listado de preguntas asignadas" table_title: "Título" edit_answers: Editar respuestas + see_proposal: "(Ver propuesta)" flash: question_added: "Pregunta añadida a esta votación" error_on_question_added: "No se pudo asignar la pregunta" diff --git a/spec/features/admin/poll/questions_spec.rb b/spec/features/admin/poll/questions_spec.rb index 2da138b5b..2966671d1 100644 --- a/spec/features/admin/poll/questions_spec.rb +++ b/spec/features/admin/poll/questions_spec.rb @@ -14,8 +14,11 @@ feature "Admin poll questions" do scenario "Index" do poll1 = create(:poll) poll2 = create(:poll) + poll3 = create(:poll) + proposal = create(:proposal) question1 = create(:poll_question, poll: poll1) question2 = create(:poll_question, poll: poll2) + question3 = create(:poll_question, poll: poll3, proposal: proposal) visit admin_poll_path(poll1) expect(page).to have_content(poll1.name) @@ -36,6 +39,17 @@ feature "Admin poll questions" do expect(page).to have_content("Edit") expect(page).to have_content("Delete") end + + visit admin_poll_path(poll3) + expect(page).to have_content(poll3.name) + + within("#poll_question_#{question3.id}") do + expect(page).to have_content(question3.title) + expect(page).to have_link("(See proposal)", href: proposal_path(question3.proposal)) + expect(page).to have_content("Edit answers") + expect(page).to have_content("Edit") + expect(page).to have_content("Delete") + end end scenario "Show" do