fixes booth search in admin

This commit is contained in:
Juanjo Bazán
2017-02-14 16:01:09 +01:00
parent 61ca14e6ec
commit c359b93fd0
2 changed files with 6 additions and 12 deletions

View File

@@ -20,7 +20,7 @@ class Admin::Poll::BoothAssignmentsController < Admin::BaseController
end end
def create def create
@booth_assignment = ::Poll::BoothAssignment.new(poll_id: booth_assignment_params[:poll], booth_id: booth_assignment_params[:booth]) @booth_assignment = ::Poll::BoothAssignment.new(poll_id: booth_assignment_params[:poll_id], booth_id: booth_assignment_params[:booth])
if @booth_assignment.save if @booth_assignment.save
notice = t("admin.poll_booth_assignments.flash.create") notice = t("admin.poll_booth_assignments.flash.create")
@@ -48,7 +48,7 @@ class Admin::Poll::BoothAssignmentsController < Admin::BaseController
end end
def booth_assignment_params def booth_assignment_params
params.permit(:booth, :poll) params.permit(:booth, :poll_id)
end end
def load_poll def load_poll

View File

@@ -25,16 +25,10 @@
<%= booth.location %> <%= booth.location %>
</td> </td>
<td class="text-center"> <td class="text-center">
<% if @poll.booth_ids.include?(booth.id) %> <%= link_to t("admin.poll_booth_assignments.index.add_booth"),
<%= link_to t("admin.poll_booth_assignments.index.remove_booth"), admin_poll_booth_assignments_path(@poll, booth_id: booth.id),
method: :delete, method: :post,
class: "button hollow alert" %> class: "button hollow" %>
<% else %>
<%= link_to t("admin.poll_booth_assignments.index.add_booth"),
admin_poll_booth_assignments_path(poll: @poll, booth: booth),
method: :post,
class: "button hollow" %>
<% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>