comparison lib/redmine/helpers/gantt.rb @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents cbce1fd3b1b7
children 433d4f72a19b
comparison
equal deleted inserted replaced
908:c6c2cbd0afee 909:cbb26bc654de
258 end 258 end
259 259
260 def subject_for_project(project, options) 260 def subject_for_project(project, options)
261 case options[:format] 261 case options[:format]
262 when :html 262 when :html
263 subject = "<span class='icon icon-projects #{project.overdue? ? 'project-overdue' : ''}'>" 263 subject = "<span class='icon icon-projects #{project.overdue? ? 'project-overdue' : ''}'>".html_safe
264 subject << view.link_to_project(project) 264 subject << view.link_to_project(project).html_safe
265 subject << '</span>' 265 subject << '</span>'.html_safe
266 html_subject(options, subject, :css => "project-name") 266 html_subject(options, subject, :css => "project-name")
267 when :image 267 when :image
268 image_subject(options, project.name) 268 image_subject(options, project.name)
269 when :pdf 269 when :pdf
270 pdf_new_page?(options) 270 pdf_new_page?(options)
296 end 296 end
297 297
298 def subject_for_version(version, options) 298 def subject_for_version(version, options)
299 case options[:format] 299 case options[:format]
300 when :html 300 when :html
301 subject = "<span class='icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}'>" 301 subject = "<span class='icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}'>".html_safe
302 subject << view.link_to_version(version) 302 subject << view.link_to_version(version).html_safe
303 subject << '</span>' 303 subject << '</span>'.html_safe
304 html_subject(options, subject, :css => "version-name") 304 html_subject(options, subject, :css => "version-name")
305 when :image 305 when :image
306 image_subject(options, version.to_s_with_project) 306 image_subject(options, version.to_s_with_project)
307 when :pdf 307 when :pdf
308 pdf_new_page?(options) 308 pdf_new_page?(options)
345 css_classes = '' 345 css_classes = ''
346 css_classes << ' issue-overdue' if issue.overdue? 346 css_classes << ' issue-overdue' if issue.overdue?
347 css_classes << ' issue-behind-schedule' if issue.behind_schedule? 347 css_classes << ' issue-behind-schedule' if issue.behind_schedule?
348 css_classes << ' icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to 348 css_classes << ' icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to
349 349
350 subject = "<span class='#{css_classes}'>" 350 subject = "<span class='#{css_classes}'>".html_safe
351 if issue.assigned_to.present? 351 if issue.assigned_to.present?
352 assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name 352 assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name
353 subject << view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string).to_s 353 subject << view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string).to_s.html_safe
354 end 354 end
355 subject << view.link_to_issue(issue) 355 subject << view.link_to_issue(issue).html_safe
356 subject << '</span>' 356 subject << '</span>'.html_safe
357 html_subject(options, subject, :css => "issue-subject", :title => issue.subject) + "\n" 357 html_subject(options, subject, :css => "issue-subject", :title => issue.subject) + "\n"
358 when :image 358 when :image
359 image_subject(options, issue.subject) 359 image_subject(options, issue.subject)
360 when :pdf 360 when :pdf
361 pdf_new_page?(options) 361 pdf_new_page?(options)
735 735
736 def html_task(params, coords, options={}) 736 def html_task(params, coords, options={})
737 output = '' 737 output = ''
738 # Renders the task bar, with progress and late 738 # Renders the task bar, with progress and late
739 if coords[:bar_start] && coords[:bar_end] 739 if coords[:bar_start] && coords[:bar_end]
740 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>" 740 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
741 741
742 if coords[:bar_late_end] 742 if coords[:bar_late_end]
743 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>" 743 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
744 end 744 end
745 if coords[:bar_progress_end] 745 if coords[:bar_progress_end]
746 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>" 746 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
747 end 747 end
748 end 748 end
749 # Renders the markers 749 # Renders the markers
750 if options[:markers] 750 if options[:markers]
751 if coords[:start] 751 if coords[:start]
752 output << "<div style='top:#{ params[:top] }px;left:#{ coords[:start] }px;width:15px;' class='#{options[:css]} marker starting'>&nbsp;</div>" 752 output << "<div style='top:#{ params[:top] }px;left:#{ coords[:start] }px;width:15px;' class='#{options[:css]} marker starting'>&nbsp;</div>".html_safe
753 end 753 end
754 if coords[:end] 754 if coords[:end]
755 output << "<div style='top:#{ params[:top] }px;left:#{ coords[:end] + params[:zoom] }px;width:15px;' class='#{options[:css]} marker ending'>&nbsp;</div>" 755 output << "<div style='top:#{ params[:top] }px;left:#{ coords[:end] + params[:zoom] }px;width:15px;' class='#{options[:css]} marker ending'>&nbsp;</div>".html_safe
756 end 756 end
757 end 757 end
758 # Renders the label on the right 758 # Renders the label on the right
759 if options[:label] 759 if options[:label]
760 output << "<div style='top:#{ params[:top] }px;left:#{ (coords[:bar_end] || 0) + 8 }px;' class='#{options[:css]} label'>" 760 output << "<div style='top:#{ params[:top] }px;left:#{ (coords[:bar_end] || 0) + 8 }px;' class='#{options[:css]} label'>".html_safe
761 output << options[:label] 761 output << options[:label]
762 output << "</div>" 762 output << "</div>".html_safe
763 end 763 end
764 # Renders the tooltip 764 # Renders the tooltip
765 if options[:issue] && coords[:bar_start] && coords[:bar_end] 765 if options[:issue] && coords[:bar_start] && coords[:bar_end]
766 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;'>" 766 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
767 output << '<span class="tip">' 767 output << '<span class="tip">'.html_safe
768 output << view.render_issue_tooltip(options[:issue]) 768 output << view.render_issue_tooltip(options[:issue]).html_safe
769 output << "</span></div>" 769 output << "</span></div>".html_safe
770 end 770 end
771 @lines << output 771 @lines << output
772 output 772 output
773 end 773 end
774 774