app/views/macros/edit.html.erb
<div class="container-fluid">
<div class="span9">
<h1><%= @macro.title %></h1>
<p>Use the <a href="http://publiclab.org/wiki/spectral-workbench-api">Spectral Workbench API</a> to create, save, and share macros to manipulate your spectra. Also share your macros on <a href="http://gist.github.com">gist.github.com</a>.</p>
<div class="alert alert-error"><%= errors_for @macro %></div>
<form action="/macros/update/<%= @macro.id %>" class="form" method="post">
<input type='hidden' name='authenticity_token' value="<%= form_authenticity_token %>"/>
<input placeholder="title: no spaces or punctuation" name="title" size="30" type="text" value="<%=h @macro.title %>" />
<br />
<label for="url">Enter a URL for your macro:</label>
<input placeholder="http://gist.github.com/..." name="url" size="30" type="text" value="<%=h @macro.url %>" />
<br />
<textarea class="span6" placeholder="describe your macro" name="description" rows="2"><%=h @macro.description %></textarea>
<br />
<label for="code">Paste your macro's code here:</label>
<textarea class="span6" name="code" rows="10"><%=h @macro.code || "setup: function() {
// code to run on startup
},
draw: function() {
// code to run every frame
}" %></textarea>
<br />
<label for="macro_type">On what page is your macro used:</label>
<select name="macro_type">
<option value="analyze">Analyze</option>
<option value="capture">Capture</option>
</select>
<br />
<button class="btn-large btn-primary" type="submit">Save</button>
</form>
</div>
</div>