Files

<% active = 1 n = 1 %>
<% @directories.each do |dir| %>
<% if @directory.path.include?(dir.path) dir = @directory active = n end n = n + 1 %>
<% if !dir.subdirs.ordered.empty? or dir.parent.id != Directory::ROOT %>

Directories

<% end %>
    <% if dir.parent.id != Directory::ROOT %>
  • <%= link_to "Parent", dir.parent %>
  • <% end %> <% dir.subdirs.ordered.each do |subdir| %>
  • <%= namelink subdir %>
  • <% end %>

Files

<% dir.files.unrelated.each do |file| %>
<% 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 %>

<%= namelink file %>

Size: <%= file.size_s %>MB

<%= link_to file do %> <%= icon('comments') %> Comments (<%= file.comments.count %>) <% end %>
<%= link_to 'Download', file.url, class: 'button tiny' %>
<% end %> <% if dir.files.empty? %>

Empty directory.

<% end %> <% if cuser and cuser.admin? %>
<%= link_to "Edit Directory", edit_directory_path(dir), class: 'button' %> <%= link_to "Delete Directory", dir, confirm: "Are you REALLY 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' } %>
<% end %>
<% end %>