[#4180] Add Hourly Deliverables.
This commit is contained in:
1 parent
5b098a43e5
commit
498b7b633d
6 files changed
+100
-15
No files matched your search
@@ -12,13 +12,16 @@ class DeliverablesController < InheritedResources::Base
|
||||
|
||||
def create
|
||||
@deliverable = begin_of_association_chain.deliverables.build(params[:deliverable])
|
||||
@deliverable.type = 'FixedDeliverable'
|
||||
if params[:deliverable] && params[:deliverable][:type] && ['FixedDeliverable','HourlyDeliverable'].include?(params[:deliverable][:type])
|
||||
@deliverable.type = params[:deliverable][:type]
|
||||
end
|
||||
create! { contract_url(@project, @contract) }
|
||||
end
|
||||
|
||||
def update
|
||||
@deliverable = begin_of_association_chain.deliverables.find_by_id(params[:id])
|
||||
@deliverable.attributes = params[:fixed_deliverable] # TODO: hardcoded
|
||||
params[:deliverable] = params[:fixed_deliverable] || params[:hourly_deliverable]
|
||||
@deliverable.attributes = params[:deliverable]
|
||||
update! { contract_url(@project, @contract) }
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class HourlyDeliverable < Deliverable
|
||||
unloadable
|
||||
|
||||
# Associations
|
||||
|
||||
# Validations
|
||||
|
||||
# Accessors
|
||||
|
||||
def short_type
|
||||
'H'
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
<% form.inputs do %>
|
||||
<%= form.input :title, :required => true %>
|
||||
<%= form.input :type, :required => true, :as => :select, :collection => [["Fixed", "FixedDeliverable"]] %>
|
||||
<%= form.input :type, :required => true, :as => :select, :collection => [["Fixed", "FixedDeliverable"],["Hourly", "HourlyDeliverable"]] %>
|
||||
<%= form.input :manager, :required => true, :collection => @project.users %>
|
||||
<%= form.input :start_date, :as => :string, :input_html => {:size => 10}, :hint => calendar_for('deliverable_start_date') %>
|
||||
<%= form.input :end_date, :as => :string, :input_html => {:size => 10}, :hint => calendar_for('deliverable_end_date') %>
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
<% unless resource.new_record? %>
|
||||
<li class="boolean optional">
|
||||
<%= label('deliverable', 'feature_sign_off') %>
|
||||
<%= check_box 'deliverable', 'feature_sign_off' %>
|
||||
<%= label(resource.class.to_s.underscore, 'feature_sign_off') %>
|
||||
<%= check_box resource.class.to_s.underscore, 'feature_sign_off' %>
|
||||
</li>
|
||||
<li class="boolean optional">
|
||||
<%= label('deliverable', 'warranty_sign_off') %>
|
||||
<%= check_box 'deliverable', 'warranty_sign_off' %>
|
||||
<%= label(resource.class.to_s.underscore, 'warranty_sign_off') %>
|
||||
<%= check_box resource.class.to_s.underscore, 'warranty_sign_off' %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in new issue
Block a user