More form cleanup. #1274

This commit is contained in:
Eric Davis
2008-06-12 15:04:01 -07:00
parent 8a69714981
commit 52d6687f52
3 changed files with 17 additions and 7 deletions
+8 -2
View File
@@ -4,14 +4,16 @@ module DeliverablesHelper
# a Deliverable
def field_with_budget_observer_and_totals(form, field)
content_tag(:tr,
content_tag(:td, "<label for='deliverable_#{field}'>TODO</label>") +
content_tag(:td, "<label for='deliverable_#{field.to_s}'>#{l_field(field, 'field_')}</label>") +
content_tag(:td, text_field(:deliverable, field, :size => 7)) +
content_tag(:td,
content_tag(:span,
0,
:class => "budget-calculation",
:id => field.to_s + '_subtotal'
) + observe_field('deliverable_' + field.to_s, :function => "new Budget.updateAmounts();")))
) + observe_field('deliverable_' + field.to_s, :function => "new Budget.updateAmounts();"),
:class => "calculation-column"
))
end
@@ -37,4 +39,8 @@ module DeliverablesHelper
def allowed_management?
return User.current.allowed_to?(:manage_budget, @project)
end
def l_field(field, prefix='')
l((prefix + field.to_s).to_sym)
end
end
+6 -4
View File
@@ -24,7 +24,7 @@
<%= check_box(:deliverable, :type, {}, FixedDeliverable.name, HourlyDeliverable.name) %>
<%= observe_field('deliverable_type', :function => "new Budget.changeType();") %>
</td>
<td>
<td class="calculation-column">
</td>
</tr>
@@ -48,7 +48,7 @@
<%= text_field :deliverable, :total_hours, :size => 7 %>
<%= observe_field('deliverable_total_hours', :function => "new Budget.updateAmounts();") %>
</td>
<td>
<td class="calculation-column">
<%= content_tag(:span, 0, :class => "budget-calculation", :id => 'variableCost') %>
</td>
</tr>
@@ -61,7 +61,7 @@
<%= text_field :deliverable, :fixed_cost, :size => 7 %>
<%= observe_field('deliverable_fixed_cost', :function => "new Budget.updateAmounts();") %>
</td>
<td>
<td class="calculation-column">
<%= content_tag(:span, 0, :class => "budget-calculation", :id => 'fixedCost') %>
</td>
</tr>
@@ -73,7 +73,9 @@
<tr class="total-budget">
<td><label>Total Budget:</label></td>
<td></td>
<td><%= content_tag(:span, 0, :id => 'total-budget-calculation', :class => "budget-calculation") %></td>
<td class="calculation-column">
<%= content_tag(:span, 0, :id => 'total-budget-calculation', :class => "budget-calculation") %>
</td>
</tr>
</table>
+3 -1
View File
@@ -33,7 +33,9 @@ tr.deliverable-details div { text-align:left; }
#deliverable-form .splitcontentright p { padding-right: 30px; }
#deliverable-form .splitcontentright input { float:left }
span.budget-calculation { color:#999999; font-weight:bold; display:block; text-align:right; width: 100%;}
td.calculation-column { text-align:right; width: auto; }
.budget-calculation { color:#999999; font-weight:bold; display:block; text-align:right; width: 100%;}
p.total-budget { font-weight: bold; }
p.total-budget #total-budget-calculation { }