app/views/sets/show.html.erb
<%= render :partial => "embed/modal", :locals => { datum: @set, type: :set } %>
<div id="graphing" class="swb-graphing sets">
<div id="graph">
<div class="zoom"><a onClick="graph.zoom();" class="btn-zoom"><i class="fa fa-zoom-in"></i></a></div>
<i class="fa fa-spinner fa-spin"></i>
</div>
<script type="text/javascript">
var graph;
jQuery(document).ready(function($) {
graph = new SpectralWorkbench.Graph({
set_id: <%= @set.id %>,
calibrated: <%= @set.some_calibrated %>
});
});
</script>
<%= render :partial => "graph/header", :locals => {type: :set, datum: @set } %>
<div class="row-fluid below">
<div class="col span12">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab-spectra" data-toggle="tab"><i class="fa fa-list"></i> Spectra</a></li>
<li> <a href="#tab-description" data-toggle="tab">Description</a></li>
<li> <a href="#tab-comments" data-toggle="tab"><i class="fa fa-comments"></i> <%= @set.comments.length %> Comments</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab-spectra">
<%= render partial: 'graph/spectra', locals: { datum: @set, spectrums: @spectrums } %>
<hr />
<div style="width:100%;text-align:center;">
<div class="btn-group export">
<a target="_blank" class="btn btn-small svg" onClick="SpectralWorkbench.API.Core.exportSVG('set-<%= @set.id %>');"><b>SVG</b></a>
<a target="_blank" rel="tooltip" title="Currently displayed data" class="btn btn-small btn-download-json"><b>JSON</b></a>
<a target="_blank" rel="tooltip" title="Raw data before modifications" class="btn btn-small" href="/sets/<%= @set.id %>.json"><b>raw JSON</b></a>
<!--
<a target="_blank" class="btn btn-small disabled" href="/sets/<%= @set.id %>.csv"><b>CSV</b></a>
<a target="_blank" class="btn btn-small disabled" href="/sets/<%= @set.id %>.xml"><b>XML</b></a>
-->
<a rel="tooltip" class="btn btn-small" href="//publiclab.org/wiki/spectral-workbench-exporting" title="About export formats"><i class="fa fa-question-circle"></i></a>
</div>
<% if logged_in? %>
<div class="btn-group">
<a class="btn btn-small btn-add-spectra"><i class="fa fa-plus-circle"></i> Add spectra</a>
</div>
<% end %>
</div>
<div class="spectra-search" style="display:none;margin-left:20px;">
<form class="form-search">
<div class="pull-right">
<select name="own" class="select-author">
<option value="true" selected>Your spectra</option>
<option value="false">All spectra</option>
</select>
</div>
<input type="text" class="input-medium input-choose-spectrum" placeholder="search">
<button type="submit" class="btn"><i class="fa fa-search"></i></button>
</form>
<div class="results">
</div>
<hr />
</div>
<% if logged_in? && current_user.login == @set.author || logged_in? && current_user.role == "admin" %>
<div class="btn-group export" style="width:100%;text-align:center; margin-top: 20px;">
<%= link_to '<i class="fa fa-trash"></i> Delete'.html_safe, "/sets/delete/"+@set.id.to_s, :confirm => 'Are you sure?', :class => "btn btn-small" %>
</div>
<% end %>
<%= render partial: 'graph/notifications', locals: { type: :set } %>
</div>
<div class="tab-pane" id="tab-description">
<div class="row-fluid">
<div class="span2">
<% @set.spectrums.each do |spectrum| %>
<a href="<%= spectrum.photo.url(:original) %>"><img src="<%= spectrum.photo.url(:thumb) %>" style="width:100%" /></a>
<% end %>
</div>
<div class="span8">
<h3>Description <small><a href="/sets/edit/<%= @set.id %>"><i class="fa fa-pencil"></i></a></small></h3>
<p>
<% if @set.notes %>
<%=raw RDiscount.new(@set.notes).to_html %>
<% else %>
No description.
<% end %>
</p>
</div>
</div>
</div>
<div class="tab-pane" id="tab-comments">
<div class="row-fluid">
<div class="span2">
</div>
<div class="span8">
<%= render partial: 'comments/list', locals: { datum: @set, comments: @set.comments } %>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>