notebook/app/views/data/uploads.html.erb
2020-01-02 00:45:20 -06:00

67 lines
2.4 KiB
Plaintext

<h4>
<%= link_to data_vault_path, class: 'grey-text tooltipped', style: 'position: relative; top: 4px;', data: {
position: 'bottom',
enterDelay: '500',
tooltip: "Back to your Data Vault"
} do %>
<i class="material-icons">arrow_back</i>
<% end %>
Your notebook's image uploads
</h4>
<div class="row">
<div class="col s12 m6 l6">
<span class="grey-text" style="text-transform: uppercase">used</span>
<div style="font-size: 32px;">
<%= Filesize.from("#{current_user.image_uploads.sum(:src_file_size) / 1000}KB").pretty %>
</div>
</div>
<div class="col s12 m6 l6">
<span class="grey-text" style="text-transform: uppercase">remaining</span>
<div style="font-size: 32px;">
<%= (current_user.upload_bandwidth_kb) > 0 ? Filesize.from("#{current_user.upload_bandwidth_kb}KB").pretty : '-' + Filesize.from("#{current_user.upload_bandwidth_kb.abs}KB").pretty %>
</div>
</div>
</div>
<% if current_user.image_uploads.empty? %>
<div>
Whenever you upload any images to your notebook pages, you'll be able to view them all
in a single place from here.
</div>
<% end %>
<% current_user.image_uploads.includes(:content).each do |upload| %>
<div class="row">
<div class="col s12 m4 l3">
<div class="card">
<div class="card-image">
<%= image_tag upload.src(:medium), class: 'hoverable materialboxed' %>
</div>
</div>
</div>
<div class="col s12 m8 l9">
<ul>
<li>Uploaded to <%= link_to upload.content.name, upload.content %></li>
<li>
Uploaded <%= time_ago_in_words upload.created_at %> ago
<span class="grey-text">
(<%= upload.created_at.strftime("%m/%d/%Y")%>)
</span>
</li>
<li>
Using
<%= Filesize.from("#{upload.src_file_size / 1000}KB").pretty %>
</li>
<li class="grey-text">
Image type: <%= upload.src_content_type %>
</li>
<li>
<%= link_to 'View full size', upload.src(:original), class: 'small btn', target: '_new' %>
<%= link_to 'Delete this image', image_deletion_path(upload.id), class: 'small btn', method: 'delete', data: { confirm: "Are you sure you want to delete this image? This cannot be undone." } %>
</li>
</ul>
</div>
</div>
<% end %>
</div>