Added support for STI deliverables
* HourlyDeliverables cost are based on the time used * FixedDeliverables are based on a flat rate * Added a checkbox on the new Deliverable form to pick which one to use #1135
This commit is contained in:
1 parent
bd5bb6d1c5
commit
8548d46637
4 files changed
+18
-4
No files matched your search
@@ -31,9 +31,15 @@ class DeliverablesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@deliverable = Deliverable.new(params[:deliverable])
|
if params[:deliverable][:type] == FixedDeliverable.name
|
||||||
|
@deliverable = FixedDeliverable.new(params[:deliverable])
|
||||||
|
elsif params[:deliverable][:type] == HourlyDeliverable.name
|
||||||
|
@deliverable = HourlyDeliverable.new(params[:deliverable])
|
||||||
|
else
|
||||||
|
@deliverable = Deliverable.new(params[:deliverable])
|
||||||
|
end
|
||||||
|
|
||||||
@deliverable.project = @project
|
@deliverable.project = @project
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @deliverable.save
|
if @deliverable.save
|
||||||
@flash = l(:notice_successful_create)
|
@flash = l(:notice_successful_create)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
class FixedDeliverable < Deliverable
|
||||||
|
unloadable
|
||||||
|
end
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
class HourlyDeliverable < Deliverable
|
||||||
|
unloadable
|
||||||
|
end
|
||||||
@@ -17,8 +17,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="splitcontentright">
|
<div class="splitcontentright">
|
||||||
<%# TODO: Need to update subtotals with observers %>
|
<p>
|
||||||
<p>TODO: Fixed cost</p>
|
<label for="deliverable_type">Fixed Cost</label>
|
||||||
|
<%= check_box(:deliverable, :type, {}, FixedDeliverable.name, HourlyDeliverable.name) %>
|
||||||
|
</p>
|
||||||
|
|
||||||
<p><%= f.text_field :cost_per_hour, :size => 7 %></p>
|
<p><%= f.text_field :cost_per_hour, :size => 7 %></p>
|
||||||
<%= observe_field('deliverable_cost_per_hour', :function => "new Budget.updateAmounts();") %>
|
<%= observe_field('deliverable_cost_per_hour', :function => "new Budget.updateAmounts();") %>
|
||||||
|
|||||||
Reference in new issue
Block a user