From 82d388f6d032f3e6e4c94ac401d798ba18e97584 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Tue, 17 May 2011 12:26:35 +0200 Subject: [PATCH] feature: limiting the amount of sub issues displayed on a story cards by the available size * if more sub issues exist than space is available the amount of omitted issues are noted --- config/locales/de.yml | 1 + config/locales/en.yml | 1 + lib/taskboard_card/bottom_attributes.rb | 22 ++++++++++++++++------ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index 091e449d35..aabd7721bd 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -118,6 +118,7 @@ de: story_points_ideal: "Story Points (ideal)" task: "Aufgabe" unassigned: "Nicht zugewiesen" + x_more: "%{count} mehr..." project_module_backlogs: "Backlogs (Beta)" diff --git a/config/locales/en.yml b/config/locales/en.yml index 81d0f31365..28e5f0d351 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -118,6 +118,7 @@ en: story_points_ideal: "Story Points (ideal)" task: "Task" unassigned: "Unassigned" + x_more: "%{count} more..." project_module_backlogs: "Backlogs (Beta)" diff --git a/lib/taskboard_card/bottom_attributes.rb b/lib/taskboard_card/bottom_attributes.rb index 0b7aecb4b4..73590baaf3 100644 --- a/lib/taskboard_card/bottom_attributes.rb +++ b/lib/taskboard_card/bottom_attributes.rb @@ -65,12 +65,22 @@ module TaskboardCard {:height => pdf.font.height, :at => offset}) - issue.children.each do |child| - offset = text_box(pdf, - "#{child.tracker.name} ##{child.id} #{child.subject}", - {:width => pdf.bounds.width, - :height => pdf.font.height, - :at => offset}) + issue.children.each_with_index do |child, i| + subtask_text = "#{child.tracker.name} ##{child.id}: #{child.subject}" + offset[0] = 10 #indentation + + if offset[1] - pdf.font.height < pdf.font.height && issue.children.size - i != 1 + offset = text_box(pdf, + l('backlogs.x_more', :count => issue.children.size - i), + :height => pdf.font.height, + :at => offset) + break + else + offset = text_box(pdf, + "#{child.tracker.name} ##{child.id}: #{child.subject}", + {:height => pdf.font.height, + :at => offset}) + end end end