Converted side form to a table. #1274
This commit is contained in:
1 parent
739d9f7a83
commit
8a69714981
3 files changed
+69
-31
No files matched your search
@@ -3,14 +3,16 @@ module DeliverablesHelper
|
|||||||
# Helper to generate a form used to calculate the total budget while editing
|
# Helper to generate a form used to calculate the total budget while editing
|
||||||
# a Deliverable
|
# a Deliverable
|
||||||
def field_with_budget_observer_and_totals(form, field)
|
def field_with_budget_observer_and_totals(form, field)
|
||||||
content_tag(:p,
|
content_tag(:tr,
|
||||||
form.text_field(field, :size => 7) +
|
content_tag(:td, "<label for='deliverable_#{field}'>TODO</label>") +
|
||||||
content_tag(:span,
|
content_tag(:td, text_field(:deliverable, field, :size => 7)) +
|
||||||
0,
|
content_tag(:td,
|
||||||
:class => "budget-calculation",
|
content_tag(:span,
|
||||||
:id => field.to_s + '_subtotal'
|
0,
|
||||||
)
|
:class => "budget-calculation",
|
||||||
) + observe_field('deliverable_' + field.to_s, :function => "new Budget.updateAmounts();")
|
:id => field.to_s + '_subtotal'
|
||||||
|
) + observe_field('deliverable_' + field.to_s, :function => "new Budget.updateAmounts();")))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Helper to generate a consistant HTML format for displaying basic data
|
# Helper to generate a consistant HTML format for displaying basic data
|
||||||
|
|||||||
@@ -14,36 +14,70 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="splitcontentright">
|
<div class="splitcontentright">
|
||||||
<p>
|
<table>
|
||||||
<label for="deliverable_type">Fixed Cost</label>
|
|
||||||
<%= check_box(:deliverable, :type, {}, FixedDeliverable.name, HourlyDeliverable.name) %>
|
|
||||||
</p>
|
|
||||||
<%= observe_field('deliverable_type', :function => "new Budget.changeType();") %>
|
|
||||||
|
|
||||||
<p class="budget-hourly"><%= f.text_field :cost_per_hour, :size => 7 %></p>
|
<tr>
|
||||||
<%= observe_field('deliverable_cost_per_hour', :function => "new Budget.updateAmounts();") %>
|
<td>
|
||||||
|
<label for="deliverable_type">Fixed Cost</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= check_box(:deliverable, :type, {}, FixedDeliverable.name, HourlyDeliverable.name) %>
|
||||||
|
<%= observe_field('deliverable_type', :function => "new Budget.changeType();") %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<p class="budget-hourly">
|
<tr class="budget-hourly">
|
||||||
<%= f.text_field :total_hours, :size => 7 %>
|
<td>
|
||||||
<%= content_tag(:span, 0, :class => "budget-calculation", :id => 'variableCost') %>
|
<label for="deliverable_cost_per_hour">Cost per hour</label>
|
||||||
</p>
|
</td>
|
||||||
<%= observe_field('deliverable_total_hours', :function => "new Budget.updateAmounts();") %>
|
<td>
|
||||||
|
<%= text_field :deliverable, :cost_per_hour, :size => 7 %>
|
||||||
|
<%= observe_field('deliverable_cost_per_hour', :function => "new Budget.updateAmounts();") %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<p class="budget-fixed" style="display:none;">
|
<tr class="budget-hourly">
|
||||||
<%= f.text_field :fixed_cost, :size => 7 %>
|
<td>
|
||||||
<%= content_tag(:span, 0, :class => "budget-calculation", :id => 'fixedCost') %>
|
<label for="deliverable_total_hours">Total Hours</label>
|
||||||
</p>
|
</td>
|
||||||
<%= observe_field('deliverable_fixed_cost', :function => "new Budget.updateAmounts();") %>
|
<td>
|
||||||
|
<%= text_field :deliverable, :total_hours, :size => 7 %>
|
||||||
|
<%= observe_field('deliverable_total_hours', :function => "new Budget.updateAmounts();") %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= content_tag(:span, 0, :class => "budget-calculation", :id => 'variableCost') %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<%= field_with_budget_observer_and_totals(f, :overhead) %>
|
<tr class="budget-fixed" style="display:none;">
|
||||||
<%= field_with_budget_observer_and_totals(f, :materials) %>
|
<td>
|
||||||
<%= field_with_budget_observer_and_totals(f, :profit) %>
|
<label for="deliverable_fixed_cost">Fixed Bid</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= text_field :deliverable, :fixed_cost, :size => 7 %>
|
||||||
|
<%= observe_field('deliverable_fixed_cost', :function => "new Budget.updateAmounts();") %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= content_tag(:span, 0, :class => "budget-calculation", :id => 'fixedCost') %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<%= content_tag(:p,"Total Budget:" + content_tag(:span, 0, :id => 'total-budget-calculation', :class => "budget-calculation"),
|
<%= field_with_budget_observer_and_totals(f, :overhead) %>
|
||||||
:class => "total-budget") %>
|
<%= field_with_budget_observer_and_totals(f, :materials) %>
|
||||||
|
<%= field_with_budget_observer_and_totals(f, :profit) %>
|
||||||
|
|
||||||
<p><%= f.hidden_field :budget %></p>
|
<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>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<%= f.hidden_field :budget %>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">new Budget.changeType();</script>
|
<script type="text/javascript">new Budget.changeType();</script>
|
||||||
<script type="text/javascript">new Budget.updateAmounts();</script>
|
<script type="text/javascript">new Budget.updateAmounts();</script>
|
||||||
|
|||||||
@@ -37,4 +37,6 @@ span.budget-calculation { color:#999999; font-weight:bold; display:block; text-a
|
|||||||
p.total-budget { font-weight: bold; }
|
p.total-budget { font-weight: bold; }
|
||||||
p.total-budget #total-budget-calculation { }
|
p.total-budget #total-budget-calculation { }
|
||||||
|
|
||||||
|
/* Rest some defaults */
|
||||||
.jstElements button { padding: 0; margin-right: 0px;}
|
.jstElements button { padding: 0; margin-right: 0px;}
|
||||||
|
.tabular label { margin-left: 0; float: none;}
|
||||||
Reference in new issue
Block a user