As mentioned in commit5214d89c8, using a `<select>` tag which automatically submits a form on change has a few accessibility issues, particularly for keyboard users who might accidentally submit the form while browsing the options. So we're adding a submit button and removing the "submit on change" behavior. Note that, while `<select>` tags have their own usability issues, alternatives in this case are not obvious because the number of existing polls could be very low (zero, for instance) or very high (dozens, if the application has been used for years). I thought of using a `<datalist>` tag with a regular text input. The problem here is we don't want to send the name of the poll to the server (as we would with a `<datalist>` tag); we want to send the ID of the poll. Maybe we could add an automplete field instead, providing a similar funcionality. However, for now we're keeping it simple. This poll questions page isn't even accessible through the admin menu since commit83e8d603, so right now anything we change here will be pretty much useless.
40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
<%= render Admin::Poll::Questions::FilterComponent.new(@polls) %>
|
|
|
|
<% if @questions.count == 0 %>
|
|
<div class="callout primary margin-top">
|
|
<%= t("admin.questions.index.no_questions") %>
|
|
</div>
|
|
<% else %>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th><%= t("admin.questions.index.table_question") %></th>
|
|
<th><%= t("admin.questions.index.table_poll") %></th>
|
|
<th><%= t("admin.actions.actions") %></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @questions.each do |question| %>
|
|
<tr id="<%= dom_id(question) %>">
|
|
<td><%= question.title %></td>
|
|
<td>
|
|
<% if question.poll.present? %>
|
|
<%= question.poll.name %>
|
|
<% else %>
|
|
<em><%= t("admin.questions.index.poll_not_assigned") %></em>
|
|
<% end %>
|
|
</td>
|
|
<td>
|
|
<%= render Admin::TableActionsComponent.new(question) do |actions| %>
|
|
<%= actions.link_to t("admin.polls.show.edit_answers"), admin_question_path(question),
|
|
class: "answers-link" %>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
|
|
<%= paginate @questions %>
|
|
<% end %>
|