@@ -435,65 +435,11 module Redmine | |||
|
435 | 435 | |
|
436 | 436 | case options[:format] |
|
437 | 437 | when :html |
|
438 | output = '' | |
|
439 | i_left = ((version.start_date - self.date_from)*options[:zoom]).floor | |
|
440 | # TODO: or version.fixed_issues.collect(&:start_date).min | |
|
441 | start_date = version.fixed_issues.minimum('start_date') if version.fixed_issues.present? | |
|
442 | start_date ||= self.date_from | |
|
443 | start_left = ((start_date - self.date_from)*options[:zoom]).floor | |
|
444 | ||
|
445 | i_end_date = ((version.due_date <= self.date_to) ? version.due_date : self.date_to ) | |
|
446 | i_done_date = start_date + ((version.due_date - start_date+1)* version.completed_pourcent/100).floor | |
|
447 | i_done_date = (i_done_date <= self.date_from ? self.date_from : i_done_date ) | |
|
448 | i_done_date = (i_done_date >= self.date_to ? self.date_to : i_done_date ) | |
|
438 | coords = coordinates(version.fixed_issues.minimum('start_date'), version.due_date, version.completed_pourcent, options[:zoom]) | |
|
439 | label = "#{h version } #{h version.completed_pourcent.to_i.to_s}%" | |
|
440 | label = h("#{version.project} -") + label unless @project && @project == version.project | |
|
441 | output = html_task(options[:top], coords, :css => "version task", :label => label, :markers => true) | |
|
449 | 442 | |
|
450 | i_late_date = [i_end_date, Date.today].min if start_date < Date.today | |
|
451 | ||
|
452 | i_width = (i_left - start_left + 1).floor - 2 # total width of the issue (- 2 for left and right borders) | |
|
453 | d_width = ((i_done_date - start_date)*options[:zoom]).floor - 2 # done width | |
|
454 | l_width = i_late_date ? ((i_late_date - start_date+1)*options[:zoom]).floor - 2 : 0 # delay width | |
|
455 | ||
|
456 | i_end = ((i_end_date - self.date_from) * options[:zoom]).floor # Ending pixel | |
|
457 | ||
|
458 | # Bar graphic | |
|
459 | ||
|
460 | # Make sure that negative i_left and i_width don't | |
|
461 | # overflow the subject | |
|
462 | if i_width > 0 && i_left <= options[:g_width] | |
|
463 | output << "<div style='top:#{ options[:top] }px;left:#{ start_left }px;width:#{ i_width }px;' class='task milestone_todo'> </div>" | |
|
464 | end | |
|
465 | if l_width > 0 && i_left <= options[:g_width] | |
|
466 | output << "<div style='top:#{ options[:top] }px;left:#{ start_left }px;width:#{ l_width }px;' class='task milestone_late'> </div>" | |
|
467 | end | |
|
468 | if d_width > 0 && i_left <= options[:g_width] | |
|
469 | output<< "<div style='top:#{ options[:top] }px;left:#{ start_left }px;width:#{ d_width }px;' class='task milestone_done'> </div>" | |
|
470 | end | |
|
471 | ||
|
472 | ||
|
473 | # Starting diamond | |
|
474 | if start_left <= options[:g_width] && start_left > 0 | |
|
475 | output << "<div style='top:#{ options[:top] }px;left:#{ start_left }px;width:15px;' class='task milestone starting'> </div>" | |
|
476 | output << "<div style='top:#{ options[:top] }px;left:#{ start_left + 12 }px;background:#fff;' class='task'>" | |
|
477 | output << "</div>" | |
|
478 | end | |
|
479 | ||
|
480 | # Ending diamond | |
|
481 | # Don't show items too far ahead | |
|
482 | if i_left <= options[:g_width] && i_end > 0 | |
|
483 | output << "<div style='top:#{ options[:top] }px;left:#{ i_end }px;width:15px;' class='task milestone ending'> </div>" | |
|
484 | end | |
|
485 | ||
|
486 | # Display the Version name and % | |
|
487 | if i_end <= options[:g_width] | |
|
488 | # Display the status even if it's floated off to the left | |
|
489 | status_px = i_end + 12 # 12px for the diamond | |
|
490 | status_px = 0 if status_px <= 0 | |
|
491 | ||
|
492 | output << "<div style='top:#{ options[:top] }px;left:#{ status_px }px;' class='task label version-name'>" | |
|
493 | output << h("#{version.project} -") unless @project && @project == version.project | |
|
494 | output << "<strong>#{h version } #{h version.completed_pourcent.to_i.to_s}%</strong>" | |
|
495 | output << "</div>" | |
|
496 | end | |
|
497 | 443 | @lines << output |
|
498 | 444 | output |
|
499 | 445 | when :image |
@@ -1017,6 +963,15 module Redmine | |||
|
1017 | 963 | output << "<div style='top:#{ top }px;left:#{ coords[:bar_start] }px;width:#{ coords[:bar_progress_end] - coords[:bar_start] - 2}px;' class='#{options[:css]} task_done'> </div>" |
|
1018 | 964 | end |
|
1019 | 965 | end |
|
966 | # Renders the markers | |
|
967 | if options[:markers] | |
|
968 | if coords[:start] | |
|
969 | output << "<div style='top:#{ top }px;left:#{ coords[:start] }px;width:15px;' class='#{options[:css]} marker starting'> </div>" | |
|
970 | end | |
|
971 | if coords[:end] | |
|
972 | output << "<div style='top:#{ top }px;left:#{ coords[:end] }px;width:15px;' class='#{options[:css]} marker ending'> </div>" | |
|
973 | end | |
|
974 | end | |
|
1020 | 975 | # Renders the label on the right |
|
1021 | 976 | if options[:label] |
|
1022 | 977 | output << "<div style='top:#{ top }px;left:#{ (coords[:bar_end] || 0) + 5 }px;' class='#{options[:css]} label'>" |
@@ -801,10 +801,11 background-image:url('../images/close_hl.png'); | |||
|
801 | 801 | .task_todo.parent .left { position: absolute; background: url(../images/task_parent_end.png) no-repeat 0 0; width: 8px; height: 16px; margin-left: -5px; left: 0px; top: -1px;} |
|
802 | 802 | .task_todo.parent .right { position: absolute; background: url(../images/task_parent_end.png) no-repeat 0 0; width: 8px; height: 16px; margin-right: -5px; right: 0px; top: -1px;} |
|
803 | 803 | |
|
804 | .milestone { background-image:url(../images/version_marker.png); background-repeat: no-repeat; border: 0; } | |
|
805 |
. |
|
|
806 |
. |
|
|
807 | .milestone_todo { background:#fff url(../images/milestone_todo.png); border: 1px solid #fff; height: 2px; margin-top: 3px;} | |
|
804 | .version.task_late { background:#f66 url(../images/milestone_late.png); border: 1px solid #f66; height: 2px; margin-top: 3px;} | |
|
805 | .version.task_done { background:#00c600 url(../images/milestone_done.png); border: 1px solid #00c600; height: 2px; margin-top: 3px;} | |
|
806 | .version.task_todo { background:#fff url(../images/milestone_todo.png); border: 1px solid #fff; height: 2px; margin-top: 3px;} | |
|
807 | .version.marker { background-image:url(../images/version_marker.png); background-repeat: no-repeat; border: 0; } | |
|
808 | ||
|
808 | 809 | .project-line { background-image:url(../images/project_marker.png); background-repeat: no-repeat; border: 0; } |
|
809 | 810 | .project_late { background:#f66 url(../images/milestone_late.png); border: 1px solid #f66; height: 2px; margin-top: 3px;} |
|
810 | 811 | .project_done { background:#00c600 url(../images/milestone_done.png); border: 1px solid #00c600; height: 2px; margin-top: 3px;} |
@@ -225,10 +225,10 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
225 | 225 | |
|
226 | 226 | context "version" do |
|
227 | 227 | should "be rendered" do |
|
228 |
assert_select "div. |
|
|
229 |
assert_select "div. |
|
|
230 |
assert_select "div. |
|
|
231 |
assert_select "div.label.version |
|
|
228 | assert_select "div.version.task_todo" | |
|
229 | assert_select "div.version.starting" | |
|
230 | assert_select "div.version.ending" | |
|
231 | assert_select "div.label.version", /#{@version.name}/ | |
|
232 | 232 | end |
|
233 | 233 | end |
|
234 | 234 | |
@@ -477,7 +477,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
477 | 477 | :tracker => @tracker, |
|
478 | 478 | :project => @project, |
|
479 | 479 | :done_ratio => 30, |
|
480 |
:start_date => |
|
|
480 | :start_date => 1.week.ago.to_date, | |
|
481 | 481 | :due_date => 1.week.from_now.to_date) |
|
482 | 482 | end |
|
483 | 483 | |
@@ -485,12 +485,12 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
485 | 485 | context "todo line" do |
|
486 | 486 | should "start from the starting point on the left" do |
|
487 | 487 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
488 |
assert_select "div. |
|
|
488 | assert_select "div.version.task_todo[style*=left:28px]", true, @response.body | |
|
489 | 489 | end |
|
490 | 490 | |
|
491 | 491 | should "be the total width of the version" do |
|
492 | 492 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
493 |
assert_select "div. |
|
|
493 | assert_select "div.version.task_todo[style*=width:58px]", true, @response.body | |
|
494 | 494 | end |
|
495 | 495 | |
|
496 | 496 | end |
@@ -498,24 +498,24 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
498 | 498 | context "late line" do |
|
499 | 499 | should "start from the starting point on the left" do |
|
500 | 500 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
501 |
assert_select "div. |
|
|
501 | assert_select "div.version.task_late[style*=left:28px]", true, @response.body | |
|
502 | 502 | end |
|
503 | 503 | |
|
504 | 504 | should "be the total delayed width of the version" do |
|
505 | 505 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
506 |
assert_select "div. |
|
|
506 | assert_select "div.version.task_late[style*=width:30px]", true, @response.body | |
|
507 | 507 | end |
|
508 | 508 | end |
|
509 | 509 | |
|
510 | 510 | context "done line" do |
|
511 | 511 | should "start from the starting point on the left" do |
|
512 | 512 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
513 |
assert_select "div. |
|
|
513 | assert_select "div.version.task_done[style*=left:28px]", true, @response.body | |
|
514 | 514 | end |
|
515 | 515 | |
|
516 | 516 | should "Be the total done width of the version" do |
|
517 | 517 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
518 |
assert_select "div. |
|
|
518 | assert_select "div.version.task_done[style*=width:18px]", true, @response.body | |
|
519 | 519 | end |
|
520 | 520 | end |
|
521 | 521 | |
@@ -525,12 +525,12 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
525 | 525 | @gantt.instance_variable_set('@date_from', Date.today) |
|
526 | 526 | |
|
527 | 527 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
528 |
assert_select "div. |
|
|
528 | assert_select "div.version.starting", false | |
|
529 | 529 | end |
|
530 | 530 | |
|
531 | 531 | should "appear at the starting point" do |
|
532 | 532 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
533 |
assert_select "div. |
|
|
533 | assert_select "div.version.starting[style*=left:28px]", true, @response.body | |
|
534 | 534 | end |
|
535 | 535 | end |
|
536 | 536 | |
@@ -540,13 +540,13 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
540 | 540 | @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) |
|
541 | 541 | |
|
542 | 542 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
543 |
assert_select "div. |
|
|
543 | assert_select "div.version.ending", false | |
|
544 | 544 | |
|
545 | 545 | end |
|
546 | 546 | |
|
547 | 547 | should "appear at the end of the date range" do |
|
548 | 548 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
549 |
assert_select "div. |
|
|
549 | assert_select "div.version.ending[style*=left:84px]", true, @response.body | |
|
550 | 550 | end |
|
551 | 551 | end |
|
552 | 552 | |
@@ -555,17 +555,17 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
555 | 555 | @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) |
|
556 | 556 | |
|
557 | 557 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
558 |
assert_select "div.version |
|
|
558 | assert_select "div.version.label", /#{@version.name}/ | |
|
559 | 559 | end |
|
560 | 560 | |
|
561 | 561 | should "show the version name" do |
|
562 | 562 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
563 |
assert_select "div.version |
|
|
563 | assert_select "div.version.label", /#{@version.name}/ | |
|
564 | 564 | end |
|
565 | 565 | |
|
566 | 566 | should "show the percent complete" do |
|
567 | 567 | @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) |
|
568 |
assert_select "div.version |
|
|
568 | assert_select "div.version.label", /30%/ | |
|
569 | 569 | end |
|
570 | 570 | end |
|
571 | 571 | end |
General Comments 0
You need to be logged in to leave comments.
Login now