app/views/capture/_save.html.erb
<div class="container-fluid">
<div class="hidden-phone span3">
<p>Label and annotate your spectrum so that you can find and analyze it later.</p>
<p>Good tagging can be extremely helpful; if you are doing a set of tests, consider tagging them all with a consistent tag name like "oliveoil" or "detergent".</p>
</div>
<div class="span9">
<img style="display:none;background:#333;" id="spectrum-preview" />
<h3 style="margin-bottom:6px;">Save this spectrum
<% if logged_in? %>
<small><i>(logged in as <%=h current_user.login %>)</i></small></h3>
<% else %>
</h3>
<p class="alert">You must be <a href="/login">logged in</a> to save spectra.</small></p>
<% end %>
<form class="form" action="/spectrums" method="post" id="saveForm" target="_blank" onSubmit="window.location='#page1'">
<input id="saveform_title" placeholder="Title (required)" name="spectrum[title]" type="text" /><br />
<div class="input-prepend">
<span class="add-on"><i class="fa fa-tags"></i></span>
<input name="tags" id="spectrum_tags" type="text" placeholder="Tags: mobile, soil, sunlight" data-provide="typeahead" data-source="['calibration','soil','']">
</div>
<p>Recent tags:
<span id="recent-tags">
<% if @calibration %>
(<a onClick="tag('<%= @calibration.tags.collect(&:name).join(',') %>')">all</a>)
<% @calibration.normaltags.each do |tag| %>
<a class="label label-info" onClick="tag(this.innerHTML);this.remove()"><%= tag.name %></a>
<% end %>
<% end %>
</span>
</p>
<script>
tag = function(tag) {
if ($('#spectrum_tags').val() =="") {
$('#spectrum_tags').val(tag)
} else {
$('#spectrum_tags').val($('#spectrum_tags').val()+','+tag)
}
}
save_tags = function(tags) {
tags = $('#spectrum_tags').val().split(',').concat(tags)
$.each(tags,function(tag) {
$('#recent-tags').append('<a class="label label-info" onClick="tag(this.innerHTML)">'+tag+'</a> ')
})
}
</script>
<br />
<textarea placeholder="Describe your spectrum: light source? Sample preparation? What's your goal?" style="span8" rows="6" name="spectrum[notes]" id="spectrum_notes"></textarea>
<br />
<input name="video_row" type="hidden" id="video_row" />
<input name="dataurl" type="hidden" id="dataurl" value="<%= params[:dataurl] %>" />
<input name="upload" type="hidden" id="upload" value="<%= params[:upload] %>" />
<input name="geotag" type="hidden" id="geotag" value="<%= params[:geotag] %>" />
<input name="lat" type="hidden" id="lat" value="<%= params[:lat] %>" />
<input name="lon" type="hidden" id="lon" value="<%= params[:lon] %>" />
<% if logged_in? %>
<p><small>Choose a recent reference calibration, or use this as a new calibration.</small></p>
<select name="spectrum[calibration_id]" id="calibration_id" style="width:100%;">
<%= render partial: 'capture/calibrations', locals: { calibrations: @calibrations, calibration: @calibration } %>
</select>
<% end %>
<label rel="tooltip" title="Detect your location and tag this data?" class="checkbox inline" style="margin-left:10px;">
<input type="checkbox" style="display:none;" id="geotagInput" value="geotag" checked="true" /> Geotag
</label>
</form>
<% if logged_in? %>
<a class="btn btn-primary btn-large" href="#capture" onClick="$('#saveForm').submit();$('#spectrum-preview').hide();$('#capture-btn').addClass('active');$('#settings-btn').removeClass('active');" data-toggle="tab">Save with selected calibration</a>
<a class="btn btn-large" href="#capture" onClick="$('#calibration_id').val('calibration');$('#saveForm').submit();$('#spectrum-preview').hide();$('#capture-btn').addClass('active');$('#settings-btn').removeClass('active');" data-toggle="tab">Save & calibrate later</a>
<% end %>
<a class="btn btn-large" href="#capture" onClick="$W.cancelSave();$('#capture-btn').addClass('active');$('#settings-btn').removeClass('active');" data-toggle="tab">« Back</a>
<p>By uploading your data, you agree to release it under the <a href="http://creativecommons.org/publicdomain/zero/1.0/">Creative Commons Zero license</a></p>
</div>
</div>
<br style="margin-top:20px;" />