diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index f638bbab..bd8b2a3c 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -452,20 +452,4 @@ class DmsfFile < ActiveRecord::Base false end - def tooltip - text = '' - if self.last_revision - if self.last_revision.description.present? - text = self.last_revision.description - end - if self.last_revision.comment.present? - if text.present? - text += ' ' - end - text += self.last_revision.comment - end - end - text.html_safe - end - end diff --git a/app/models/dmsf_file_revision.rb b/app/models/dmsf_file_revision.rb index c628fc82..310e4174 100644 --- a/app/models/dmsf_file_revision.rb +++ b/app/models/dmsf_file_revision.rb @@ -284,4 +284,14 @@ class DmsfFileRevision < ActiveRecord::Base end end + def tooltip + text = '' + text = self.description if self.description.present? + if self.comment.present? + text += ' ' if text.present? + text += self.comment + end + text.html_safe + end + end \ No newline at end of file diff --git a/app/views/dmsf/_file.html.erb b/app/views/dmsf/_file.html.erb index 3a1af275..951b8e01 100644 --- a/app/views/dmsf/_file.html.erb +++ b/app/views/dmsf/_file.html.erb @@ -33,7 +33,7 @@ file_view_url, :target => '_blank', :class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}", - :title => file.tooltip, + :title => file.last_revision.try(:tooltip), 'data-downloadurl' => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_view_url}") %>