Wrong tool-tip for dmsf macro #545

This commit is contained in:
Karel Picman 2016-07-20 07:25:34 +02:00
parent 6ec5fe3719
commit 111a27fc98
5 changed files with 14 additions and 20 deletions

View File

@ -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 += '&#xA;'
end
text += self.last_revision.comment
end
end
text.html_safe
end
end

View File

@ -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 += '&#xA;' if text.present?
text += self.comment
end
text.html_safe
end
end

View File

@ -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}") %>
<div class="dmsf_filename" title="<%= l(:title_filename_for_download)%>"><%= h(link ? link.path : file.display_name) %></div>
<%= '</span>'.html_safe if @tree_view %>

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),
:title => h(file.last_revision.try(: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 => h(file.tooltip),
:title => h(revision.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 => h(file.tooltip),
:title => h(file.last_revision.try(:tooltip)),
'data-downloadurl' => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_view_url}")
else
raise "Document ID #{file_id} not found"