Adds poll name on admin poll questions index

This commit is contained in:
decabeza
2018-12-19 21:00:09 +01:00
parent d583c93ebf
commit 9c827d6ce0
4 changed files with 27 additions and 6 deletions

View File

@@ -10,14 +10,22 @@
<table class="fixed">
<thead>
<tr>
<th class="small-8"><%= t("admin.questions.index.table_question") %></th>
<th><%= t("admin.actions.actions") %></th>
<th><%= t("admin.questions.index.table_question") %></th>
<th><%= t("admin.questions.index.table_poll") %></th>
<th class="small-4"><%= t("admin.actions.actions") %></th>
</tr>
</thead>
<tbody>
<% @questions.each do |question| %>
<tr id="<%= dom_id(question) %>">
<td><%= link_to question.title, admin_question_path(question) %></td>
<td>
<% if question.poll.present? %>
<%= question.poll.name %>
<% else %>
<em><%= t("admin.questions.index.poll_not_assigned") %></em>
<% end %>
</td>
<td>
<div class="small-6 column">
<%= link_to t("shared.edit"), edit_admin_question_path(question), class: "button hollow expanded" %>

View File

@@ -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:

View File

@@ -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:

View File

@@ -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
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