Skip to content
Browse files

Add milestone widget to top of burndown

  • Loading branch information...
1 parent beb7707 commit df8e8d7a16f9f2b882c3fcad35b29059e6c21176 @kneath committed May 3, 2009
Showing with 64 additions and 0 deletions.
  1. +5 −0 lib/burndown/milestone.rb
  2. +46 −0 public/css/master.css
  3. +13 −0 views/timeline.erb
View
5 lib/burndown/milestone.rb
@@ -34,6 +34,11 @@ def active?
return false
end
+ def percent_complete
+ return "N/A" if tickets_count <= 0;
+ ((tickets_count - open_tickets_count).to_f/tickets_count.to_f*100).to_i
+ end
+
# Queries the API for each milestone (yikes!). Hope you don't have too many.
def self.sync_with_lighthouse
Milestone.all.each do |milestone|
View
46 public/css/master.css
@@ -486,4 +486,50 @@ ul.form-actions button{
color:#990000;
}
+/* @end */
+
+/*------------------------------------------------------------------------------------
+ @group Progress Widget
+------------------------------------------------------------------------------------*/
+
+.progress{
+ margin:20px 0;
+}
+
+.progress ul.stats{
+ margin:0 0 10px 0;
+ height:50px;
+}
+.progress ul.stats li{
+ list-style-type:none;
+ margin:0;
+ float:left;
+ width:266px;
+ height:50px;
+ text-align:center;
+ border-left:1px solid #ddd;
+}
+.progress ul.stats li:first-child{
+ border-left:none;
+}
+.progress ul.stats strong{
+ display:block;
+ font-size:30px;
+ color:#999;
+}
+.progress ul.stats span{
+ color:#666;
+}
+
+.progress-bar{
+ height:25px;
+ background:#f1f1f1;
+ border:2px solid #eee;
+}
+.progress-bar .bar{
+ display:block;
+ height:25px;
+ background:#009936;
+}
+
/* @end */
View
13 views/timeline.erb
@@ -1,6 +1,19 @@
<% page_info :title => "Timeline &amp; Graph",
:breadcrumb => [ link_to(h(@milestone.project.name), "/"), link_to(h(@milestone.name), "/project/#{@milestone.project.id}") ] %>
+<% if @milestone.tickets_count > 0 %>
+<div class="progress">
+ <ul class="stats">
+ <li><strong><%= @milestone.percent_complete %>%</strong> <span>percent complete</span></li>
+ <li><strong><%= @milestone.open_tickets_count %></strong> <span>open tickets</span></li>
+ <li><strong><%= @milestone.due_on ? @milestone.due_on.strftime("%m/%d") : "Not Due" %></strong> <span>due date</span></li>
+ </ul>
+ <div class="progress-bar">
+ <span class="bar" style="width:<%= @milestone.percent_complete %>%"></span>
+ </div>
+</div>
+<% end %>
+
<div class="graph">
<table class="timeline">
<tfoot>

0 comments on commit df8e8d7

Please sign in to comment.
Something went wrong with that request. Please try again.