app/views/spectrums/show/_set.html.erb
<div class="modal hide fade" id="setmodal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<b>Add this spectrum to a set</b>
</div>
<div class="modal-body">
<% unless logged_in? %>
<p><b>You must be logged in to edit sets.</b></p>
<% else %>
<% unless @spectrum.calibrated %>
<p><b>Your spectrum must be calibrated to add it to sets.</b></p>
<% else %>
<form method="get" id="setSearchForm" action="javascript:void(0);" class="form-search">
<input placeholder="Search sets" class='search-query input-medium' id='setsearchinput' type='text' name='q' value=''/>
<button class="btn btn-primary" type='submit'><i class="fa fa-search fa-white"></i></button>
</form>
<script>
$("#setSearchForm").submit(function(){
var url = "<%= set_search_spectrum_path(@spectrum) %>?q="+$("#setsearchinput").val()
$("#set_search_result").html($W.ajaxLoading).load(url)
});
</script>
<div id="set_search_result">
<%= render :partial => "spectrums/show/set_results" %>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<a data-dismiss="modal" class="btn" href="javascript:void();">Cancel</a>
</div>
</div>