@@ -257,37 +257,15 module Redmine | |||||
257 | def subject_for_project(project, options) |
|
257 | def subject_for_project(project, options) | |
258 | case options[:format] |
|
258 | case options[:format] | |
259 | when :html |
|
259 | when :html | |
260 | output = '' |
|
260 | subject = "<span class='icon icon-projects #{project.overdue? ? 'project-overdue' : ''}'>" | |
261 |
|
261 | subject << view.link_to_project(project) | ||
262 | output << "<div class='project-name' style='position: absolute;line-height:1.2em;height:16px;top:#{options[:top]}px;left:#{options[:indent]}px;overflow:hidden;'><small> " |
|
262 | subject << '</span>' | |
263 | if project.is_a? Project |
|
263 | html_subject(options, subject, :css => "project-name") | |
264 | output << "<span class='icon icon-projects #{project.overdue? ? 'project-overdue' : ''}'>" |
|
|||
265 | output << view.link_to_project(project) |
|
|||
266 | output << '</span>' |
|
|||
267 | else |
|
|||
268 | ActiveRecord::Base.logger.debug "Gantt#subject_for_project was not given a project" |
|
|||
269 | '' |
|
|||
270 | end |
|
|||
271 | output << "</small></div>" |
|
|||
272 | @subjects << output |
|
|||
273 | output |
|
|||
274 | when :image |
|
264 | when :image | |
275 |
|
265 | image_subject(options, project.name) | ||
276 | options[:image].fill('black') |
|
|||
277 | options[:image].stroke('transparent') |
|
|||
278 | options[:image].stroke_width(1) |
|
|||
279 | options[:image].text(options[:indent], options[:top] + 2, project.name) |
|
|||
280 | when :pdf |
|
266 | when :pdf | |
281 | pdf_new_page?(options) |
|
267 | pdf_new_page?(options) | |
282 | options[:pdf].SetY(options[:top]) |
|
268 | pdf_subject(options, project.name) | |
283 | options[:pdf].SetX(15) |
|
|||
284 |
|
||||
285 | char_limit = PDF::MaxCharactorsForSubject - options[:indent] |
|
|||
286 | options[:pdf].Cell(options[:subject_width]-15, 5, (" " * options[:indent]) +"#{project.name}".sub(/^(.{#{char_limit}}[^\s]*\s).*$/, '\1 (...)'), "LR") |
|
|||
287 |
|
||||
288 | options[:pdf].SetY(options[:top]) |
|
|||
289 | options[:pdf].SetX(options[:subject_width]) |
|
|||
290 | options[:pdf].Cell(options[:g_width], 5, "", "LR") |
|
|||
291 | end |
|
269 | end | |
292 | end |
|
270 | end | |
293 |
|
271 | |||
@@ -317,35 +295,15 module Redmine | |||||
317 | def subject_for_version(version, options) |
|
295 | def subject_for_version(version, options) | |
318 | case options[:format] |
|
296 | case options[:format] | |
319 | when :html |
|
297 | when :html | |
320 | output = '' |
|
298 | subject = "<span class='icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}'>" | |
321 | output << "<div class='version-name' style='position: absolute;line-height:1.2em;height:16px;top:#{options[:top]}px;left:#{options[:indent]}px;overflow:hidden;'><small> " |
|
299 | subject << view.link_to_version(version) | |
322 | if version.is_a? Version |
|
300 | subject << '</span>' | |
323 | output << "<span class='icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}'>" |
|
301 | html_subject(options, subject, :css => "version-name") | |
324 | output << view.link_to_version(version) |
|
|||
325 | output << '</span>' |
|
|||
326 | else |
|
|||
327 | ActiveRecord::Base.logger.debug "Gantt#subject_for_version was not given a version" |
|
|||
328 | '' |
|
|||
329 | end |
|
|||
330 | output << "</small></div>" |
|
|||
331 | @subjects << output |
|
|||
332 | output |
|
|||
333 | when :image |
|
302 | when :image | |
334 | options[:image].fill('black') |
|
303 | image_subject(options, version.to_s_with_project) | |
335 | options[:image].stroke('transparent') |
|
|||
336 | options[:image].stroke_width(1) |
|
|||
337 | options[:image].text(options[:indent], options[:top] + 2, version.to_s_with_project) |
|
|||
338 | when :pdf |
|
304 | when :pdf | |
339 | pdf_new_page?(options) |
|
305 | pdf_new_page?(options) | |
340 | options[:pdf].SetY(options[:top]) |
|
306 | pdf_subject(options, version.to_s_with_project) | |
341 | options[:pdf].SetX(15) |
|
|||
342 |
|
||||
343 | char_limit = PDF::MaxCharactorsForSubject - options[:indent] |
|
|||
344 | options[:pdf].Cell(options[:subject_width]-15, 5, (" " * options[:indent]) +"#{version.to_s_with_project}".sub(/^(.{#{char_limit}}[^\s]*\s).*$/, '\1 (...)'), "LR") |
|
|||
345 |
|
||||
346 | options[:pdf].SetY(options[:top]) |
|
|||
347 | options[:pdf].SetX(options[:subject_width]) |
|
|||
348 | options[:pdf].Cell(options[:g_width], 5, "", "LR") |
|
|||
349 | end |
|
307 | end | |
350 | end |
|
308 | end | |
351 |
|
309 | |||
@@ -376,54 +334,24 module Redmine | |||||
376 | def subject_for_issue(issue, options) |
|
334 | def subject_for_issue(issue, options) | |
377 | case options[:format] |
|
335 | case options[:format] | |
378 | when :html |
|
336 | when :html | |
379 |
|
|
337 | css_classes = '' | |
380 | output << "<div class='tooltip'>" |
|
338 | css_classes << ' issue-overdue' if issue.overdue? | |
381 | output << "<div class='issue-subject' style='position: absolute;line-height:1.2em;height:16px;top:#{options[:top]}px;left:#{options[:indent]}px;overflow:hidden;'><small> " |
|
339 | css_classes << ' issue-behind-schedule' if issue.behind_schedule? | |
382 | if issue.is_a? Issue |
|
340 | css_classes << ' icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to | |
383 | css_classes = [] |
|
341 | ||
384 | css_classes << 'issue-overdue' if issue.overdue? |
|
342 | subject = "<span class='#{css_classes}'>" | |
385 | css_classes << 'issue-behind-schedule' if issue.behind_schedule? |
|
343 | if issue.assigned_to.present? | |
386 | css_classes << 'icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to |
|
344 | assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name | |
387 |
|
345 | subject << view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string) | ||
388 | if issue.assigned_to.present? |
|
|||
389 | assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name |
|
|||
390 | output << view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string) |
|
|||
391 | end |
|
|||
392 | output << "<span class='#{css_classes.join(' ')}'>" |
|
|||
393 | output << view.link_to_issue(issue) |
|
|||
394 | output << '</span>' |
|
|||
395 | else |
|
|||
396 | ActiveRecord::Base.logger.debug "Gantt#subject_for_issue was not given an issue" |
|
|||
397 | '' |
|
|||
398 | end |
|
|||
399 | output << "</small></div>" |
|
|||
400 |
|
||||
401 | # Tooltip |
|
|||
402 | if issue.is_a? Issue |
|
|||
403 | output << "<span class='tip' style='position: absolute;top:#{ options[:top].to_i + 16 }px;left:#{ options[:indent].to_i + 20 }px;'>" |
|
|||
404 | output << view.render_issue_tooltip(issue) |
|
|||
405 | output << "</span>" |
|
|||
406 | end |
|
346 | end | |
407 |
|
347 | subject << view.link_to_issue(issue) | ||
408 |
|
|
348 | subject << '</span>' | |
409 | @subjects << output |
|
349 | html_subject(options, subject, :css => "issue-subject") | |
410 | output |
|
|||
411 | when :image |
|
350 | when :image | |
412 | options[:image].fill('black') |
|
351 | image_subject(options, issue.subject) | |
413 | options[:image].stroke('transparent') |
|
|||
414 | options[:image].stroke_width(1) |
|
|||
415 | options[:image].text(options[:indent], options[:top] + 2, issue.subject) |
|
|||
416 | when :pdf |
|
352 | when :pdf | |
417 | pdf_new_page?(options) |
|
353 | pdf_new_page?(options) | |
418 | options[:pdf].SetY(options[:top]) |
|
354 | pdf_subject(options, issue.subject) | |
419 | options[:pdf].SetX(15) |
|
|||
420 |
|
||||
421 | char_limit = PDF::MaxCharactorsForSubject - options[:indent] |
|
|||
422 | options[:pdf].Cell(options[:subject_width]-15, 5, (" " * options[:indent]) +"#{issue.tracker} #{issue.id}: #{issue.subject}".sub(/^(.{#{char_limit}}[^\s]*\s).*$/, '\1 (...)'), "LR") |
|
|||
423 |
|
||||
424 | options[:pdf].SetY(options[:top]) |
|
|||
425 | options[:pdf].SetX(options[:subject_width]) |
|
|||
426 | options[:pdf].Cell(options[:g_width], 5, "", "LR") |
|
|||
427 | end |
|
355 | end | |
428 | end |
|
356 | end | |
429 |
|
357 | |||
@@ -759,6 +687,33 module Redmine | |||||
759 | end |
|
687 | end | |
760 | end |
|
688 | end | |
761 |
|
689 | |||
|
690 | def html_subject(params, subject, options={}) | |||
|
691 | output = "<div class=' #{options[:css] }' style='position: absolute;line-height:1.2em;height:16px;top:#{params[:top]}px;left:#{params[:indent]}px;overflow:hidden;'>" | |||
|
692 | output << subject | |||
|
693 | output << "</div>" | |||
|
694 | @subjects << output | |||
|
695 | output | |||
|
696 | end | |||
|
697 | ||||
|
698 | def pdf_subject(params, subject, options={}) | |||
|
699 | params[:pdf].SetY(params[:top]) | |||
|
700 | params[:pdf].SetX(15) | |||
|
701 | ||||
|
702 | char_limit = PDF::MaxCharactorsForSubject - params[:indent] | |||
|
703 | params[:pdf].Cell(params[:subject_width]-15, 5, (" " * params[:indent]) + subject.to_s.sub(/^(.{#{char_limit}}[^\s]*\s).*$/, '\1 (...)'), "LR") | |||
|
704 | ||||
|
705 | params[:pdf].SetY(params[:top]) | |||
|
706 | params[:pdf].SetX(params[:subject_width]) | |||
|
707 | params[:pdf].Cell(params[:g_width], 5, "", "LR") | |||
|
708 | end | |||
|
709 | ||||
|
710 | def image_subject(params, subject, options={}) | |||
|
711 | params[:image].fill('black') | |||
|
712 | params[:image].stroke('transparent') | |||
|
713 | params[:image].stroke_width(1) | |||
|
714 | params[:image].text(params[:indent], params[:top] + 2, subject) | |||
|
715 | end | |||
|
716 | ||||
762 | def html_task(params, coords, options={}) |
|
717 | def html_task(params, coords, options={}) | |
763 | output = '' |
|
718 | output = '' | |
764 | # Renders the task bar, with progress and late |
|
719 | # Renders the task bar, with progress and late |
General Comments 0
You need to be logged in to leave comments.
Login now