Permalink
Browse files

asking people to mark what kind of spectrometer they are using

  • Loading branch information...
1 parent 734d5da commit 51bc5b9bfa84071e00084c0d5df3c6a2f54d0e80 @jywarren committed Dec 21, 2012
@@ -190,10 +190,12 @@ def create
@spectrum = Spectrum.find @spectrum.id
@spectrum.rotate if params[:vertical] == "on"
@spectrum.sample_row = @spectrum.find_brightest_row
+ @spectrum.tag("mobile",current_user.id)
end
- if params[:tags]
- @spectrum.tag(params[:tags],current_user.id)
- end
+ @spectrum.tag("iOS",current_user.id) if ios?
+ @spectrum.tag(params[:tags],current_user.id) if params[:tags]
+ @spectrum.tag("upload",current_user.id) if params[:upload]
+ @spectrum.tag(params[:device],current_user.id) if params[:device] && params[:device] != "none"
if params[:spectrum][:calibration_id] && !params[:is_calibration] && params[:spectrum][:calibration_id] != "calibration"
@spectrum.extract_data
@spectrum.clone(params[:spectrum][:calibration_id])
@@ -223,11 +223,12 @@ def tags
# a string of either a single tag name or a series of comma-delimited tags
def tag(tags,user_id)
tags.split(',').each do |name|
- Tag.new({
+ tag = Tag.new({
:spectrum_id => self.id,
:name => name.strip,
:user_id => user_id,
- }).save!
+ })
+ tag.save! unless self.has_tag(tag.name)
end
end
@@ -20,7 +20,19 @@
<input name="geotag" type="hidden" id="geotag" />
<input name="lat" type="hidden" id="lat" />
<input name="lon" type="hidden" id="lon" />
+
+ <p>
+ <label for="device">Choose a device:</label>
+ <select name="device" id="device">
+ <option value="none">choose a device</option>
+ <option value="device:dsk">Desktop Spectrometry Kit</option>
+ <option value="device:foldable">Foldable Mini-Spectrometer</option>
+ <option value="device:custom">custom spectrometer</option>
+ </select>
+ </p>
+
<% if logged_in? %>
+ <label for="calibration_id">Use an existing calibration:</label>
<select name="spectrum[calibration_id]" id="calibration_id">
<% current_user.tag('calibration').each do |spectrum| %>
<option value="<%= spectrum.id %>"><%= spectrum.title %> (<%= time_ago_in_words(spectrum.created_at) %>)</option>
@@ -65,7 +65,14 @@
<input name="geotag" type="hidden" id="geotag" />
<input name="lat" type="hidden" id="lat" />
<input name="lon" type="hidden" id="lon" />
+ <label for="device">If possible, identify your device:</label>
+ <select name="device" id="device">
+ <option value="device:foldable">Foldable Mini-Spectrometer</option>
+ <option value="device:dsk">Desktop Spectrometry Kit</option>
+ <option value="device:custom">custom design</option>
+ </select>
<% if logged_in? %>
+ <label for="calibration_id">Use an existing calibration:</label>
<select name="spectrum[calibration_id]" id="calibration_id">
<% current_user.tag('calibration').each do |spectrum| %>
<option value="<%= spectrum.id %>"><%= spectrum.title %> (<%= time_ago_in_words(spectrum.created_at) %>)</option>
@@ -72,9 +72,19 @@
})()
</script>
+ <label for="device">If possible, identify your device:</label>
+ <select name="device" id="device">
+ <option value="none">- choose a device -</option>
+ <option value="device:dsk">Desktop Spectrometry Kit</option>
+ <option value="device:foldable">Foldable Mini-Spectrometer</option>
+ <option value="device:custom">custom design</option>
+ </select>
+ <br />
+
<input type='hidden' name='authenticity_token' value="<%= form_authenticity_token %>"/>
<button class="btn btn-primary btn-large" onClick="$W.save()" style="margin-right:10px;">Upload</button>
+ <input name="upload" type="hidden" id="upload" value="true" />
<input name="geotag" type="hidden" id="geotag" />
<input name="lat" type="hidden" id="lat" />
<input name="lon" type="hidden" id="lon" />

0 comments on commit 51bc5b9

Please sign in to comment.