adds officer search to admin polls

This commit is contained in:
Juanjo Bazán
2016-12-27 12:36:16 +01:00
parent 122fd5f9ff
commit ee8c057a46
9 changed files with 58 additions and 3 deletions

View File

@@ -0,0 +1,14 @@
<%= form_tag(search_officers_admin_poll_path(@poll), method: :get, remote: true) do |f| %>
<div class="row">
<div class="small-12 medium-6 column">
<%= text_field_tag :search,
@search,
placeholder: t("admin.shared.poll_officers_search.placeholder"), id: "search-officers" %>
</div>
<div class="form-inline small-12 medium-3 column end">
<%= submit_tag t("admin.shared.poll_officers_search.button"), class: "button" %>
</div>
</div>
<% end %>
<div id="search-officers-results"></div>

View File

@@ -0,0 +1,22 @@
<table>
<thead>
<tr>
<th colspan="3"><%= @officers.blank? ? t('admin.polls.show.no_search_results') : t('admin.polls.show.search_results') %></th>
</tr>
</thead>
<tbody>
<% @officers.each do |officer| %>
<tr>
<td>
<%= officer.name %>
</td>
<td>
<%= officer.email %>
</td>
<td class="text-right">
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1 @@
$("#search-officers-results").html("<%= j render 'search_officers_results' %>");

View File

@@ -21,6 +21,7 @@
</div>
<div class="tabs-panel" id="tab-officers">
<%= render "search_officers" %>
<%= render 'officers' %>
</div>
</div>