Skip to content

Instantly share code, notes, and snippets.

@tbrooke
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbrooke/9865def645faeaa5490a to your computer and use it in GitHub Desktop.
Save tbrooke/9865def645faeaa5490a to your computer and use it in GitHub Desktop.
Service Request Abstractor Selector
$(function() {
$("#modal-1").on("change", function() {
if ($(this).is(":checked")) {
$("body").addClass("modal-open");
} else {
$("body").removeClass("modal-open");
}
});
$(".modal-window").on("click", function() {
$(".modal-state:checked").prop("checked", false).change();
});
$(".modal-inner").on("click", function(e) {
e.stopPropagation();
});
});
<div>
<table>
<thead>
<tr>
<td>Lease</td>
<td>Delivery</td>
</tr>
</thead>
<tbody>
<% @submitted = @services.in_state('submitted','approve_fee', 'fee_accepted') %>
<%= will_paginate @submitted %>
<% @submitted.each do |submit| %>
<tr>
<td><%= link_to submit.lease_number, submit %></td>
<td><%= submit.current_state %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="modal">
<label for="modal-1">
<div class="modal-trigger">Assign</div>
</label>
<input class="modal-state" id="modal-1" type="checkbox" />
<div class="modal-window">
<div class="modal-inner">
<label class="modal-close" for="modal-1"></label>
<h1>Abstractors</h1>
<table>
<% @abstractors.each do |abstractor| %>
<tr>
<td><%= check_box 'ok', abstractor_dispatcher_path(abstractor), method: :put %></td>
<td><%= link_to(abstractor.last_name, abstractor_path(abstractor)) %></td>
<td><%= abstractor.phone %></td>
<td><%= abstractor.email %></td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment