adds booth assignation to admin poll
This commit is contained in:
@@ -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 %>
|
||||
@@ -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") %>
|
||||
|
||||
14
app/views/admin/poll/polls/_search_booths.html.erb
Normal file
14
app/views/admin/poll/polls/_search_booths.html.erb
Normal 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>
|
||||
32
app/views/admin/poll/polls/_search_booths_results.html.erb
Normal file
32
app/views/admin/poll/polls/_search_booths_results.html.erb
Normal 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>
|
||||
1
app/views/admin/poll/polls/search_booths.js.erb
Normal file
1
app/views/admin/poll/polls/search_booths.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#search-booths-results").html("<%= j render 'search_booths_results' %>");
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user