adds booth assignation to admin poll

This commit is contained in:
Juanjo Bazán
2016-12-23 19:05:16 +01:00
parent 89979e549f
commit 8b4f519d71
13 changed files with 207 additions and 12 deletions

View File

@@ -24,11 +24,12 @@
</td>
<td class="text-right">
<%= link_to t("admin.polls.show.remove_booth"),
"#",
admin_booth_assignment_path(poll: @poll, booth: booth),
method: :delete,
class: "button hollow alert" %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% end %>

View File

@@ -1,4 +1,4 @@
<ul class="tabs" data-tabs id="example-tabs">
<ul class="tabs" data-tabs id="assigned-resources-tabs">
<li class="tabs-title is-active">
<%= link_to "#tab-questions" do %>
<%= t("admin.polls.show.questions_tab") %>

View File

@@ -0,0 +1,14 @@
<%= form_tag(search_booths_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.booths_search.placeholder"), id: "search-booths" %>
</div>
<div class="form-inline small-12 medium-3 column end">
<%= submit_tag t("admin.shared.booths_search.button"), class: "button" %>
</div>
</div>
<% end %>
<div id="search-booths-results"></div>

View File

@@ -0,0 +1,32 @@
<table>
<thead>
<tr>
<th colspan="3"><%= @booths.blank? ? t('admin.polls.show.no_search_results') : t('admin.polls.show.search_results') %></th>
</tr>
</thead>
<tbody>
<% @booths.each do |booth| %>
<tr>
<td>
<%= booth.name %>
</td>
<td>
<%= booth.location %>
</td>
<td class="text-right">
<% if @poll.booth_ids.include?(booth.id) %>
<%= link_to t("admin.polls.show.remove_booth"),
admin_booth_assignment_path(poll: @poll, booth: booth),
method: :delete,
class: "button hollow alert" %>
<% else %>
<%= link_to t("admin.polls.show.add_booth"),
admin_booth_assignments_path(poll: @poll, booth: booth),
method: :post,
class: "button hollow" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

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

View File

@@ -7,7 +7,7 @@
edit_admin_poll_path(@poll),
class: "button hollow float-right" %>
<div class="tabs-content" data-tabs-content="example-tabs">
<div id="poll-resources" class="tabs-content" data-tabs-content="assigned-resources-tabs">
<%= render "filter_subnav" %>
<div class="tabs-panel is-active" id="tab-questions">
@@ -15,6 +15,7 @@
</div>
<div class="tabs-panel" id="tab-booths">
<%= render "search_booths" %>
<%= render "booths" %>
</div>