app/views/spectrums/edit.html.erb
<div class="container-fluid" style="clear:both;">
<h1>Edit spectrum</h1>
<p>
<img src="<%= @spectrum.photo.url(:large) %>" />
</p>
<% if params[:login] && !logged_in? %>
<div class="notice" id="login_prompt">
<h3>You must be logged in to save spectra</h3>
<p>Please log in first:</p>
<p><a href="/login?return_to=/spectra/edit/<%= @spectrum.id %>" class="button">Log in</a></p>
</div>
<% end %>
<%= form_for(@spectrum, :html => { :multipart => true }) do |f| %>
<% if @spectrum.errors.any? %>
<div class="alert alert-error">
<h3>There were errors with your data.</h3>
<ul>
<% @spectrum.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<p>
<label for="title">Title</label>
<input id="title" name="spectrum[title]" type="text" class="span9" value="<%= @spectrum.title %>" />
</p>
<p>
<label for="notes">Notes</label>
<textarea cols="80" id="notes" name="spectrum[notes]" type="text" class="span9"><%= @spectrum.notes %></textarea>
</p>
<p>
<input class="btn-primary btn" type="submit" value="Submit" />
<% if current_user.role == 'admin' %>
<%= link_to '<i class="fa fa-trash"></i> Delete'.html_safe, { :action => "destroy", :id => @spectrum.id },
data: { confirm: 'Are you sure?' }, :method => :delete, :class => "btn btn-medium" %>
<% end %>
<%= link_to 'Back', spectrums_path %>
</p>
<% end %>
</div>