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:
@@ -31,9 +31,15 @@ class DeliverablesController < ApplicationController
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
respond_to do |format|
|
||||
if @deliverable.save
|
||||
@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 class="splitcontentright">
|
||||
<%# TODO: Need to update subtotals with observers %>
|
||||
<p>TODO: Fixed cost</p>
|
||||
<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>
|
||||
<%= observe_field('deliverable_cost_per_hour', :function => "new Budget.updateAmounts();") %>
|
||||
|
||||
Reference in New Issue
Block a user