publiclab/spectral-workbench

View on GitHub
app/views/macros/_list.html.erb

Summary

Maintainability
Test Coverage
<table class="table">
  <tr>
    <th>Title</th>
    <th>Description</th>
    <th>Author</th>
    <th>Link</th>
    <th>Actions</th>
  </tr>
  <% @macros.each do |macro| %>
  <tr>
    <td style="width:20%;"><b><a target="_blank" href="/macro/<%= macro.user.login %>/<%= macro.title %>"><%= macro.title %></a></b></td>
    <td style="width:40%;"><small><%=h macro.description %></small></td>
    <td><a href="/macros/author/<%= macro.user.login %>"><%= macro.user.login %></a></td>
    <td style="width:20%;"><a href="<%= macro.url %>"><%= truncate(macro.url,:length => 20, :omission => "...") %></a></td>
    <td><% if params[:controller] == "spectrums" && params[:action] == "show" %><a class="btn btn-primary" onClick="$W.run_macro('<%= macro.user.login+'\',\''+macro.title %>')" href="javascript:void();">Run</a><% end %></td>
  </tr>
  <% end %>
</table>