Show document description in mouseover or column

This commit is contained in:
Karel Picman 2016-06-14 14:39:51 +02:00
parent 2a68400a89
commit 0327b1e6a3
3 changed files with 4 additions and 7 deletions

View File

@ -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

View File

@ -24,7 +24,7 @@
:title => l(:title_check_for_restore_or_delete), :id => "file_#{id}") %></td>
<td class="dmsf_title">
<%= content_tag(:span, h(title),
:title => h(file.tooltip(false)),
:title => h(file.tooltip),
:class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}") %>
<div class="dmsf_filename" title="<%= l(:title_filename_for_download)%>"><%= h(link ? link.path : file.display_name) %></div>
</td>

View File

@ -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"