Add link to proposal if question was created from a proposal

This commit is contained in:
decabeza
2019-03-13 15:35:31 +01:00
parent a2eea842cb
commit b31b65f246
4 changed files with 24 additions and 0 deletions

View File

@@ -21,6 +21,14 @@
<strong> <strong>
<%= link_to question.title, admin_question_path(question) %> <%= link_to question.title, admin_question_path(question) %>
</strong> </strong>
<% if question.proposal.present? %>
<small>
<%= link_to t("admin.polls.show.see_proposal"),
proposal_path(question.proposal),
target: "_blank" %>
</small>
<% end %>
</td>
<td> <td>
<div class="small-4 column"> <div class="small-4 column">
<%= link_to t("admin.polls.show.edit_answers"), admin_question_path(question), <%= link_to t("admin.polls.show.edit_answers"), admin_question_path(question),

View File

@@ -975,6 +975,7 @@ en:
questions_title: "List of questions" questions_title: "List of questions"
table_title: "Title" table_title: "Title"
edit_answers: Edit answers edit_answers: Edit answers
see_proposal: "(See proposal)"
flash: flash:
question_added: "Question added to this poll" question_added: "Question added to this poll"
error_on_question_added: "Question could not be assigned to this poll" error_on_question_added: "Question could not be assigned to this poll"

View File

@@ -974,6 +974,7 @@ es:
questions_title: "Listado de preguntas asignadas" questions_title: "Listado de preguntas asignadas"
table_title: "Título" table_title: "Título"
edit_answers: Editar respuestas edit_answers: Editar respuestas
see_proposal: "(Ver propuesta)"
flash: flash:
question_added: "Pregunta añadida a esta votación" question_added: "Pregunta añadida a esta votación"
error_on_question_added: "No se pudo asignar la pregunta" error_on_question_added: "No se pudo asignar la pregunta"

View File

@@ -14,8 +14,11 @@ feature "Admin poll questions" do
scenario "Index" do scenario "Index" do
poll1 = create(:poll) poll1 = create(:poll)
poll2 = create(:poll) poll2 = create(:poll)
poll3 = create(:poll)
proposal = create(:proposal)
question1 = create(:poll_question, poll: poll1) question1 = create(:poll_question, poll: poll1)
question2 = create(:poll_question, poll: poll2) question2 = create(:poll_question, poll: poll2)
question3 = create(:poll_question, poll: poll3, proposal: proposal)
visit admin_poll_path(poll1) visit admin_poll_path(poll1)
expect(page).to have_content(poll1.name) 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("Edit")
expect(page).to have_content("Delete") expect(page).to have_content("Delete")
end 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 end
scenario "Show" do scenario "Show" do