[#4177] Created a custom form for a Contract to match the comp.
This commit is contained in:
1 parent
793fe165c1
commit
98733ff905
5 files changed
+100
-2
No files matched your search
@@ -0,0 +1,34 @@
|
|||||||
|
<%= 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 %> <%# TODO: 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 %>
|
||||||
|
<% 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" %>
|
||||||
|
<% end %>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/* Modification of Redmine's tabular forms to support formtastic */
|
||||||
|
.tabular li{
|
||||||
|
margin: 0;
|
||||||
|
padding: 5px 0 8px 0;
|
||||||
|
padding-left: 180px; /*width of left column containing the label elements*/
|
||||||
|
height: 1%;
|
||||||
|
clear:left;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
html>body .tabular li {overflow:hidden;}
|
||||||
|
|
||||||
|
.tabular .inline-hints { color:#666; margin:0.5em 0 0 0; padding: 0px; display: inline; }
|
||||||
|
|
||||||
|
.tabular li.required label { color: #000000; }
|
||||||
|
.tabular li.required label span.required {color: #bb0000;}
|
||||||
|
|
||||||
+10
-1
@@ -6,4 +6,13 @@ en:
|
|||||||
field_account_executive: Account Executive
|
field_account_executive: Account Executive
|
||||||
field_account_executive_short: "Acct. Mgr."
|
field_account_executive_short: "Acct. Mgr."
|
||||||
field_end_date: "End Date"
|
field_end_date: "End Date"
|
||||||
|
text_new_contract: "New Contract"
|
||||||
|
field_billable_rate: "Billable Rate"
|
||||||
|
field_billable_rate_hint: "$"
|
||||||
|
field_discount: "Discount"
|
||||||
|
field_discount_hint: "$, %"
|
||||||
|
field_discount_note: "Discounts Notes"
|
||||||
|
field_payment_terms: "Payment Terms"
|
||||||
|
field_client_ap_contact_information: "AP Contact Info"
|
||||||
|
field_po_number: "PO Number"
|
||||||
|
field_details: "Details"
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
config.gem 'formtastic', :version => '0.9.10'
|
||||||
|
|
||||||
require 'redmine'
|
require 'redmine'
|
||||||
|
|
||||||
Redmine::Plugin.register :redmine_contracts do
|
Redmine::Plugin.register :redmine_contracts do
|
||||||
@@ -12,7 +14,7 @@ Redmine::Plugin.register :redmine_contracts do
|
|||||||
requires_redmine_plugin :redmine_rate, :version_or_higher => '0.1.0'
|
requires_redmine_plugin :redmine_rate, :version_or_higher => '0.1.0'
|
||||||
|
|
||||||
project_module :contracts do
|
project_module :contracts do
|
||||||
permission :manage_budget, {:contracts => [:index] }, :public => true
|
permission :manage_budget, {:contracts => [:index, :new] }, :public => true
|
||||||
end
|
end
|
||||||
|
|
||||||
menu(:project_menu,
|
menu(:project_menu,
|
||||||
@@ -20,6 +22,14 @@ Redmine::Plugin.register :redmine_contracts do
|
|||||||
{:controller => 'contracts', :action => 'index'},
|
{:controller => 'contracts', :action => 'index'},
|
||||||
:caption => :text_contracts,
|
:caption => :text_contracts,
|
||||||
:param => :project_id)
|
:param => :project_id)
|
||||||
|
|
||||||
|
menu(:project_menu,
|
||||||
|
:new_contract,
|
||||||
|
{:controller => 'contracts', :action => 'new'},
|
||||||
|
:caption => :text_new_contract,
|
||||||
|
:param => :project_id,
|
||||||
|
:parent => :contracts)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'dispatcher'
|
require 'dispatcher'
|
||||||
@@ -29,6 +39,16 @@ Dispatcher.to_prepare :redmine_contracts do
|
|||||||
require_dependency 'inherited_resources'
|
require_dependency 'inherited_resources'
|
||||||
require_dependency 'inherited_resources/base'
|
require_dependency 'inherited_resources/base'
|
||||||
|
|
||||||
|
# Load and bootstrap formtastic
|
||||||
|
gem 'formtastic', :version => '0.9.10'
|
||||||
|
require_dependency 'formtastic'
|
||||||
|
require_dependency 'formtastic/layout_helper'
|
||||||
|
ActionView::Base.send :include, Formtastic::SemanticFormHelper
|
||||||
|
ActionView::Base.send :include, Formtastic::LayoutHelper
|
||||||
|
|
||||||
|
Formtastic::SemanticFormBuilder.all_fields_required_by_default = false
|
||||||
|
Formtastic::SemanticFormBuilder.required_string = "<span class='required'> *</span>"
|
||||||
|
|
||||||
require_dependency 'project'
|
require_dependency 'project'
|
||||||
Project.send(:include, RedmineContracts::Patches::ProjectPatch)
|
Project.send(:include, RedmineContracts::Patches::ProjectPatch)
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class ContractsNewTest < ActionController::IntegrationTest
|
||||||
|
include Redmine::I18n
|
||||||
|
|
||||||
|
def setup
|
||||||
|
@project = Project.generate!(:identifier => 'main')
|
||||||
|
end
|
||||||
|
|
||||||
|
should "allow any user to open the new contracts form" do
|
||||||
|
visit_contracts_for_project(@project)
|
||||||
|
click_link 'New Contract'
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
assert_select "form#new_contract"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Reference in new issue
Block a user