ensl.org/app/views/directories/show.html.erb

102 lines
2.9 KiB
Text
Raw Normal View History

2014-04-26 20:21:11 +00:00
<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>
<%
2014-04-26 20:21:11 +00:00
active = 1
n = 1
%>
2014-04-26 20:21:11 +00:00
<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>
2014-04-26 20:21:11 +00:00
<div class="tabbed-contents">
<% @directories.each do |dir| %>
2014-04-26 20:21:11 +00:00
<div class="tab" id="dir_<%= dir.id %>">
<%
if @directory.full_path.include?(dir.full_path)
2014-04-26 20:21:11 +00:00
dir = @directory
active = n
end
n = n + 1
%>
2014-04-26 20:21:11 +00:00
<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>
2014-04-26 20:21:11 +00:00
<% end %>
</div>
2014-04-26 20:21:11 +00:00
<h3>Files</h3>
2014-04-26 20:21:11 +00:00
<% 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 %>
2014-04-26 20:21:11 +00:00
<% if file.can_destroy? cuser %>
<%= link_to icon('times'), file, confirm: 'Are you sure?', method: :delete %>
<% end %>
</div>
2014-04-26 20:21:11 +00:00
<h4><%= namelink file %></h4>
<p><strong>Size:</strong> <%= file.size_s %>MB</p>
2014-04-26 20:21:11 +00:00
<div class="comments">
<%= link_to file do %>
<%= icon('comments') %> Comments (<%= file.comments.count %>)
<% end %>
</div>
2014-04-26 20:21:11 +00:00
<%= link_to 'Download', file.url, class: 'button tiny' %>
</div>
<% end %>
2014-04-26 20:21:11 +00:00
<% if dir.files.empty? %>
<p>Empty directory.</p>
<% end %>
2014-04-26 20:21:11 +00:00
<% if cuser and cuser.admin? %>
<div class="controls">
<%= link_to "Edit Directory", edit_directory_path(dir), class: 'button' %>
2020-04-01 02:40:17 +00:00
<%= link_to "Delete Directory", dir, data: { confirm: "Are you sure?" }, method: 'delete', class: 'button' %>
2014-04-26 20:21:11 +00:00
<%= 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>
2014-04-26 20:21:11 +00:00
</div>
2014-04-26 20:21:11 +00:00
<script type="text/javascript">
new Yetii({
id: 'files',
active: <%= active %>
});
</script>