@@ -257,37 +257,15 module Redmine | |||
|
257 | 257 | def subject_for_project(project, options) |
|
258 | 258 | case options[:format] |
|
259 | 259 | when :html |
|
260 | output = '' | |
|
261 | ||
|
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> " | |
|
263 | if project.is_a? Project | |
|
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 | |
|
260 | subject = "<span class='icon icon-projects #{project.overdue? ? 'project-overdue' : ''}'>" | |
|
261 | subject << view.link_to_project(project) | |
|
262 | subject << '</span>' | |
|
263 | html_subject(options, subject, :css => "project-name") | |
|
274 | 264 | when :image |
|
275 | ||
|
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) | |
|
265 | image_subject(options, project.name) | |
|
280 | 266 | when :pdf |
|
281 | 267 | pdf_new_page?(options) |
|
282 | options[:pdf].SetY(options[:top]) | |
|
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") | |
|
268 | pdf_subject(options, project.name) | |
|
291 | 269 | end |
|
292 | 270 | end |
|
293 | 271 | |
@@ -317,35 +295,15 module Redmine | |||
|
317 | 295 | def subject_for_version(version, options) |
|
318 | 296 | case options[:format] |
|
319 | 297 | when :html |
|
320 | output = '' | |
|
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> " | |
|
322 | if version.is_a? Version | |
|
323 | output << "<span class='icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}'>" | |
|
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 | |
|
298 | subject = "<span class='icon icon-package #{version.behind_schedule? ? 'version-behind-schedule' : ''} #{version.overdue? ? 'version-overdue' : ''}'>" | |
|
299 | subject << view.link_to_version(version) | |
|
300 | subject << '</span>' | |
|
301 | html_subject(options, subject, :css => "version-name") | |
|
333 | 302 | when :image |
|
334 | options[:image].fill('black') | |
|
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) | |
|
303 | image_subject(options, version.to_s_with_project) | |
|
338 | 304 | when :pdf |
|
339 | 305 | pdf_new_page?(options) |
|
340 | options[:pdf].SetY(options[:top]) | |
|
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") | |
|
306 | pdf_subject(options, version.to_s_with_project) | |
|
349 | 307 | end |
|
350 | 308 | end |
|
351 | 309 | |
@@ -376,54 +334,24 module Redmine | |||
|
376 | 334 | def subject_for_issue(issue, options) |
|
377 | 335 | case options[:format] |
|
378 | 336 | when :html |
|
379 |
|
|
|
380 | output << "<div class='tooltip'>" | |
|
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> " | |
|
382 | if issue.is_a? Issue | |
|
383 | css_classes = [] | |
|
384 | css_classes << 'issue-overdue' if issue.overdue? | |
|
385 | css_classes << 'issue-behind-schedule' if issue.behind_schedule? | |
|
386 | css_classes << 'icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to | |
|
387 | ||
|
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>" | |
|
337 | css_classes = '' | |
|
338 | css_classes << ' issue-overdue' if issue.overdue? | |
|
339 | css_classes << ' issue-behind-schedule' if issue.behind_schedule? | |
|
340 | css_classes << ' icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to | |
|
341 | ||
|
342 | subject = "<span class='#{css_classes}'>" | |
|
343 | if issue.assigned_to.present? | |
|
344 | assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name | |
|
345 | subject << view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string) | |
|
406 | 346 | end |
|
407 | ||
|
408 |
|
|
|
409 | @subjects << output | |
|
410 | output | |
|
347 | subject << view.link_to_issue(issue) | |
|
348 | subject << '</span>' | |
|
349 | html_subject(options, subject, :css => "issue-subject") | |
|
411 | 350 | when :image |
|
412 | options[:image].fill('black') | |
|
413 | options[:image].stroke('transparent') | |
|
414 | options[:image].stroke_width(1) | |
|
415 | options[:image].text(options[:indent], options[:top] + 2, issue.subject) | |
|
351 | image_subject(options, issue.subject) | |
|
416 | 352 | when :pdf |
|
417 | 353 | pdf_new_page?(options) |
|
418 | options[:pdf].SetY(options[:top]) | |
|
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") | |
|
354 | pdf_subject(options, issue.subject) | |
|
427 | 355 | end |
|
428 | 356 | end |
|
429 | 357 | |
@@ -759,6 +687,33 module Redmine | |||
|
759 | 687 | end |
|
760 | 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 | 717 | def html_task(params, coords, options={}) |
|
763 | 718 | output = '' |
|
764 | 719 | # Renders the task bar, with progress and late |
General Comments 0
You need to be logged in to leave comments.
Login now