NAK - Not work for me. The image are always in 800x600. I don't know why.
--
Benjamin LAN-SUN-LUK
Le 13/11/08 01:52, « Darryl L. Pierce » <mcpierce(a)gmail.com> a écrit :
Added three report graphic sizes (800x600, 1024x768 and 1280x1024)
and a dropdown to the sprint view page to select the size.
Signed-off-by: Darryl L. Pierce <mcpierce(a)gmail.com>
---
app/controllers/report_controller.rb | 28 ++++++++++++++++++++++++++--
app/views/report/burndown.html.erb | 5 +++--
app/views/sprints/show.html.erb | 5 +++++
test/functional/report_controller_test.rb | 2 +-
4 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/app/controllers/report_controller.rb b/app/controllers/report_controller.rb
index 6993fd6..411518e 100644
--- a/app/controllers/report_controller.rb
+++ b/app/controllers/report_controller.rb
@@ -20,6 +20,17 @@
class ReportController < ApplicationController
before_filter :load_sprint, :except => [:index, :effort]
before_filter :load_user, :only => [:effort]
+ before_filter :load_size, :only => [:burndown]
+
+ SIZE_SMALL = "800x600"
+ SIZE_MEDIUM = "1024x768"
+ SIZE_LARGE = "1280x1024"
+
+ REPORT_SIZES = {
+ SIZE_SMALL => 0,
+ SIZE_MEDIUM => 1,
+ SIZE_LARGE => 2
+ }.sort_by { |k,v| v }
def index
@title = "Reports"
@@ -28,6 +39,7 @@ class ReportController < ApplicationController
def burndown
@title = "Burndown Chart For Sprint #{(a)sprint.id}"
+ @size = params[:size]
end
def effort
@@ -47,8 +59,8 @@ class ReportController < ApplicationController
if @sprint.can_view_burndown?
@data = @sprint.burndown_data
- g = Gruff::Line.new('800x600')
- g.title = "Burndown Chart For '#{(a)sprint.title}'"
+ g = Gruff::Line.new(@size)
+ g.title = "#{(a)sprint.title}"
g.font = File.expand_path('Courier.ttf', RAILS_ROOT)
g.data("Remaining hours", @data)
@@ -83,4 +95,16 @@ class ReportController < ApplicationController
redirect_to error_url
end
end
+
+ def load_size
+ size = params[:size]
+ if size
+ size = size.to_i
+ if (0...REPORT_SIZES.size).include? params[:size].to_i
+ @size = REPORT_SIZES[size.to_i][0]
+ end
+ end
+
+ @size = REPORT_SIZES[0][0] unless @size
+ end
end
diff --git a/app/views/report/burndown.html.erb b/app/views/report/burndown.html.erb
index b5fa23f..5c788ad 100644
--- a/app/views/report/burndown.html.erb
+++ b/app/views/report/burndown.html.erb
@@ -1,3 +1,4 @@
-<img src="<%= url_for :action => :burndown_graphic, :id => @sprint.id
%>"
+<img src="<%= url_for :action => :burndown_graphic, :id => @sprint.id,
+ :size => @size%>"
alt="Burndown"
- align="center" />
\ No newline at end of file
+ align="center" />
diff --git a/app/views/sprints/show.html.erb b/app/views/sprints/show.html.erb
index df475c5..46482c8 100644
--- a/app/views/sprints/show.html.erb
+++ b/app/views/sprints/show.html.erb
@@ -21,6 +21,11 @@
image_tag("icons/sprint_plan.png", :alt => "Plan this
sprint"),
plan_product_sprint_path(@product, @sprint)) %>
<% end %>
+ <% if @sprint.can_view_burndown? %>
+ <%= form_tag(:controller => :report, :action => :burndown, :id =>
@sprint.id) %>
+ <%= select_tag :size, options_for_select(ReportController::REPORT_SIZES)
%>
+ <%= submit_tag "Burndown" %>
+ <% end %>
</td>
</tr>
diff --git a/test/functional/report_controller_test.rb
b/test/functional/report_controller_test.rb
index 4a0a64a..3948d8f 100644
--- a/test/functional/report_controller_test.rb
+++ b/test/functional/report_controller_test.rb
@@ -46,7 +46,7 @@ class ReportControllerTest < ActionController::TestCase
# Ensures that a burndown chart works as expected.
#
def test_burndown_graphic
- get :burndown_graphic, {:id => @sprint.id}
+ get :burndown_graphic, {:id => @sprint.id, :size => 0}
assert_response :success
assert assigns['data'], "Didn't generate the data needed for a
report."
--
1.6.0.2
_______________________________________________
projxp-devel mailing list
projxp-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/projxp-devel