publiclab/spectral-workbench

View on GitHub
app/views/spectrums/show/_clone.html.erb

Summary

Maintainability
Test Coverage
<div class="modal hide fade" id="clonemodal">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <b>Use a fluorescent bulb spectrum to calibrate your spectrometer</b>
  </div>
  <div class="modal-body">
    <p>You can use a previous fluorescent bulb spectrum from the same spectrometer to calibrate this spectrum, as long as the device has not been modified.</p>
    <p>First, choose a recent calibrated spectrum; the most recent is selected by default:</p>

    <% unless logged_in? %>
      <p><b>You must be logged in to copy a calibration.</b></p>
    <% else %>

    <form method="get" id="cloneSearchForm" action="javascript:void(0);" class="form-search">
      <input placeholder="Search spectra" class='search-query input-medium' id='clonesearchinput' type='text' name='q' value=''/>
      <button class="btn btn-primary" type='submit'><i class="fa fa-search fa-white"></i></button>
    </form>

    <script>
    $("#cloneSearchForm").submit(function(){
      var url = "<%= clone_search_spectrum_path(@spectrum) %>?q="+$("#clonesearchinput").val()
      $("#clone_search_result").html($W.ajaxLoading).load(url)
    });
    </script>

    <div id="clone_search_result">
      <%= render :partial => "spectrums/show/clone_results" %>
    </div>

    <% end %>

  </div>
  <div class="modal-footer">
    <a data-dismiss="modal" class="btn" href="javascript:void();">Cancel</a>
  </div>
</div>