knitkit 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/knitkit/comments_controller.rb +1 -1
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +5 -0
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +0 -4
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +0 -2
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +13 -0
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +37 -29
- data/app/controllers/knitkit/online_document_sections_controller.rb +1 -1
- data/app/models/website_section.rb +2 -3
- data/app/views/knitkit/blogs/_add_comment.html.erb +2 -1
- data/app/views/knitkit/online_document_sections/index.html.erb +143 -136
- data/app/views/layouts/knitkit/online_document_sections.html.erb +2 -2
- data/app/widgets/contact_us/javascript/contact_us.js +3 -1
- data/app/widgets/dynamic_forms/javascript/dynamic_forms.js +91 -92
- data/app/widgets/dynamic_grid/base.rb +7 -7
- data/app/widgets/dynamic_grid/javascript/dynamic_grid.js +111 -112
- data/app/widgets/dynamic_grid/views/index.html.erb +1 -1
- data/app/widgets/google_map/javascript/google_map.js +132 -119
- data/app/widgets/google_map/views/index.html.erb +1 -1
- data/app/widgets/login/javascript/login.js +160 -155
- data/app/widgets/manage_profile/javascript/manage_profile.js +3 -1
- data/app/widgets/reset_password/javascript/reset_password.js +3 -1
- data/app/widgets/scaffold/base.rb +8 -4
- data/app/widgets/scaffold/javascript/scaffold.js +218 -220
- data/app/widgets/scaffold/views/index.html.erb +1 -1
- data/app/widgets/search/javascript/search.js +21 -21
- data/app/widgets/signup/javascript/signup.js +2 -1
- data/config/routes.rb +1 -1
- data/lib/knitkit/extensions/railties/action_view/helpers/blog_helper.rb +3 -3
- data/lib/knitkit/extensions/railties/action_view/helpers/knitkit_helper.rb +0 -2
- data/lib/knitkit/version.rb +1 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +6 -7
- data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +3 -3
- data/public/javascripts/erp_app/desktop/applications/knitkit/select_roles_window.js +103 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +4 -4
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +32 -21
- metadata +3 -2
@@ -1,111 +1,110 @@
|
|
1
1
|
Compass.ErpApp.Widgets.DynamicForms = {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
template: new Ext.XTemplate(
|
3
|
+
"<% # Optional Parameters:\n",
|
4
|
+
" # internal_identifier: Models can have multiple forms\n",
|
5
|
+
" # Leave blank if you want to use the default form\n",
|
6
|
+
" # Specify internal_identifier to choose a specific form %>\n",
|
7
|
+
"<%= render_widget :dynamic_forms,\n",
|
8
|
+
" :params => {:model_name => '{WidgetDynamicFormModelName}',\n",
|
9
|
+
" :internal_identifier => ''",
|
10
|
+
'<tpl if="WidgetDynamicFormWidth">',
|
11
|
+
",\n :width => {WidgetDynamicFormWidth} ",
|
12
|
+
'</tpl>',
|
13
|
+
"} %>"),
|
14
|
+
|
15
|
+
addDynamicForm: function () {
|
16
|
+
var addDynamicFormWidgetWindow = Ext.create("Ext.window.Window", {
|
17
|
+
layout: 'fit',
|
18
|
+
width: 375,
|
19
|
+
title: 'Add DynamicForm Widget',
|
7
20
|
plain: true,
|
8
|
-
buttonAlign:'center',
|
9
|
-
items: Ext.create("Ext.form.Panel",{
|
21
|
+
buttonAlign: 'center',
|
22
|
+
items: Ext.create("Ext.form.Panel", {
|
10
23
|
labelWidth: 100,
|
11
|
-
frame:false,
|
12
|
-
bodyStyle:'padding:5px 5px 0',
|
24
|
+
frame: false,
|
25
|
+
bodyStyle: 'padding:5px 5px 0',
|
13
26
|
defaults: {
|
14
27
|
width: 325
|
15
28
|
},
|
16
29
|
items: [
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
},
|
30
|
-
fields:[
|
31
|
-
{
|
32
|
-
name:'id'
|
30
|
+
{
|
31
|
+
xtype: 'combo',
|
32
|
+
value: '',
|
33
|
+
loadingText: 'Retrieving Dynamic Form Models ...',
|
34
|
+
store: Ext.create('Ext.data.Store', {
|
35
|
+
proxy: {
|
36
|
+
type: 'ajax',
|
37
|
+
reader: {
|
38
|
+
type: 'json',
|
39
|
+
root: 'dynamic_form_model'
|
40
|
+
},
|
41
|
+
url: '/erp_forms/erp_app/desktop/dynamic_forms/models/index'
|
33
42
|
},
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
43
|
+
fields: [
|
44
|
+
{
|
45
|
+
name: 'id'
|
46
|
+
},
|
47
|
+
{
|
48
|
+
name: 'model_name'
|
49
|
+
}
|
50
|
+
]
|
51
|
+
}),
|
52
|
+
forceSelection: true,
|
53
|
+
editable: true,
|
54
|
+
fieldLabel: 'Model Name',
|
55
|
+
autoSelect: true,
|
56
|
+
mode: 'remote',
|
57
|
+
name: 'model_name',
|
58
|
+
displayField: 'model_name',
|
59
|
+
valueField: 'model_name',
|
60
|
+
triggerAction: 'all',
|
61
|
+
allowBlank: false,
|
62
|
+
plugins: [new helpQtip("Dynamic Form Model Name (Class)")]
|
63
|
+
},
|
64
|
+
{
|
65
|
+
xtype: 'textfield',
|
66
|
+
fieldLabel: 'Form Width',
|
67
|
+
name: 'form_width',
|
68
|
+
allowBlank: true,
|
69
|
+
plugins: [new helpQtip("Form Width in Pixels. Leave blank for auto width.")]
|
70
|
+
}
|
58
71
|
]
|
59
72
|
}),
|
60
|
-
buttons: [
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
};
|
75
|
-
|
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);
|
73
|
+
buttons: [
|
74
|
+
{
|
75
|
+
text: 'Submit',
|
76
|
+
listeners: {
|
77
|
+
'click': function (button) {
|
78
|
+
var formPanel = button.findParentByType('window').query('form').first(),
|
79
|
+
basicForm = formPanel.getForm(),
|
80
|
+
WidgetDynamicFormModelName = basicForm.findField('model_name'),
|
81
|
+
WidgetDynamicFormWidth = basicForm.findField('form_width');
|
82
|
+
if (basicForm.isValid()) {
|
83
|
+
var data = {
|
84
|
+
WidgetDynamicFormModelName: WidgetDynamicFormModelName.getValue(),
|
85
|
+
WidgetDynamicFormWidth: WidgetDynamicFormWidth.getValue()
|
86
|
+
};
|
89
87
|
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
//add rendered template to center region editor
|
89
|
+
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(Compass.ErpApp.Widgets.DynamicForms.template.apply(data));
|
90
|
+
addDynamicFormWidgetWindow.close();
|
91
|
+
}
|
93
92
|
}
|
94
93
|
}
|
94
|
+
},
|
95
|
+
{
|
96
|
+
text: 'Close',
|
97
|
+
handler: function () {
|
98
|
+
addDynamicFormWidgetWindow.close();
|
99
|
+
}
|
95
100
|
}
|
96
|
-
|
97
|
-
|
98
|
-
handler: function(){
|
99
|
-
addDynamicFormWidgetWindow.close();
|
100
|
-
}
|
101
|
-
}]
|
102
|
-
});
|
103
|
-
addDynamicFormWidgetWindow.show();
|
101
|
+
]
|
102
|
+
}).show();
|
104
103
|
}
|
105
104
|
};
|
106
105
|
|
107
106
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
108
|
-
name:'Dynamic Forms',
|
109
|
-
iconUrl:'/images/icons/document_text/document_text_48x48.png',
|
110
|
-
onClick:Compass.ErpApp.Widgets.DynamicForms.addDynamicForm
|
107
|
+
name: 'Dynamic Forms',
|
108
|
+
iconUrl: '/images/icons/document_text/document_text_48x48.png',
|
109
|
+
onClick: Compass.ErpApp.Widgets.DynamicForms.addDynamicForm
|
111
110
|
});
|
@@ -4,13 +4,13 @@ module Widgets
|
|
4
4
|
|
5
5
|
def index
|
6
6
|
@model_name = params[:model_name]
|
7
|
-
@title = params[:title] || params[:
|
8
|
-
@width = params[:width] || '100%'
|
9
|
-
@height = params[:height] || 500
|
10
|
-
@page = params[:page] || true
|
11
|
-
@page_size = params[:page_size] || 10
|
12
|
-
@display_msg = params[:display_msg] || 'Displaying {0} - {1} of {2}'
|
13
|
-
@empty_msg = params[:empty_msg] || 'Empty'
|
7
|
+
@title = params[:grid][:title] || params[:model].pluralize
|
8
|
+
@width = params[:grid][:width] || '100%'
|
9
|
+
@height = params[:grid][:height] || 500
|
10
|
+
@page = params[:grid][:page] || true
|
11
|
+
@page_size = params[:grid][:page_size] || 10
|
12
|
+
@display_msg = params[:grid][:display_msg] || 'Displaying {0} - {1} of {2}'
|
13
|
+
@empty_msg = params[:grid][:empty_msg] || 'Empty'
|
14
14
|
|
15
15
|
render :view => :index
|
16
16
|
end
|
@@ -1,167 +1,166 @@
|
|
1
1
|
Compass.ErpApp.Widgets.DynamicGrid = {
|
2
|
-
|
2
|
+
template: new Ext.XTemplate("<%= render_widget :dynamic_grid, :params => {:model_name => '{model_name}',\n",
|
3
|
+
" :grid => {\n",
|
4
|
+
" :title => '{title}',\n",
|
5
|
+
" :width => {width},\n",
|
6
|
+
" :height => {height},\n",
|
7
|
+
" :page => {page_results:this.toBoolean},\n",
|
8
|
+
" :page_size => {pageSize},\n",
|
9
|
+
" :display_msg => '{displayMsg}',\n",
|
10
|
+
" :empty_msg => '{emptyMsg}'\n",
|
11
|
+
" }\n",
|
12
|
+
"} %>",
|
13
|
+
{
|
14
|
+
toBoolean: function (value) {
|
15
|
+
var result = 'false';
|
16
|
+
if (value == 'y') {
|
17
|
+
result = 'true';
|
18
|
+
}
|
19
|
+
return result;
|
20
|
+
}
|
21
|
+
}),
|
22
|
+
|
23
|
+
addWidget: function () {
|
3
24
|
Ext.create("Ext.window.Window", {
|
4
|
-
title:'Add Dynamic Grid',
|
5
|
-
plain:true,
|
6
|
-
buttonAlign:'center',
|
7
|
-
items:Ext.create("Ext.form.Panel", {
|
8
|
-
labelWidth:100,
|
9
|
-
frame:false,
|
10
|
-
bodyStyle:'padding:5px 5px 0',
|
11
|
-
defaults:{
|
12
|
-
width:325
|
25
|
+
title: 'Add Dynamic Grid',
|
26
|
+
plain: true,
|
27
|
+
buttonAlign: 'center',
|
28
|
+
items: Ext.create("Ext.form.Panel", {
|
29
|
+
labelWidth: 100,
|
30
|
+
frame: false,
|
31
|
+
bodyStyle: 'padding:5px 5px 0',
|
32
|
+
defaults: {
|
33
|
+
width: 325
|
13
34
|
},
|
14
|
-
items:[
|
35
|
+
items: [
|
15
36
|
{
|
16
|
-
xtype:'combo',
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
37
|
+
xtype: 'combo',
|
38
|
+
width:300,
|
39
|
+
value: '',
|
40
|
+
loadingText: 'Retrieving Dynamic Form Models ...',
|
41
|
+
store: Ext.create('Ext.data.Store', {
|
42
|
+
proxy: {
|
43
|
+
type: 'ajax',
|
44
|
+
reader: {
|
45
|
+
type: 'json',
|
46
|
+
root: 'dynamic_form_model'
|
25
47
|
},
|
26
|
-
url:'/erp_forms/erp_app/desktop/dynamic_forms/models/index'
|
48
|
+
url: '/erp_forms/erp_app/desktop/dynamic_forms/models/index'
|
27
49
|
},
|
28
|
-
fields:[
|
50
|
+
fields: [
|
29
51
|
{
|
30
|
-
name:'id'
|
52
|
+
name: 'id'
|
31
53
|
},
|
32
54
|
{
|
33
|
-
name:'model_name'
|
55
|
+
name: 'model_name'
|
34
56
|
}
|
35
57
|
]
|
36
58
|
}),
|
37
|
-
forceSelection:true,
|
38
|
-
editable:true,
|
39
|
-
fieldLabel:'Model Name',
|
40
|
-
autoSelect:true,
|
41
|
-
mode:'remote',
|
42
|
-
name:'model_name',
|
43
|
-
displayField:'model_name',
|
44
|
-
valueField:'model_name',
|
45
|
-
triggerAction:'all',
|
46
|
-
allowBlank:false,
|
47
|
-
plugins:[new helpQtip("Dynamic Form Model Name (Class)")],
|
48
|
-
listeners:{
|
49
|
-
select:function(){
|
59
|
+
forceSelection: true,
|
60
|
+
editable: true,
|
61
|
+
fieldLabel: 'Model Name',
|
62
|
+
autoSelect: true,
|
63
|
+
mode: 'remote',
|
64
|
+
name: 'model_name',
|
65
|
+
displayField: 'model_name',
|
66
|
+
valueField: 'model_name',
|
67
|
+
triggerAction: 'all',
|
68
|
+
allowBlank: false,
|
69
|
+
plugins: [new helpQtip("Dynamic Form Model Name (Class)")],
|
70
|
+
listeners: {
|
71
|
+
select: function () {
|
50
72
|
this.up('form').down('fieldset').enable();
|
51
73
|
}
|
52
74
|
}
|
53
75
|
},
|
54
76
|
{
|
55
|
-
xtype:'fieldset',
|
56
|
-
title:'Grid Options',
|
57
|
-
disabled:true,
|
58
|
-
items:[
|
77
|
+
xtype: 'fieldset',
|
78
|
+
title: 'Grid Options',
|
79
|
+
disabled: true,
|
80
|
+
items: [
|
59
81
|
{
|
60
|
-
xtype:'textfield',
|
61
|
-
name:'title',
|
62
|
-
fieldLabel:'Title'
|
82
|
+
xtype: 'textfield',
|
83
|
+
name: 'title',
|
84
|
+
fieldLabel: 'Title'
|
63
85
|
},
|
64
86
|
{
|
65
|
-
xtype:'textfield',
|
66
|
-
name:'width',
|
67
|
-
value:500,
|
68
|
-
fieldLabel:'Width'
|
87
|
+
xtype: 'textfield',
|
88
|
+
name: 'width',
|
89
|
+
value: 500,
|
90
|
+
fieldLabel: 'Width'
|
69
91
|
},
|
70
92
|
{
|
71
|
-
xtype:'textfield',
|
72
|
-
name:'height',
|
73
|
-
value:500,
|
74
|
-
fieldLabel:'Height'
|
93
|
+
xtype: 'textfield',
|
94
|
+
name: 'height',
|
95
|
+
value: 500,
|
96
|
+
fieldLabel: 'Height'
|
75
97
|
},
|
76
98
|
{
|
77
|
-
xtype:'fieldcontainer',
|
78
|
-
defaultType:'radiofield',
|
79
|
-
width:200,
|
80
|
-
defaults:{
|
81
|
-
flex:1
|
99
|
+
xtype: 'fieldcontainer',
|
100
|
+
defaultType: 'radiofield',
|
101
|
+
width: 200,
|
102
|
+
defaults: {
|
103
|
+
flex: 1
|
82
104
|
},
|
83
|
-
layout:'hbox',
|
84
|
-
fieldLabel:'Page Results',
|
85
|
-
toolTip:'Page results.',
|
86
|
-
items:[
|
105
|
+
layout: 'hbox',
|
106
|
+
fieldLabel: 'Page Results',
|
107
|
+
toolTip: 'Page results.',
|
108
|
+
items: [
|
87
109
|
{
|
88
|
-
boxLabel:'Yes',
|
89
|
-
name:'page_results',
|
90
|
-
checked:true,
|
91
|
-
inputValue:'y'
|
110
|
+
boxLabel: 'Yes',
|
111
|
+
name: 'page_results',
|
112
|
+
checked: true,
|
113
|
+
inputValue: 'y'
|
92
114
|
},
|
93
115
|
{
|
94
|
-
boxLabel:'No',
|
95
|
-
name:'page_results',
|
96
|
-
inputValue:'n'
|
116
|
+
boxLabel: 'No',
|
117
|
+
name: 'page_results',
|
118
|
+
inputValue: 'n'
|
97
119
|
}
|
98
120
|
]
|
99
121
|
},
|
100
122
|
{
|
101
|
-
xtype:'textfield',
|
102
|
-
name:'pageSize',
|
103
|
-
value:20,
|
104
|
-
fieldLabel:'Rows per Page'
|
123
|
+
xtype: 'textfield',
|
124
|
+
name: 'pageSize',
|
125
|
+
value: 20,
|
126
|
+
fieldLabel: 'Rows per Page'
|
105
127
|
},
|
106
128
|
{
|
107
|
-
xtype:'textfield',
|
108
|
-
name:'displayMsg',
|
109
|
-
value:'Displaying {0} - {1} of {2}',
|
110
|
-
fieldLabel:'Paging Display Message'
|
129
|
+
xtype: 'textfield',
|
130
|
+
name: 'displayMsg',
|
131
|
+
value: 'Displaying {0} - {1} of {2}',
|
132
|
+
fieldLabel: 'Paging Display Message'
|
111
133
|
},
|
112
134
|
{
|
113
|
-
xtype:'textfield',
|
114
|
-
name:'emptyMsg',
|
115
|
-
value:'Empty',
|
116
|
-
fieldLabel:'Empty Message'
|
135
|
+
xtype: 'textfield',
|
136
|
+
name: 'emptyMsg',
|
137
|
+
value: 'Empty',
|
138
|
+
fieldLabel: 'Empty Message'
|
117
139
|
}
|
118
140
|
]
|
119
141
|
}
|
120
142
|
]
|
121
143
|
}),
|
122
|
-
buttons:[
|
144
|
+
buttons: [
|
123
145
|
{
|
124
146
|
text:'Submit',
|
125
147
|
listeners:{
|
126
148
|
'click':function (button) {
|
127
|
-
var
|
128
|
-
" :grid => {\n",
|
129
|
-
" :title => '{title}',\n",
|
130
|
-
" :width => {width},\n",
|
131
|
-
" :height => {height},\n",
|
132
|
-
" :page => {page_results:this.toBoolean},\n",
|
133
|
-
" :page_size => {pageSize},\n",
|
134
|
-
" :display_msg => '{displayMsg}',\n",
|
135
|
-
" :empty_msg => '{emptyMsg}'\n",
|
136
|
-
" }\n",
|
137
|
-
"} %>",
|
138
|
-
{
|
139
|
-
toBoolean:function (value) {
|
140
|
-
var result = 'false';
|
141
|
-
if (value == 'y') {
|
142
|
-
result = 'true';
|
143
|
-
}
|
144
|
-
return result;
|
145
|
-
}
|
146
|
-
}),
|
147
|
-
content = null,
|
148
|
-
window = button.findParentByType('window'),
|
149
|
+
var window = button.findParentByType('window'),
|
149
150
|
formPanel = window.query('form')[0],
|
150
151
|
grid = formPanel.down('grid'),
|
151
152
|
basicForm = formPanel.getForm(),
|
152
153
|
values = basicForm.getValues();
|
153
154
|
|
154
|
-
content = tpl.apply(values);
|
155
|
-
|
156
155
|
//add rendered template to center region editor
|
157
|
-
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(
|
156
|
+
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(Compass.ErpApp.Widgets.DynamicGrid.template.apply(values));
|
158
157
|
button.up('window').close();
|
159
158
|
}
|
160
159
|
}
|
161
160
|
},
|
162
161
|
{
|
163
|
-
text:'Close',
|
164
|
-
handler:function (btn) {
|
162
|
+
text: 'Close',
|
163
|
+
handler: function (btn) {
|
165
164
|
btn.up('window').close();
|
166
165
|
}
|
167
166
|
}
|
@@ -171,8 +170,8 @@ Compass.ErpApp.Widgets.DynamicGrid = {
|
|
171
170
|
}
|
172
171
|
|
173
172
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
174
|
-
name:'Dynamic Grid',
|
175
|
-
iconUrl:'/images/icons/grid/grid_48x48.png',
|
176
|
-
onClick:Compass.ErpApp.Widgets.DynamicGrid.addWidget,
|
177
|
-
about:'Add grid for dynamic model'
|
173
|
+
name: 'Dynamic Grid',
|
174
|
+
iconUrl: '/images/icons/grid/grid_48x48.png',
|
175
|
+
onClick: Compass.ErpApp.Widgets.DynamicGrid.addWidget,
|
176
|
+
about: 'Add grid for dynamic model'
|
178
177
|
});
|