Building up the JavaScript details. #1190

This commit is contained in:
Eric Davis
2008-05-28 16:14:55 -07:00
parent e96bdccb42
commit eba994a686
6 changed files with 62 additions and 1 deletions
+6
View File
@@ -9,4 +9,10 @@ module DeliverablesHelper
)
) + observe_field('deliverable_' + field.to_s, :function => "new Budget.updateAmounts();")
end
def paragraph_with_data(label, data)
content_tag(:p,
content_tag(:span, label) +
h(data))
end
end
+21
View File
@@ -75,4 +75,25 @@ class Deliverable < ActiveRecord::Base
write_attribute(:profit, v.gsub(/[$, ]/,''))
end
end
def budget_remaining
return self.budget - self.spent
end
def hours_used
0
end
def left
return self.budget - self.spent
end
def overruns
if self.left >= 0
return 0
else
return self.left * -1
end
end
end
+6
View File
@@ -16,5 +16,11 @@ class HourlyDeliverable < Deliverable
return total
end
def hours_used
return 0 unless self.issues.size > 0
return self.issues.collect(&:time_entries).flatten.collect(&:hours).sum
end
end
+25 -1
View File
@@ -1,4 +1,5 @@
<tr id="deliverable-<%= deliverable.id %>" class="deliverable <%= cycle('odd', 'even') %>">
<% css = cycle('odd','even') %>
<tr id="deliverable-<%= deliverable.id %>" class="deliverable <%= css %>">
<%= content_tag(:td, deliverable.id) %>
<%= content_tag(:td, deliverable.score) %>
<%= content_tag(:td, deliverable.subject) %>
@@ -6,4 +7,27 @@
<%= content_tag(:td, number_to_currency(deliverable.spent)) %>
<%= content_tag(:td, format_date(deliverable.due_date)) %>
<%= content_tag(:td, progress_bar(deliverable.progress, :width => '100%')) %>
<%= content_tag(:td, link_to_function("Details", "$('deliverable-details-#{deliverable.id}').toggle();")) %>
</tr>
<tr id="deliverable-details-<%= deliverable.id %>" class="deliverable deliverable-details <%= css %>" style="display:none;">
<%# TODO: link to issues %>
<%# TODO: link to edit %>
<%= content_tag(
:td,
"<dl>" +
paragraph_with_data("Deliverable Budget: ", number_to_currency(deliverable.budget)) +
paragraph_with_data("Budget Spent: ", number_to_currency(deliverable.spent)) +
paragraph_with_data("Budget Remaining: ", number_to_currency(deliverable.budget_remaining)) +
paragraph_with_data("Hours Used: ", deliverable.hours_used) +
paragraph_with_data("Hours Estimated: ", deliverable.total_hours) +
paragraph_with_data("Progress: ", deliverable.progress) +
paragraph_with_data("Score ", deliverable.score) +
paragraph_with_data("Overruns ", number_to_currency(deliverable.overruns)) +
paragraph_with_data("TODO: Overall project %", nil) +
paragraph_with_data("Profit: ", number_to_currency(deliverable.profit)) +
"</dl>",
:colspan => 4) %>
<%= content_tag(
:td, "TODO", :colspan => 4) %>
</tr>
+1
View File
@@ -9,6 +9,7 @@
<%= content_tag('th', "Spent") %>
<%= sort_header_tag("#{Deliverable.table_name}.due_date", :caption => 'Due') %>
<%= content_tag('th', "Progress") %>
<%= content_tag('th', "Actions") %>
</tr></thead>
<tbody>
<% deliverables.each do |deliverable| -%>
+3
View File
@@ -7,6 +7,9 @@ tr.deliverable td.subject, tr.deliverable td.category { white-space: normal; }
tr.deliverable td.subject { text-align: left; }
tr.deliverable td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
tr.deliverable-details p { text-align:left; }
tr.deliverable-details span { font-weight:bold; }
#deliverable-form .splitcontentleft { width: 62% }
#deliverable-form .splitcontentright { width: 37% }
#deliverable-form .splitcontentright p { padding-right: 30px; }