mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-28 13:31:06 +00:00
101 lines
2.9 KiB
Text
101 lines
2.9 KiB
Text
<h1 class="title">Files</h1>
|
|
|
|
<p>
|
|
<% if @directory.root? %>
|
|
In case there are any problems with this browser, you can find files
|
|
<%= link_to "here", "/files/" %>
|
|
too.
|
|
<% end%>
|
|
</p>
|
|
|
|
<%
|
|
active = 1
|
|
n = 1
|
|
%>
|
|
|
|
<div id="files" class="tabbed">
|
|
<ul id="files-nav" class="tabs">
|
|
<% @directories.each do |dir| %>
|
|
<li><a href="#dir_<%= dir.id %>"><%= h dir.name %></a></li>
|
|
<% end %>
|
|
</ul>
|
|
|
|
<div class="tabbed-contents">
|
|
<% @directories.each do |dir| %>
|
|
<div class="tab" id="dir_<%= dir.id %>">
|
|
<%
|
|
if @directory.full_path.include?(dir.full_path)
|
|
dir = @directory
|
|
active = n
|
|
end
|
|
n = n + 1
|
|
%>
|
|
|
|
<div class="directories">
|
|
<% if !dir.parent_root? %>
|
|
<h3><%= directory_links @directory %></h3>
|
|
<% end %>
|
|
<% if !dir.subdirs.ordered.empty? %>
|
|
<% if dir.parent_root? %>
|
|
<h3>Sub-directories</h3>
|
|
<% end %>
|
|
<div class="subdirectories">
|
|
<ul class="disc">
|
|
<% dir.subdirs.ordered.each do |subdir| %>
|
|
<li><%= link_to subdir.name, subdir %></li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<h3>Files</h3>
|
|
|
|
<% dir.files.unrelated.each do |file| %>
|
|
<div class="file">
|
|
<div class="actions">
|
|
<% if file.can_update? cuser %>
|
|
<%= link_to icon('pencil'), edit_data_file_path(file) %>
|
|
<% end %>
|
|
|
|
<% if file.can_destroy? cuser %>
|
|
<%= link_to icon('times'), file, confirm: 'Are you sure?', method: :delete %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<h4><%= namelink file %></h4>
|
|
<p><strong>Size:</strong> <%= file.size_s %>MB</p>
|
|
|
|
<div class="comments">
|
|
<%= link_to file do %>
|
|
<%= icon('comments') %> Comments (<%= file.comments.count %>)
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= link_to 'Download', file.url, class: 'button tiny' %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if dir.files.empty? %>
|
|
<p>Empty directory.</p>
|
|
<% end %>
|
|
|
|
<% if cuser and cuser.admin? %>
|
|
<div class="controls">
|
|
<%= link_to "Edit Directory", edit_directory_path(dir), class: 'button' %>
|
|
<%= link_to "Delete Directory", dir, data: { confirm: "Are you sure?" }, method: 'delete', class: 'button' %>
|
|
<%= link_to "New Directory", { controller: "directories", action: "new", id: dir }, { class: 'button' } %>
|
|
<%= link_to "New File", { controller: "data_files", action: "new", id: dir }, { class: 'button' } %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
new Yetii({
|
|
id: 'files',
|
|
active: <%= active %>
|
|
});
|
|
</script>
|