[#4177] Refactored new Contract form to be used with editing a contract.
This commit is contained in:
1 parent
5bdbf4e75f
commit
c6783f98fd
8 files changed
+82
-29
No files matched your search
@@ -9,7 +9,11 @@ class ContractsController < InheritedResources::Base
|
||||
def create
|
||||
create! { contract_url(@project, resource) }
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
update! { contract_url(@project, resource) }
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def begin_of_association_chain
|
||||
|
||||
@@ -38,7 +38,7 @@ class Contract < ActiveRecord::Base
|
||||
|
||||
def payment_terms_for_select
|
||||
PaymentTerms.collect {|value, label|
|
||||
[l(label), value]
|
||||
[l(label), value.to_s]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<% form.inputs do %>
|
||||
<%= form.input :name, :required => true %>
|
||||
<%= form.input :account_executive, :required => true %>
|
||||
<li class="boolean optional">
|
||||
<%= label('contract', 'executed') %>
|
||||
<%= check_box 'contract', 'executed' %>
|
||||
</li>
|
||||
<%= form.input :start_date, :required => true, :as => :string, :input_html => {:size => 10}, :hint => calendar_for('contract_start_date') %>
|
||||
<%= form.input :end_date, :required => true, :as => :string, :input_html => {:size => 10}, :hint => calendar_for('contract_end_date') %>
|
||||
<%= form.input :billable_rate, :input_html => {:size => 20}, :hint => l(:field_billable_rate_hint) %>
|
||||
<%= form.input :discount, :input_html => {:size => 20}, :hint => l(:field_discount_hint) %>
|
||||
<%= form.input :discount_note, :input_html => {:class => 'wiki-edit', :rows => '5'} %>
|
||||
<%= form.input :payment_terms, :as => :select, :collection => resource.payment_terms_for_select %>
|
||||
<%= form.input :client_ap_contact_information, :input_html => {:class => 'wiki-edit', :rows => '5'} %>
|
||||
<%= form.input :po_number %>
|
||||
<%= form.input :details, :input_html => {:class => 'wiki-edit'} %>
|
||||
<% end %>
|
||||
<% form.buttons do %>
|
||||
<%= form.commit_button %>
|
||||
<%= link_to(l(:button_cancel), contracts_path) %>
|
||||
<% end %>
|
||||
|
||||
<%= wikitoolbar_for 'contract_discount_note' %>
|
||||
<%= wikitoolbar_for 'contract_client_ap_contact_information' %>
|
||||
<%= wikitoolbar_for 'contract_details' %>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<%= content_tag(:h2, h(resource.name)) %>
|
||||
|
||||
<% semantic_form_for resource, :url => contract_path(@project, resource), :html => {:class => 'tabular'} do |form| %>
|
||||
<%= render :partial => 'form', :object => form %>
|
||||
<% end %>
|
||||
|
||||
<% content_for(:header_tags) do %>
|
||||
<%= stylesheet_link_tag "redmine_contracts", :plugin => "redmine_contracts", :media => "screen" %>
|
||||
<% end %>
|
||||
@@ -1,33 +1,8 @@
|
||||
<%= content_tag(:h2, l(:text_new_contract)) %>
|
||||
|
||||
<% semantic_form_for resource, :html => {:class => 'tabular'} do |form| %>
|
||||
<% form.inputs do %>
|
||||
<%= form.input :name, :required => true %>
|
||||
<%= form.input :account_executive, :required => true %>
|
||||
<li class="boolean optional">
|
||||
<%= label('contract', 'executed') %>
|
||||
<%= check_box 'contract', 'executed' %>
|
||||
</li>
|
||||
<%= form.input :start_date, :required => true, :as => :string, :input_html => {:size => 10}, :hint => calendar_for('contract_start_date') %>
|
||||
<%= form.input :end_date, :required => true, :as => :string, :input_html => {:size => 10}, :hint => calendar_for('contract_end_date') %>
|
||||
<%= form.input :billable_rate, :input_html => {:size => 20}, :hint => l(:field_billable_rate_hint) %>
|
||||
<%= form.input :discount, :input_html => {:size => 20}, :hint => l(:field_discount_hint) %>
|
||||
<%= form.input :discount_note, :input_html => {:class => 'wiki-edit', :rows => '5'} %>
|
||||
<%= form.input :payment_terms, :as => :select, :collection => resource.payment_terms_for_select %>
|
||||
<%= form.input :client_ap_contact_information, :input_html => {:class => 'wiki-edit', :rows => '5'} %>
|
||||
<%= form.input :po_number %>
|
||||
<%= form.input :details, :input_html => {:class => 'wiki-edit'} %>
|
||||
<%= render :partial => 'form', :object => form %>
|
||||
<% end %>
|
||||
<% form.buttons do %>
|
||||
<%= form.commit_button %>
|
||||
<%= link_to(l(:button_cancel), contracts_path) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= wikitoolbar_for 'contract_discount_note' %>
|
||||
<%= wikitoolbar_for 'contract_client_ap_contact_information' %>
|
||||
<%= wikitoolbar_for 'contract_details' %>
|
||||
|
||||
|
||||
<% content_for(:header_tags) do %>
|
||||
<%= stylesheet_link_tag "redmine_contracts", :plugin => "redmine_contracts", :media => "screen" %>
|
||||
|
||||
@@ -13,3 +13,5 @@
|
||||
<%= content_tag(:p, h(resource.po_number)) %>
|
||||
<%= content_tag(:p, h(resource.details)) %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to(l(:button_update), edit_contract_path(@project, resource)) %>
|
||||
Reference in new issue
Block a user