erp_forms 2.0.6 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/erp_forms/erp_app/desktop/dynamic_forms/base_controller.rb +4 -37
- data/app/controllers/erp_forms/erp_app/desktop/dynamic_forms/data_controller.rb +348 -82
- data/app/controllers/erp_forms/erp_app/desktop/dynamic_forms/forms_controller.rb +110 -15
- data/app/controllers/erp_forms/erp_app/desktop/dynamic_forms/models_controller.rb +19 -3
- data/app/mailers/dynamic_form_mailer.rb +35 -0
- data/app/models/dynamic_datum.rb +97 -22
- data/app/models/dynamic_form.rb +172 -98
- data/app/models/dynamic_form_document.rb +4 -11
- data/app/models/dynamic_form_model.rb +46 -22
- data/app/models/ticket.rb +4 -0
- data/app/views/dynamic_form_mailer/widget_email_with_attachments.html.erb +3 -0
- data/app/views/dynamic_form_mailer/widget_email_with_attachments.text.erb +3 -0
- data/app/widgets/dynamic_forms/base.rb +101 -19
- data/app/widgets/dynamic_forms/javascript/dynamic_forms.js +40 -38
- data/app/widgets/dynamic_forms/views/error.html.erb +1 -0
- data/db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.rb +2 -0
- data/db/data_migrations/20120824013449_create_ticket_form.rb +1 -0
- data/db/data_migrations/20121026013449_update_ticket_form.rb +64 -0
- data/db/data_migrations/{20120904191738_update_contact_form.rb → 20121026191738_update_contact_form.rb} +4 -0
- data/db/migrate/20110530193446_dynamic_forms.rb +12 -0
- data/db/migrate/20121007022323_upgrade_dynamic_forms_table.rb +31 -0
- data/lib/erp_forms.rb +4 -0
- data/lib/erp_forms/dynamic_form_field.rb +31 -28
- data/lib/erp_forms/dynamic_grid_column.rb +2 -2
- data/lib/erp_forms/engine.rb +5 -0
- data/lib/erp_forms/extensions/active_record/acts_as_commentable.rb +33 -0
- data/lib/erp_forms/extensions/active_record/acts_as_dynamic_form_model.rb +80 -0
- data/lib/erp_forms/extensions/active_record/has_dynamic_forms.rb +4 -4
- data/lib/erp_forms/extensions/extensions.rb +2 -0
- data/lib/erp_forms/extensions/railties/action_view.rb +2 -2
- data/lib/erp_forms/version.rb +2 -2
- data/public/javascripts/erp_app/desktop/applications/dynamic_forms/center_region.js +2 -1
- data/public/javascripts/erp_app/desktop/applications/dynamic_forms/dynamic_data_grid.js +264 -82
- data/public/javascripts/erp_app/desktop/applications/dynamic_forms/form_builder.js +1476 -58
- data/public/javascripts/erp_app/desktop/applications/dynamic_forms/module.js +24 -1
- data/public/javascripts/erp_app/desktop/applications/dynamic_forms/west_region.js +493 -210
- data/public/javascripts/erp_app/shared/dynamic_forms/dynamic_form_fields.js +82 -20
- data/public/javascripts/erp_app/shared/dynamic_forms/dynamic_forms_validation.js +23 -3
- data/spec/dummy/config/application.rb +6 -2
- data/spec/dummy/config/environments/spec.rb +3 -0
- data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +15 -0
- data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +12 -0
- data/spec/dummy/db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.erp_forms.rb +33 -0
- data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +19 -0
- data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +252 -0
- data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +53 -0
- data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
- data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +21 -0
- data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +32 -0
- data/spec/dummy/db/data_migrations/20110828190913_create_desktop_app_dynamic_forms.erp_forms.rb +19 -0
- data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +12 -0
- data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +23 -0
- data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +42 -0
- data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +22 -0
- data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +14 -0
- data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +29 -0
- data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +11 -0
- data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +19 -0
- data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +23 -0
- data/spec/dummy/db/data_migrations/20120824013449_create_ticket_form.erp_forms.rb +67 -0
- data/spec/dummy/db/data_migrations/20121026013449_update_ticket_form.erp_forms.rb +65 -0
- data/spec/dummy/db/data_migrations/20121026191738_update_contact_form.erp_forms.rb +27 -0
- data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
- data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +16 -0
- data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +24 -0
- data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +23 -0
- data/spec/dummy/db/migrate/20121213234847_base_erp_services.erp_base_erp_svcs.rb +461 -0
- data/spec/dummy/db/migrate/20121213234848_base_tech_services.erp_tech_svcs.rb +255 -0
- data/spec/dummy/db/migrate/20121213234849_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
- data/spec/dummy/db/migrate/20121213234850_base_app_framework.erp_app.rb +276 -0
- data/spec/dummy/db/migrate/20121213234851_dynamic_forms.erp_forms.rb +95 -0
- data/spec/dummy/db/migrate/20121213234852_create_tickets.erp_forms.rb +19 -0
- data/spec/dummy/db/migrate/20121213234853_upgrade_dynamic_forms_table.erp_forms.rb +32 -0
- data/spec/dummy/db/migrate/20130107181041_create_groups.erp_tech_svcs.rb +19 -0
- data/spec/dummy/db/migrate/20130107181042_upgrade_security.erp_tech_svcs.rb +54 -0
- data/spec/dummy/db/migrate/20130107181043_upgrade_security2.erp_tech_svcs.rb +270 -0
- data/spec/dummy/db/schema.rb +879 -0
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/spec.log +13580 -0
- data/spec/models/dynamic_form_model_spec.rb +1 -1
- data/spec/spec_helper.rb +11 -3
- metadata +136 -14
@@ -1,6 +1,10 @@
|
|
1
1
|
class DynamicFormDocument < ActiveRecord::Base
|
2
|
+
attr_protected :created_at, :updated_at
|
3
|
+
|
2
4
|
belongs_to :dynamic_form_model
|
3
5
|
|
6
|
+
acts_as_dynamic_form_model
|
7
|
+
has_file_assets
|
4
8
|
has_dynamic_forms
|
5
9
|
has_dynamic_data
|
6
10
|
|
@@ -20,15 +24,4 @@ class DynamicFormDocument < ActiveRecord::Base
|
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
23
|
-
def self.class_exists?(class_name)
|
24
|
-
result = nil
|
25
|
-
begin
|
26
|
-
klass = Module.const_get(class_name)
|
27
|
-
result = klass.is_a?(Class) ? ((klass.superclass == ActiveRecord::Base or klass.superclass == DynamicModel) ? true : nil) : nil
|
28
|
-
rescue NameError
|
29
|
-
result = nil
|
30
|
-
end
|
31
|
-
result
|
32
|
-
end
|
33
|
-
|
34
27
|
end
|
@@ -1,42 +1,66 @@
|
|
1
1
|
class DynamicFormModel < ActiveRecord::Base
|
2
|
+
attr_protected :created_at, :updated_at
|
3
|
+
|
2
4
|
has_many :dynamic_form_documents
|
3
5
|
has_many :dynamic_forms, :dependent => :destroy
|
6
|
+
after_create :create_role
|
7
|
+
|
8
|
+
validates_uniqueness_of :model_name
|
9
|
+
|
10
|
+
def create_role
|
11
|
+
SecurityRole.create(:description => self.model_name.titleize.pluralize, :internal_identifier => role_iid) if self.role.nil?
|
12
|
+
end
|
13
|
+
|
14
|
+
def role_iid
|
15
|
+
"dynamic_form_model_#{self.model_name}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def role
|
19
|
+
SecurityRole.iid(role_iid)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.sunspot_setup_all
|
23
|
+
DynamicFormModel.all.each do |m|
|
24
|
+
next if m.model_name == 'DynamicFormDocument'
|
25
|
+
next unless ActiveRecord::Base.connection.table_exists? m.get_constant.table_name
|
26
|
+
m.get_constant.sunspot_setup unless DynamicFormModel.class_exists?(m.model_name)
|
27
|
+
end
|
28
|
+
end
|
4
29
|
|
5
30
|
def self.get_constant(klass_name)
|
6
|
-
|
7
|
-
|
31
|
+
result = nil
|
32
|
+
begin
|
8
33
|
result = klass_name.constantize
|
9
34
|
rescue
|
10
35
|
DynamicFormDocument.declare(klass_name)
|
11
36
|
result = klass_name.constantize
|
12
37
|
end
|
13
|
-
|
38
|
+
result
|
39
|
+
end
|
40
|
+
|
41
|
+
# checks to see if class name exists as a static model or has already been declared
|
42
|
+
# used with sunspot_setup_all
|
43
|
+
def self.class_exists?(class_name)
|
44
|
+
result = nil
|
45
|
+
begin
|
46
|
+
klass = Module.const_get(class_name)
|
47
|
+
result = (klass.is_a?(Class) ? ((klass.superclass == ActiveRecord::Base or klass.superclass == DynamicFormModel) ? true : nil) : nil)
|
48
|
+
rescue NameError
|
49
|
+
result = nil
|
50
|
+
end
|
51
|
+
result
|
14
52
|
end
|
15
53
|
|
16
54
|
def self.get_instance(klass_name)
|
17
55
|
DynamicFormModel.get_constant(klass_name).new
|
18
56
|
end
|
19
57
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
params.each do |k,v|
|
24
|
-
unless ignored_params.include?(k.to_s) or k == '' or k == '_'
|
25
|
-
if dynamicObject.attributes.include?(k)
|
26
|
-
dynamicObject.send(k + '=', v)
|
27
|
-
else
|
28
|
-
if ['created_by','updated_by','created_at','updated_at','created_with_form_id','updated_with_form_id'].include?(k)
|
29
|
-
key = k + '='
|
30
|
-
else
|
31
|
-
key = DynamicDatum::DYNAMIC_ATTRIBUTE_PREFIX + k + '='
|
32
|
-
end
|
33
|
-
|
34
|
-
dynamicObject.data.send(key, v)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
58
|
+
def get_constant
|
59
|
+
DynamicFormModel.get_constant(self.model_name)
|
60
|
+
end
|
38
61
|
|
39
|
-
|
62
|
+
def get_instance
|
63
|
+
DynamicFormModel.get_instance(self.model_name)
|
40
64
|
end
|
41
65
|
|
42
66
|
end
|
data/app/models/ticket.rb
CHANGED
@@ -6,28 +6,110 @@ module Widgets
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def new
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
9
|
+
begin
|
10
|
+
unless params[:file].nil?
|
11
|
+
# size check
|
12
|
+
if params[:file].tempfile.size > ErpTechSvcs::Config.max_file_size_in_mb.megabytes
|
13
|
+
raise "File cannot be larger than #{ErpTechSvcs::Config.max_file_size_in_mb}MB"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
form_data = JSON.parse(params[:form_data_json])
|
17
|
+
form_data[:dynamic_form_id] = params[:dynamic_form_id]
|
18
|
+
form_data[:model_name] = params[:model_name]
|
19
|
+
form_data.symbolize_keys!
|
20
|
+
@website = Website.find_by_host(request.host_with_port)
|
21
|
+
|
22
|
+
if form_data[:email_subject].blank?
|
23
|
+
subject = "#{form_data[:model_name]} Submission from #{@website.title}"
|
24
|
+
else
|
25
|
+
subject = strip_tags(form_data[:email_subject])
|
26
|
+
form_data.delete(:email_subject)
|
27
|
+
end
|
28
|
+
|
29
|
+
@myDynamicObject = DynamicFormModel.get_instance(form_data[:model_name])
|
30
|
+
|
31
|
+
form_data[:created_by] = current_user unless current_user.nil?
|
32
|
+
form_data[:created_with_form_id] = form_data[:dynamic_form_id] if form_data[:dynamic_form_id] and params[:is_html_form].blank?
|
33
|
+
form_data[:website] = @website.title
|
34
|
+
|
35
|
+
@myDynamicObject = @myDynamicObject.assign_all_attributes(form_data, ErpApp::Widgets::Base::IGNORED_PARAMS)
|
36
|
+
|
37
|
+
# get dynamic for from form_data[:created_with_form_id]
|
38
|
+
form = DynamicForm.find(form_data[:created_with_form_id])
|
39
|
+
|
40
|
+
# check widget_action from dynamic form
|
41
|
+
if !form.nil? and ['email', 'both'].include?(form.widget_action)
|
42
|
+
# email data
|
43
|
+
attachments = (params[:file].nil? ? [] : [params[:file]])
|
44
|
+
send_email(form, @myDynamicObject, subject, attachments)
|
45
|
+
end
|
46
|
+
|
47
|
+
if form.nil? or (!form.nil? and ['save', 'both'].include?(form.widget_action))
|
48
|
+
#save data
|
49
|
+
@myDynamicObject.save
|
50
|
+
save_file_asset(form_data) unless params[:file].nil?
|
51
|
+
end
|
52
|
+
|
53
|
+
output = render_to_string(:template => "success", :layout => false)
|
54
|
+
render :inline => {
|
55
|
+
:success => true,
|
56
|
+
:response => (file_upload_request? ? ERB::Util.html_escape(output) : output)
|
57
|
+
}.to_json
|
58
|
+
rescue Exception => e
|
59
|
+
Rails.logger.error e.message
|
60
|
+
Rails.logger.error e.backtrace.join("\n")
|
61
|
+
output = render_to_string(:template => "error", :layout => false, :locals => {:message => e.message})
|
62
|
+
render :inline => {
|
25
63
|
:success => false,
|
26
|
-
:response =>
|
27
|
-
}
|
28
|
-
|
64
|
+
:response => (file_upload_request? ? ERB::Util.html_escape(output) : output)
|
65
|
+
}.to_json
|
66
|
+
end
|
29
67
|
end
|
30
68
|
|
69
|
+
protected
|
70
|
+
def file_upload_request?
|
71
|
+
request.env['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest'
|
72
|
+
end
|
73
|
+
|
74
|
+
def save_file_asset(form_data)
|
75
|
+
result = {}
|
76
|
+
name = params[:file].original_filename
|
77
|
+
data = params[:file].tempfile
|
78
|
+
set_file_support
|
79
|
+
|
80
|
+
begin
|
81
|
+
@root_node = File.join(ErpTechSvcs::Config.file_assets_location, form_data[:model_name], @myDynamicObject.id.to_s)
|
82
|
+
file = @myDynamicObject.add_file(data, File.join(@file_support.root, base_path, name))
|
83
|
+
|
84
|
+
roles = ['admin', @myDynamicObject.role_iid]
|
85
|
+
(@myDynamicObject.file_security_default == 'private') ? file.add_capability(:download, 'FileAsset', roles) : file.remove_all_capabilities
|
86
|
+
|
87
|
+
return {:success => true}
|
88
|
+
rescue Exception => e
|
89
|
+
Rails.logger.error e.message
|
90
|
+
Rails.logger.error e.backtrace
|
91
|
+
raise "Error uploading file. #{e.message}"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def base_path
|
96
|
+
@base_path = (@root_node.nil? ? nil : File.join(@file_support.root, @root_node))
|
97
|
+
end
|
98
|
+
|
99
|
+
def set_file_support
|
100
|
+
@file_support = ErpTechSvcs::FileSupport::Base.new(:storage => ErpTechSvcs::Config.file_storage)
|
101
|
+
end
|
102
|
+
|
103
|
+
def send_email(form, dynamicObject, subject='', attachments=[])
|
104
|
+
begin
|
105
|
+
DynamicFormMailer.widget_email_with_attachments(form, dynamicObject, subject, attachments).deliver
|
106
|
+
rescue Exception => e
|
107
|
+
Rails.logger.error e.message
|
108
|
+
Rails.logger.error e.backtrace
|
109
|
+
raise "Error sending email. #{e.message}"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
31
113
|
#should not be modified
|
32
114
|
#modify at your own risk
|
33
115
|
def locate
|
@@ -4,7 +4,6 @@ Compass.ErpApp.Widgets.DynamicForms = {
|
|
4
4
|
layout:'fit',
|
5
5
|
width:375,
|
6
6
|
title:'Add DynamicForm Widget',
|
7
|
-
height:190,
|
8
7
|
plain: true,
|
9
8
|
buttonAlign:'center',
|
10
9
|
items: Ext.create("Ext.form.Panel",{
|
@@ -17,7 +16,6 @@ Compass.ErpApp.Widgets.DynamicForms = {
|
|
17
16
|
items: [
|
18
17
|
{
|
19
18
|
xtype:'combo',
|
20
|
-
id:'WidgetDynamicFormModelName',
|
21
19
|
value:'',
|
22
20
|
loadingText:'Retrieving Dynamic Form Models ...',
|
23
21
|
store:Ext.create('Ext.data.Store',{
|
@@ -30,32 +28,32 @@ Compass.ErpApp.Widgets.DynamicForms = {
|
|
30
28
|
url:'/erp_forms/erp_app/desktop/dynamic_forms/models/index'
|
31
29
|
},
|
32
30
|
fields:[
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}
|
31
|
+
{
|
32
|
+
name:'id'
|
33
|
+
},
|
34
|
+
{
|
35
|
+
name:'model_name'
|
36
|
+
}
|
40
37
|
]
|
41
38
|
}),
|
42
39
|
forceSelection:true,
|
43
40
|
editable:true,
|
44
|
-
fieldLabel:'
|
41
|
+
fieldLabel:'Model Name',
|
45
42
|
autoSelect:true,
|
46
|
-
typeAhead: true,
|
47
43
|
mode: 'remote',
|
44
|
+
name: 'model_name',
|
48
45
|
displayField:'model_name',
|
49
46
|
valueField:'model_name',
|
50
47
|
triggerAction: 'all',
|
51
|
-
allowBlank:false
|
48
|
+
allowBlank:false,
|
49
|
+
plugins: [new helpQtip("Dynamic Form Model Name (Class)")]
|
52
50
|
},
|
53
51
|
{
|
54
52
|
xtype:'textfield',
|
55
|
-
fieldLabel:'Form Width
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
fieldLabel:'Form Width',
|
54
|
+
name: 'form_width',
|
55
|
+
allowBlank:true,
|
56
|
+
plugins: [new helpQtip("Form Width in Pixels. Leave blank for auto width.")]
|
59
57
|
}
|
60
58
|
]
|
61
59
|
}),
|
@@ -65,30 +63,34 @@ Compass.ErpApp.Widgets.DynamicForms = {
|
|
65
63
|
'click':function(button){
|
66
64
|
var tpl = null;
|
67
65
|
var content = null;
|
68
|
-
var
|
69
|
-
var formPanel = window.query('form')[0];
|
66
|
+
var formPanel = button.findParentByType('window').query('form').first();
|
70
67
|
var basicForm = formPanel.getForm();
|
68
|
+
var WidgetDynamicFormModelName = basicForm.findField('model_name');
|
69
|
+
var WidgetDynamicFormWidth = basicForm.findField('form_width');
|
70
|
+
if (basicForm.isValid()){
|
71
|
+
var data = {
|
72
|
+
WidgetDynamicFormModelName: WidgetDynamicFormModelName.getValue(),
|
73
|
+
WidgetDynamicFormWidth: WidgetDynamicFormWidth.getValue()
|
74
|
+
};
|
71
75
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
" :internal_identifier => '',\n",
|
86
|
-
" :width => {WidgetDynamicFormWidth}} %>");
|
87
|
-
content = tpl.apply(data);
|
76
|
+
tpl = new Ext.XTemplate(
|
77
|
+
"<% # Optional Parameters:\n",
|
78
|
+
" # internal_identifier: Models can have multiple forms\n",
|
79
|
+
" # Leave blank if you want to use the default form\n",
|
80
|
+
" # Specify internal_identifier to choose a specific form %>\n",
|
81
|
+
"<%= render_widget :dynamic_forms,\n",
|
82
|
+
" :params => {:model_name => '{WidgetDynamicFormModelName}',\n",
|
83
|
+
" :internal_identifier => ''",
|
84
|
+
'<tpl if="WidgetDynamicFormWidth">',
|
85
|
+
",\n :width => {WidgetDynamicFormWidth} ",
|
86
|
+
'</tpl>',
|
87
|
+
"} %>");
|
88
|
+
content = tpl.apply(data);
|
88
89
|
|
89
|
-
|
90
|
-
|
91
|
-
|
90
|
+
//add rendered template to center region editor
|
91
|
+
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(content);
|
92
|
+
addDynamicFormWidgetWindow.close();
|
93
|
+
}
|
92
94
|
}
|
93
95
|
}
|
94
96
|
},{
|
@@ -100,7 +102,7 @@ Compass.ErpApp.Widgets.DynamicForms = {
|
|
100
102
|
});
|
101
103
|
addDynamicFormWidgetWindow.show();
|
102
104
|
}
|
103
|
-
}
|
105
|
+
};
|
104
106
|
|
105
107
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
106
108
|
name:'Dynamic Forms',
|
@@ -18,6 +18,8 @@ class CreateDefaultDynamicModelsAndForms
|
|
18
18
|
d.internal_identifier = 'contact_us'
|
19
19
|
d.default = true
|
20
20
|
d.dynamic_form_model = DynamicFormModel.create(:model_name => 'WebsiteInquiry')
|
21
|
+
d.comment = "This is the default form used by Knitkit's Contact Us Widget for Website Inquiries. NOTE: The Contact Us Widget uses Knitkit's website configuration options for email behavior & not the Dynamic Forms Widget Action setting."
|
22
|
+
d.msg_target = 'qtip'
|
21
23
|
d.save
|
22
24
|
end
|
23
25
|
|
@@ -0,0 +1,64 @@
|
|
1
|
+
class UpdateTicketForm
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
model = DynamicFormModel.find_by_model_name('Ticket')
|
5
|
+
model.create_role
|
6
|
+
|
7
|
+
#insert data here
|
8
|
+
fields = []
|
9
|
+
|
10
|
+
fields << DynamicFormField.textfield({:fieldLabel => 'Title', :name => 'title', :width => 250, :allowBlank => false })
|
11
|
+
fields << DynamicFormField.combobox([['Open', 'Open'],['Closed', 'Closed']],{:fieldLabel => 'Status', :name => 'status', :width => 175, :allowBlank => false })
|
12
|
+
fields << DynamicFormField.combobox([ ['Defect', 'Defect'],
|
13
|
+
['Feature', 'Feature'],
|
14
|
+
['Issue', 'Issue'],
|
15
|
+
['Task', 'Task'],
|
16
|
+
],{:fieldLabel => 'Type', :name => 'type', :width => 175, :allowBlank => false })
|
17
|
+
fields << DynamicFormField.combobox([['High', 'High'],['Medium', 'Medium'],['Low', 'Low']],{:fieldLabel => 'Priority', :name => 'priority', :width => 175, :allowBlank => false })
|
18
|
+
fields << DynamicFormField.combobox([ ['compass_ae_console', 'compass_ae_console'],
|
19
|
+
['compass_ae_starter_kit', 'compass_ae_starter_kit'],
|
20
|
+
['data_migrator', 'data_migrator'],
|
21
|
+
['erp_agreements', 'erp_agreements'],
|
22
|
+
['erp_app', 'erp_app'],
|
23
|
+
['erp_base_erp_svcs', 'erp_base_erp_svcs'],
|
24
|
+
['erp_commerce', 'erp_commerce'],
|
25
|
+
['erp_communication_events', 'erp_communication_events'],
|
26
|
+
['erp_dev_svcs', 'erp_dev_svcs'],
|
27
|
+
['erp_financial_accounting', 'erp_financial_accounting'],
|
28
|
+
['erp_forms', 'erp_forms'],
|
29
|
+
['erp_inventory', 'erp_inventory'],
|
30
|
+
['erp_invoicing', 'erp_invoicing'],
|
31
|
+
['erp_offers', 'erp_offers'],
|
32
|
+
['erp_orders', 'erp_orders'],
|
33
|
+
['erp_products', 'erp_products'],
|
34
|
+
['erp_rules', 'erp_rules'],
|
35
|
+
['erp_search', 'erp_search'],
|
36
|
+
['erp_tech_svcs', 'erp_tech_svcs'],
|
37
|
+
['erp_txns_and_accts', 'erp_txns_and_accts'],
|
38
|
+
['erp_work_effort', 'erp_work_effort'],
|
39
|
+
['erp_workflow', 'erp_workflow'],
|
40
|
+
['knitkit', 'knitkit'],
|
41
|
+
['master_data_management', 'master_data_management'],
|
42
|
+
['prismpay', 'prismpay'],
|
43
|
+
['rails_db_admin', 'rails_db_admin'],
|
44
|
+
['tenancy', 'tenancy'],
|
45
|
+
['timeshare', 'timeshare']
|
46
|
+
],
|
47
|
+
{:fieldLabel => 'Product', :name => 'product', :width => 270, :allowBlank => true })
|
48
|
+
fields << DynamicFormField.combobox([['None', 'None']],{:fieldLabel => 'Project', :name => 'project', :width => 175, :allowBlank => true })
|
49
|
+
fields << DynamicFormField.related_combobox('User','username',{:fieldLabel => 'Assigned To', :name => 'assigned_to_id', :width => 175, :allowBlank => true })
|
50
|
+
fields << DynamicFormField.textarea({:fieldLabel => 'Body', :name => 'body', :width => 400, :height => 300, :allowBlank => false, :display_in_grid => false })
|
51
|
+
|
52
|
+
d = DynamicForm.find_by_internal_identifier('ticket')
|
53
|
+
unless d.nil?
|
54
|
+
d.definition = fields.to_json
|
55
|
+
d.msg_target = 'qtip'
|
56
|
+
d.save
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.down
|
61
|
+
#remove data here
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|