Add link to proposal if question was created from a proposal
This commit is contained in:
@@ -21,6 +21,14 @@
|
||||
<strong>
|
||||
<%= link_to question.title, admin_question_path(question) %>
|
||||
</strong>
|
||||
<% if question.proposal.present? %>
|
||||
<small>
|
||||
<%= link_to t("admin.polls.show.see_proposal"),
|
||||
proposal_path(question.proposal),
|
||||
target: "_blank" %>
|
||||
</small>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small-4 column">
|
||||
<%= link_to t("admin.polls.show.edit_answers"), admin_question_path(question),
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user