publiclab/plots2

View on GitHub
app/views/editor/_images.html.erb

Summary

Maintainability
Test Coverage
<div class="modal hide fade" id="images_modal" style="display:none;">
  <div class="modal-header">
    <b>Choose a recently uploaded image</b>
  </div>
  <div class="modal-body">

    <table class="table" id="images">
    <tr>
      <th>Image</th>
      <th>Filename</th>
      <th>Uploaded</th>
      <th style="width:150px;">Actions</th>
    </tr>
    <% if current_user %>
      <% current_user.images.reverse[0..3].each do |image| %>
        <tr>
          <td><%= image_tag image.photo.url(:thumb), :class => "rounded" %></td>
          <td><%= image.photo_file_name %></td>
          <td><%= time_ago_in_words(image.created_at) %> ago</td>
          <td><a class="btn" id="img_<%= image.id %>">Use as main</a></td>
          <script>
            $('#img_<%= image.id %>').bind('click',function(e) {
              alert('Not yet implemented.')
            })
          </script>
        </tr>
      <% end %>
    <% end %>
    </table>

  </div>
  <div class="modal-footer">
    <button tabindex="4" type="submit" class="btn btn-primary btn-lg">Add image</button>

  </div>
</div>