redmine_dmsf: last update of the folders #130

This commit is contained in:
Karel Pičman 2014-08-01 10:06:45 +02:00
parent ffd87acfcd
commit 57b76ae2db
2 changed files with 18 additions and 1 deletions

View File

@ -279,6 +279,23 @@ class DmsfFolder < ActiveRecord::Base
[results, results_count]
end
def modified
last_update = updated_at
subfolders.each do |subfolder|
last_update = subfolder.updated_at if subfolder.updated_at > last_update
end
files.each do |file|
last_update = file.updated_at if file.updated_at > last_update
end
folder_links.each do |folder_link|
last_update = folder_link.updated_at if folder_link.updated_at > last_update
end
file_links.each do |file_link|
last_update = file_link.updated_at if file_link.updated_at > last_update
end
last_update
end
private

View File

@ -34,7 +34,7 @@
<% end %>
</td>
<td class="size"></td>
<td class="modified"><%= format_time(subfolder.updated_at) %>
<td class="modified"><%= format_time(subfolder.modified) %>
<% if locked_for_user %>
<% if subfolder.lock.reverse[0].user %>
<%= link_to('',