/
index.html.erb
70 lines (67 loc) · 2.07 KB
/
index.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<% content_for :page_heading do %>
<h2>
<%= t('.media_library') %>
</h2>
<p>
<%= t('.explain_media_library_html') %>
</p>
<% end %>
<%= form_tag({ action: 'upload' }, { enctype: 'multipart/form-data', class: 'form-inline' }) do %>
<div class='well well-small'>
<h3><%= t('.upload_a_file_to_your_site') %></h3>
<div class="form-group">
<%= file_field_tag(:upload, class: 'input-file') %>
</div>
<div class="form-group">
<%= submit_tag(t('.upload'), class: 'btn btn-success') %>
</div>
</div>
<% end %>
<table class="table table-hover">
<thead>
<tr>
<th><%= t('.filename') %> <small>(<%= t('.right_click_for_link') %>)</small></th>
<th><%= t('.content_type') %></th>
<th><%= t('.file_size') %></th>
<th><%= t('.date') %></th>
</tr>
</thead>
<% if @resources.empty? %>
<tr>
<td colspan="6">
<%= t('.no_resources') %>
</td>
</tr>
<% end %>
<% for resource in @resources %>
<tr>
<td>
<% if resource.mime =~ /image/ %>
<a href="<%= resource.upload.medium.url %>" data-toggle="lightbox">
<%= image_tag(resource.upload.thumb.url) %>
</a>
<% else %>
<%= link_to(resource.upload_url, resource.upload_url, download: resource.upload.identifier) %>
<% end %>
<p>
<small>
<% if resource.mime =~ /image/ %>
<%= link_to(t('.thumbnail'), resource.upload.thumb.url) %> |
<%= link_to(t('.medium_size'), resource.upload.medium.url) %> |
<%= link_to(t('.original_size'), resource.upload.url) %> |
<% end %>
<%= link_to(t('.delete'),
{ action: 'destroy', id: resource.id, search: params[:search], page: params[:page] },
{ confirm: t('.are_you_sure'), method: :delete }) %>
</small>
</p>
</td>
<td>
<%= resource.mime %>
</td>
<td><%= resource.upload.size %> bytes</td>
<td><%= l(resource.created_at, format: :short) %></td>
</tr>
<% end %>
<%= display_pagination(@resources, 6) %>
</table>