Rails3: lib: helper: use html_safe for Gantt

Contributed by Sylvain Utard.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7557 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-10-01 01:13:03 +00:00
parent 4d787ce228
commit e2f57b5874
1 changed files with 21 additions and 21 deletions

View File

@ -260,9 +260,9 @@ module Redmine
def subject_for_project(project, options) def subject_for_project(project, options)
case options[:format] case options[:format]
when :html when :html
subject = "<span class='icon icon-projects #{project.overdue? ? 'project-overdue' : ''}'>" subject = "<span class='icon icon-projects #{project.overdue? ? 'project-overdue' : ''}'>".html_safe
subject << view.link_to_project(project) subject << view.link_to_project(project).html_safe
subject << '</span>' subject << '</span>'.html_safe
html_subject(options, subject, :css => "project-name") html_subject(options, subject, :css => "project-name")
when :image when :image
image_subject(options, project.name) image_subject(options, project.name)
@ -298,9 +298,9 @@ module Redmine
def subject_for_version(version, options) def subject_for_version(version, options)
case options[:format] case options[:format]
when :html when :html
subject = "<span class='icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}'>" subject = "<span class='icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}'>".html_safe
subject << view.link_to_version(version) subject << view.link_to_version(version).html_safe
subject << '</span>' subject << '</span>'.html_safe
html_subject(options, subject, :css => "version-name") html_subject(options, subject, :css => "version-name")
when :image when :image
image_subject(options, version.to_s_with_project) image_subject(options, version.to_s_with_project)
@ -347,13 +347,13 @@ module Redmine
css_classes << ' issue-behind-schedule' if issue.behind_schedule? css_classes << ' issue-behind-schedule' if issue.behind_schedule?
css_classes << ' icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to css_classes << ' icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to
subject = "<span class='#{css_classes}'>" subject = "<span class='#{css_classes}'>".html_safe
if issue.assigned_to.present? if issue.assigned_to.present?
assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name
subject << view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string).to_s subject << view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string).to_s.html_safe
end end
subject << view.link_to_issue(issue) subject << view.link_to_issue(issue).html_safe
subject << '</span>' subject << '</span>'.html_safe
html_subject(options, subject, :css => "issue-subject", :title => issue.subject) + "\n" html_subject(options, subject, :css => "issue-subject", :title => issue.subject) + "\n"
when :image when :image
image_subject(options, issue.subject) image_subject(options, issue.subject)
@ -737,36 +737,36 @@ module Redmine
output = '' output = ''
# Renders the task bar, with progress and late # Renders the task bar, with progress and late
if coords[:bar_start] && coords[:bar_end] if coords[:bar_start] && coords[:bar_end]
output << "<div style='top:#{ params[:top] }px;left:#{ coords[:bar_start] }px;width:#{ coords[:bar_end] - coords[:bar_start] - 2}px;' class='#{options[:css]} task_todo'>&nbsp;</div>" output << "<div style='top:#{ params[:top] }px;left:#{ coords[:bar_start] }px;width:#{ coords[:bar_end] - coords[:bar_start] - 2}px;' class='#{options[:css]} task_todo'>&nbsp;</div>".html_safe
if coords[:bar_late_end] if coords[:bar_late_end]
output << "<div style='top:#{ params[:top] }px;left:#{ coords[:bar_start] }px;width:#{ coords[:bar_late_end] - coords[:bar_start] - 2}px;' class='#{options[:css]} task_late'>&nbsp;</div>" output << "<div style='top:#{ params[:top] }px;left:#{ coords[:bar_start] }px;width:#{ coords[:bar_late_end] - coords[:bar_start] - 2}px;' class='#{options[:css]} task_late'>&nbsp;</div>".html_safe
end end
if coords[:bar_progress_end] if coords[:bar_progress_end]
output << "<div style='top:#{ params[:top] }px;left:#{ coords[:bar_start] }px;width:#{ coords[:bar_progress_end] - coords[:bar_start] - 2}px;' class='#{options[:css]} task_done'>&nbsp;</div>" output << "<div style='top:#{ params[:top] }px;left:#{ coords[:bar_start] }px;width:#{ coords[:bar_progress_end] - coords[:bar_start] - 2}px;' class='#{options[:css]} task_done'>&nbsp;</div>".html_safe
end end
end end
# Renders the markers # Renders the markers
if options[:markers] if options[:markers]
if coords[:start] if coords[:start]
output << "<div style='top:#{ params[:top] }px;left:#{ coords[:start] }px;width:15px;' class='#{options[:css]} marker starting'>&nbsp;</div>" output << "<div style='top:#{ params[:top] }px;left:#{ coords[:start] }px;width:15px;' class='#{options[:css]} marker starting'>&nbsp;</div>".html_safe
end end
if coords[:end] if coords[:end]
output << "<div style='top:#{ params[:top] }px;left:#{ coords[:end] + params[:zoom] }px;width:15px;' class='#{options[:css]} marker ending'>&nbsp;</div>" output << "<div style='top:#{ params[:top] }px;left:#{ coords[:end] + params[:zoom] }px;width:15px;' class='#{options[:css]} marker ending'>&nbsp;</div>".html_safe
end end
end end
# Renders the label on the right # Renders the label on the right
if options[:label] if options[:label]
output << "<div style='top:#{ params[:top] }px;left:#{ (coords[:bar_end] || 0) + 8 }px;' class='#{options[:css]} label'>" output << "<div style='top:#{ params[:top] }px;left:#{ (coords[:bar_end] || 0) + 8 }px;' class='#{options[:css]} label'>".html_safe
output << options[:label] output << options[:label]
output << "</div>" output << "</div>".html_safe
end end
# Renders the tooltip # Renders the tooltip
if options[:issue] && coords[:bar_start] && coords[:bar_end] if options[:issue] && coords[:bar_start] && coords[:bar_end]
output << "<div class='tooltip' style='position: absolute;top:#{ params[:top] }px;left:#{ coords[:bar_start] }px;width:#{ coords[:bar_end] - coords[:bar_start] }px;height:12px;'>" output << "<div class='tooltip' style='position: absolute;top:#{ params[:top] }px;left:#{ coords[:bar_start] }px;width:#{ coords[:bar_end] - coords[:bar_start] }px;height:12px;'>".html_safe
output << '<span class="tip">' output << '<span class="tip">'.html_safe
output << view.render_issue_tooltip(options[:issue]) output << view.render_issue_tooltip(options[:issue]).html_safe
output << "</span></div>" output << "</span></div>".html_safe
end end
@lines << output @lines << output
output output