app/views/admin/questions/_question_index_table.html.erb
<table class="table table-hover">
<thead>
<tr>
<th><%= Question.human_attribute_name :representative %></th>
<th><%= Question.human_attribute_name :body %></th>
<th><%= Question.human_attribute_name :from_name %></th>
<th><%= Question.human_attribute_name :created_at %></th>
<th><%= Question.human_attribute_name :updated_at %></th>
<th></th>
</tr>
</thead>
<tbody>
<% questions.each do |question| %>
<tr>
<td><%= link_to question.representative.display_name, question.representative %></td>
<td>
<% if !question_approved %>
<%= question.body %>
<% else %>
<%= link_to question.teaser, question, target: '_blank' %>
<% end %>
<% if show_answer %>
<h5>Svar:</h5>
<em><%= question.answer.body %></em>
<% end %>
</td>
<td>
<p><%= question.from_name %>
<small class="muted"><%= question.from_email %></small></p>
</td>
<td>
<small class="muted">
<%= l question.created_at.localtime %>
</small>
</td>
<td>
<small class="muted">
<%= l question.updated_at.localtime %>
</small>
</td>
<td>
<% if show_edit %>
<%= link_to t('app.edit'), edit_admin_question_path(question), class: 'btn btn-small btn-primary' %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>