From 96084390fd716e495a4c17de1554a2d97f09bfdd Mon Sep 17 00:00:00 2001 From: Daniel Munn Date: Thu, 12 Jul 2012 11:28:07 +0100 Subject: [PATCH] Fixes #24 Dynamic columns are forced into timestamp with zone the same as ActiveRecord, views have been updated to use format_date which converts time to local timezone based on preferences. --- app/models/dmsf_file_revision.rb | 2 +- app/views/dmsf/show.html.erb | 4 ++-- app/views/dmsf_files/_revision_access.html.erb | 4 ++-- app/views/dmsf_files/show.html.erb | 2 +- assets/stylesheets/dmsf.css | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/models/dmsf_file_revision.rb b/app/models/dmsf_file_revision.rb index aa86117c..8a5788d1 100644 --- a/app/models/dmsf_file_revision.rb +++ b/app/models/dmsf_file_revision.rb @@ -106,7 +106,7 @@ class DmsfFileRevision < ActiveRecord::Base # custom SQL into a temporary object # def access_grouped - access.select("user_id, count(*) as count, min(created_at) as min, max(created_at) as max").group("user_id") + access.select("user_id, count(*) as count, min(created_at) as first_at, max(created_at) as last_at").group("user_id") end def version diff --git a/app/views/dmsf/show.html.erb b/app/views/dmsf/show.html.erb index d24ceb00..e59b50c4 100644 --- a/app/views/dmsf/show.html.erb +++ b/app/views/dmsf/show.html.erb @@ -81,7 +81,7 @@ <%= render "custom_fields", :object => subfolder %> <%= number_to_human_size(subfolder.deep_size) %> - <%= subfolder.updated_at.strftime("%Y-%m-%d %H:%M") %> + <%= format_time(subfolder.updated_at) %> <% if subfolder.locked_for_user? %> <%= link_to(image_tag("locked.png", :plugin => :redmine_dmsf), {:controller => "users", :action => "show", :id => subfolder.lock.reverse[0].user }, @@ -159,7 +159,7 @@ <%= number_to_human_size(file.last_revision.size) %> - <%= file.last_revision.updated_at.strftime("%Y-%m-%d %H:%M") %> + <%= format_time(file.last_revision.updated_at) %> <% if file.locked_for_user? %> <%= link_to(image_tag("locked.png", :plugin => :redmine_dmsf), {:controller => "users", :action => "show", :id => file.lock.reverse[0].user }, diff --git a/app/views/dmsf_files/_revision_access.html.erb b/app/views/dmsf_files/_revision_access.html.erb index 2a443816..86a41e46 100644 --- a/app/views/dmsf_files/_revision_access.html.erb +++ b/app/views/dmsf_files/_revision_access.html.erb @@ -13,8 +13,8 @@ <%=link_to_user(access.user)%> <%=access["count"]%> - <%=access.min.to_s%> - <%=access.max.to_s%> + <%=format_time(access.first_at.to_time(ActiveRecord::Base.default_timezone))%> + <%=format_time(access.last_at.to_time(ActiveRecord::Base.default_timezone))%> <% end %> diff --git a/app/views/dmsf_files/show.html.erb b/app/views/dmsf_files/show.html.erb index 8213e2fb..a0263f83 100644 --- a/app/views/dmsf_files/show.html.erb +++ b/app/views/dmsf_files/show.html.erb @@ -71,7 +71,7 @@

<%=label_tag("", (revision.source_revision.nil? ? l(:label_created) : l(:label_changed)) + ":")%> - <%= l(:info_changed_by_user, :changed => revision.updated_at.strftime("%Y-%m-%d %H:%M:%S"), :user => h(revision.user)) %> + <%= l(:info_changed_by_user, :changed => format_time(revision.updated_at), :user => h(revision.user)) %>

diff --git a/assets/stylesheets/dmsf.css b/assets/stylesheets/dmsf.css index e5382a23..9b4eccdd 100644 --- a/assets/stylesheets/dmsf.css +++ b/assets/stylesheets/dmsf.css @@ -14,8 +14,8 @@ table.entries { } table.entries td.modified { - min-width: 120px; - width: 120px; + min-width: 140px; + width: 140px; } table.entries td.actions {