[#4181] Added the New/Create actions for a Deliverable.
This commit is contained in:
@@ -2,4 +2,26 @@ class DeliverablesController < InheritedResources::Base
|
||||
unloadable
|
||||
|
||||
respond_to :html
|
||||
|
||||
before_filter :find_contract
|
||||
before_filter :authorize
|
||||
|
||||
def create
|
||||
@deliverable = FixedDeliverable.new(params[:deliverable])
|
||||
create! { contract_url(@project, @contract) }
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def begin_of_association_chain
|
||||
@contract
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_contract
|
||||
@contract = Contract.find(params[:contract_id])
|
||||
@project = @contract.project
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class FixedDeliverable < Deliverable
|
||||
unloadable
|
||||
|
||||
# Associations
|
||||
|
||||
# Validations
|
||||
|
||||
# Accessors
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
<% form.inputs do %>
|
||||
<%= form.input :title, :required => true %>
|
||||
<%= form.input :type, :required => true, :as => :select, :collection => [["Fixed", "fixed"]] %>
|
||||
<%= form.input :manager %>
|
||||
<%= 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') %>
|
||||
<%= form.input :notes, :input_html => {:class => 'wiki-edit', :rows => '5'} %>
|
||||
<% end %>
|
||||
<% form.buttons do %>
|
||||
<%= form.commit_button %>
|
||||
<%= link_to(l(:button_cancel), cancel_path) %>
|
||||
<% end %>
|
||||
|
||||
<%= wikitoolbar_for 'deliverable_notes' %>
|
||||
@@ -1 +1,9 @@
|
||||
<%= content_tag(:h2, l(:text_new_deliverable)) %>
|
||||
|
||||
<% semantic_form_for [@project, @contract, resource], :url => contract_deliverables_path(@project, @contract), :html => {:class => 'tabular'} do |form| %>
|
||||
<%= render :partial => 'form', :object => form, :locals => {:cancel_path => contract_path(@project, @contract)} %>
|
||||
<% end %>
|
||||
|
||||
<% content_for(:header_tags) do %>
|
||||
<%= stylesheet_link_tag "redmine_contracts", :plugin => "redmine_contracts", :media => "screen" %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user