From 0327b1e6a30564ad7b15a0694d4d742c2aa3a9ae Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Tue, 14 Jun 2016 14:39:51 +0200 Subject: [PATCH] Show document description in mouseover or column --- app/models/dmsf_file.rb | 5 +---- app/views/dmsf/_file_trash.html.erb | 2 +- lib/redmine_dmsf/macros.rb | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index b9ce4b39..f638bbab 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -452,7 +452,7 @@ class DmsfFile < ActiveRecord::Base false end - def tooltip(download_info=true) + def tooltip text = '' if self.last_revision if self.last_revision.description.present? @@ -465,9 +465,6 @@ class DmsfFile < ActiveRecord::Base text += self.last_revision.comment end end - if text.blank? && download_info - text = l(:title_title_version_version_download, :title => self.title, :version => self.version) - end text.html_safe end diff --git a/app/views/dmsf/_file_trash.html.erb b/app/views/dmsf/_file_trash.html.erb index dea5acc3..1e8d9f93 100644 --- a/app/views/dmsf/_file_trash.html.erb +++ b/app/views/dmsf/_file_trash.html.erb @@ -24,7 +24,7 @@ :title => l(:title_check_for_restore_or_delete), :id => "file_#{id}") %> <%= content_tag(:span, h(title), - :title => h(file.tooltip(false)), + :title => h(file.tooltip), :class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}") %>
<%= h(link ? link.path : file.display_name) %>
diff --git a/lib/redmine_dmsf/macros.rb b/lib/redmine_dmsf/macros.rb index 51b333c4..4cdfcf43 100644 --- a/lib/redmine_dmsf/macros.rb +++ b/lib/redmine_dmsf/macros.rb @@ -40,7 +40,7 @@ Redmine::WikiFormatting::Macros.register do return link_to(h(args[1] ? args[1] : file.title), file_view_url, :target => '_blank', - :title => l(:title_title_version_version_download, :title => h(file.title), :version => file.version), + :title => h(file.tooltip), 'data-downloadurl' => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_view_url}") else raise l(:notice_not_authorized) @@ -161,7 +161,7 @@ Redmine::WikiFormatting::Macros.register do end link_to(img, file_view_url, :target => '_blank', - :title => l(:title_title_version_version_download, :title => h(file.title), :version => file.version), + :title => h(file.tooltip), 'data-downloadurl' => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_view_url}") else raise "Document ID #{file_id} not found"