knitkit 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- 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,10 +1,19 @@
|
|
1
1
|
Compass.ErpApp.Widgets.GoogleMap = {
|
2
|
-
|
2
|
+
template: new Ext.Template("<%= render_widget :google_map,\n",
|
3
|
+
':params => {\n',
|
4
|
+
' :zoom => {zoom},',
|
5
|
+
" :map_type => '{mapType}',",
|
6
|
+
' :drop_pins=[\n{dropPins}\n',
|
7
|
+
"]}%>"),
|
8
|
+
|
9
|
+
dropPinTemplate: new Ext.XTemplate('<tpl for=".">', '{title="{title}", address="{address}"}{[xindex === xcount ? "" : ","]}', '</tpl>'),
|
10
|
+
|
11
|
+
addGoogleMap: function () {
|
3
12
|
|
4
13
|
// Define our data model
|
5
14
|
var GoogleMapAddressModel = Ext.define('GoogleMapAddress', {
|
6
15
|
extend: 'Ext.data.Model',
|
7
|
-
fields: ['title','address']
|
16
|
+
fields: ['title', 'address']
|
8
17
|
});
|
9
18
|
|
10
19
|
// create the Data Store
|
@@ -15,18 +24,20 @@ Compass.ErpApp.Widgets.GoogleMap = {
|
|
15
24
|
proxy: {
|
16
25
|
type: 'memory'
|
17
26
|
},
|
18
|
-
data:[
|
19
|
-
|
20
|
-
|
21
|
-
|
27
|
+
data: [
|
28
|
+
{
|
29
|
+
title: 'TrueNorth.',
|
30
|
+
address: '1 S Orange Ave Orlando, FL 32801'
|
31
|
+
}
|
32
|
+
]
|
22
33
|
});
|
23
34
|
|
24
35
|
|
25
36
|
var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
|
26
37
|
clicksToMoveEditor: 1,
|
27
38
|
autoCancel: false,
|
28
|
-
listeners:{
|
29
|
-
'edit':function(editor, e){
|
39
|
+
listeners: {
|
40
|
+
'edit': function (editor, e) {
|
30
41
|
editor.record.commit();
|
31
42
|
}
|
32
43
|
}
|
@@ -34,142 +45,144 @@ Compass.ErpApp.Widgets.GoogleMap = {
|
|
34
45
|
|
35
46
|
|
36
47
|
var grid = Ext.create('Ext.grid.Panel', {
|
37
|
-
autoDestroy:true,
|
38
|
-
autoScroll:true,
|
39
|
-
region:'center',
|
48
|
+
autoDestroy: true,
|
49
|
+
autoScroll: true,
|
50
|
+
region: 'center',
|
40
51
|
store: store,
|
41
|
-
columns: [
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
tbar: [{
|
58
|
-
text: 'Add Location',
|
59
|
-
iconCls: 'icon-add',
|
60
|
-
handler : function() {
|
61
|
-
rowEditing.cancelEdit();
|
62
|
-
store.insert(0, new GoogleMapAddressModel());
|
63
|
-
rowEditing.startEdit(0, 0);
|
52
|
+
columns: [
|
53
|
+
{
|
54
|
+
header: 'Title',
|
55
|
+
dataIndex: 'title',
|
56
|
+
width: 160,
|
57
|
+
editor: {
|
58
|
+
allowBlank: false
|
59
|
+
}
|
60
|
+
},
|
61
|
+
{
|
62
|
+
header: 'Address',
|
63
|
+
dataIndex: 'address',
|
64
|
+
flex: 1,
|
65
|
+
editor: {
|
66
|
+
allowBlank: false
|
67
|
+
}
|
64
68
|
}
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
69
|
+
],
|
70
|
+
frame: false,
|
71
|
+
tbar: [
|
72
|
+
{
|
73
|
+
text: 'Add Location',
|
74
|
+
iconCls: 'icon-add',
|
75
|
+
handler: function () {
|
76
|
+
rowEditing.cancelEdit();
|
77
|
+
store.insert(0, new GoogleMapAddressModel());
|
78
|
+
rowEditing.startEdit(0, 0);
|
75
79
|
}
|
76
80
|
},
|
77
|
-
|
78
|
-
|
81
|
+
{
|
82
|
+
itemId: 'removelocation',
|
83
|
+
text: 'Remove Location',
|
84
|
+
iconCls: 'icon-delete',
|
85
|
+
handler: function () {
|
86
|
+
var sm = grid.getSelectionModel();
|
87
|
+
rowEditing.cancelEdit();
|
88
|
+
store.remove(sm.getSelection());
|
89
|
+
if (store.getCount() > 0) {
|
90
|
+
sm.select(0);
|
91
|
+
}
|
92
|
+
},
|
93
|
+
disabled: true
|
94
|
+
}
|
95
|
+
],
|
79
96
|
plugins: [rowEditing],
|
80
97
|
listeners: {
|
81
|
-
'selectionchange':function(view, records) {
|
98
|
+
'selectionchange': function (view, records) {
|
82
99
|
grid.down('#removelocation').setDisabled(!records.length);
|
83
100
|
}
|
84
101
|
}
|
85
102
|
});
|
86
|
-
|
87
|
-
var formPanel = Ext.create("Ext.form.Panel",{
|
88
|
-
region:'north',
|
89
|
-
frame:false,
|
90
|
-
bodyStyle:'padding:5px 5px 0',
|
103
|
+
|
104
|
+
var formPanel = Ext.create("Ext.form.Panel", {
|
105
|
+
region: 'north',
|
106
|
+
frame: false,
|
107
|
+
bodyStyle: 'padding:5px 5px 0',
|
91
108
|
items: [
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
109
|
+
{
|
110
|
+
xtype: 'combo',
|
111
|
+
forceSelection: true,
|
112
|
+
store: [
|
113
|
+
['HYBRID', 'HYBRID'],
|
114
|
+
['ROADMAP', 'ROADMAP'],
|
115
|
+
['SATELLITE', 'SATELLITE'],
|
116
|
+
['TERRAIN', 'TERRAIN']
|
117
|
+
],
|
118
|
+
fieldLabel: 'Map Type',
|
119
|
+
value: 'SATELLITE',
|
120
|
+
name: 'mapType',
|
121
|
+
allowBlank: false,
|
122
|
+
triggerAction: 'all'
|
123
|
+
},
|
124
|
+
{
|
125
|
+
xtype: 'numberfield',
|
126
|
+
fieldLabel: 'Zoom',
|
127
|
+
allowBlank: false,
|
128
|
+
value: 18,
|
129
|
+
id: 'zoom'
|
130
|
+
}
|
114
131
|
]
|
115
132
|
});
|
116
133
|
|
117
134
|
|
118
|
-
var addGoogleMapWidgetWindow = Ext.create("Ext.window.Window",{
|
119
|
-
layout:'border',
|
120
|
-
width:500,
|
121
|
-
title:'Add Map Widget',
|
122
|
-
height:350,
|
135
|
+
var addGoogleMapWidgetWindow = Ext.create("Ext.window.Window", {
|
136
|
+
layout: 'border',
|
137
|
+
width: 500,
|
138
|
+
title: 'Add Map Widget',
|
139
|
+
height: 350,
|
123
140
|
plain: true,
|
124
|
-
buttonAlign:'center',
|
125
|
-
items:[formPanel,grid],
|
126
|
-
buttons: [
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
141
|
+
buttonAlign: 'center',
|
142
|
+
items: [formPanel, grid],
|
143
|
+
buttons: [
|
144
|
+
{
|
145
|
+
text: 'Submit',
|
146
|
+
listeners: {
|
147
|
+
'click': function (button) {
|
148
|
+
var window = button.findParentByType('window');
|
149
|
+
var formPanel = window.query('form')[0];
|
150
|
+
var basicForm = formPanel.getForm();
|
151
|
+
var mapType = basicForm.findField('mapType').getValue();
|
152
|
+
var zoom = basicForm.findField('zoom').getValue();
|
135
153
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
154
|
+
var data = {mapType: mapType, zoom: zoom, dropPins: null};
|
155
|
+
var dropPins = [];
|
156
|
+
grid.store.each(function (record) {
|
157
|
+
dropPins.push({
|
158
|
+
title: record.data.title,
|
159
|
+
address: record.data.address
|
160
|
+
})
|
161
|
+
});
|
143
162
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(content);
|
163
|
+
data['dropPins'] = Compass.ErpApp.Widgets.GoogleMap.dropPinTemplate.apply(dropPins);
|
164
|
+
|
165
|
+
var content = Compass.ErpApp.Widgets.GoogleMap.template.apply(data);
|
166
|
+
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(content);
|
167
|
+
addGoogleMapWidgetWindow.close();
|
168
|
+
}
|
169
|
+
}
|
170
|
+
},
|
171
|
+
{
|
172
|
+
text: 'Close',
|
173
|
+
handler: function () {
|
156
174
|
addGoogleMapWidgetWindow.close();
|
157
175
|
}
|
158
176
|
}
|
159
|
-
|
160
|
-
text: 'Close',
|
161
|
-
handler: function(){
|
162
|
-
addGoogleMapWidgetWindow.close();
|
163
|
-
}
|
164
|
-
}]
|
177
|
+
]
|
165
178
|
});
|
166
179
|
addGoogleMapWidgetWindow.show();
|
167
180
|
}
|
168
181
|
}
|
169
182
|
|
170
183
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
171
|
-
name:'Google Map',
|
172
|
-
iconUrl:'/images/icons/map/map_48x48.png',
|
173
|
-
onClick:Compass.ErpApp.Widgets.GoogleMap.addGoogleMap,
|
174
|
-
about:'This widget creates a google map with drop points you setup.'
|
184
|
+
name: 'Google Map',
|
185
|
+
iconUrl: '/images/icons/map/map_48x48.png',
|
186
|
+
onClick: Compass.ErpApp.Widgets.GoogleMap.addGoogleMap,
|
187
|
+
about: 'This widget creates a google map with drop points you setup.'
|
175
188
|
});
|
@@ -13,7 +13,7 @@
|
|
13
13
|
}
|
14
14
|
|
15
15
|
if(!window.mapJsLoaded){
|
16
|
-
|
16
|
+
new OnDemandLoadByAjax().load('http://maps.google.com/maps/api/js?sensor=false&callback=loadMap_<%=@uuid%>');
|
17
17
|
window.mapJsLoaded = true;
|
18
18
|
}
|
19
19
|
else{
|
@@ -1,164 +1,169 @@
|
|
1
1
|
Compass.ErpApp.Widgets.Login = {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
defaults: {
|
14
|
-
width: 225
|
15
|
-
},
|
16
|
-
items: [
|
17
|
-
{
|
18
|
-
xtype: 'combo',
|
19
|
-
forceSelection:true,
|
20
|
-
store: [
|
21
|
-
[':login_header','Header'],
|
22
|
-
[':login_page','Page'],
|
23
|
-
],
|
24
|
-
fieldLabel: 'Widget View',
|
25
|
-
value:':login_page',
|
26
|
-
name: 'widgetLayout',
|
27
|
-
allowBlank: false,
|
28
|
-
triggerAction: 'all',
|
29
|
-
listeners:{
|
30
|
-
change:function(field, newValue, oldValue){
|
31
|
-
var basicForm = field.findParentByType('form').getForm();
|
32
|
-
var loginWidgetLoginToField = basicForm.findField('loginWidgetLoginTo');
|
33
|
-
var loginWidgetLogoutToField = basicForm.findField('loginWidgetLogoutTo');
|
34
|
-
var loginWidgetLoginUrlField = basicForm.findField('loginWidgetLoginUrl');
|
35
|
-
var loginWidgetSignUpUrlField = basicForm.findField('loginWidgetSignUpUrl');
|
36
|
-
var loginWidgetResetPasswordUrlField = basicForm.findField('loginWidgetResetPasswordUrl');
|
37
|
-
if(newValue == ':login_header'){
|
38
|
-
loginWidgetLoginToField.hide();
|
39
|
-
loginWidgetLogoutToField.hide();
|
40
|
-
loginWidgetLoginUrlField.show();
|
41
|
-
loginWidgetResetPasswordUrlField.hide();
|
42
|
-
loginWidgetLoginUrlField.setValue('/login');
|
43
|
-
loginWidgetSignUpUrlField.setValue('/sign-up');
|
44
|
-
loginWidgetResetPasswordUrlField.setValue('/reset-password');
|
45
|
-
}
|
46
|
-
else{
|
47
|
-
loginWidgetLoginToField.show();
|
48
|
-
loginWidgetLogoutToField.show();
|
49
|
-
loginWidgetLoginUrlField.hide();
|
50
|
-
loginWidgetResetPasswordUrlField.show();
|
51
|
-
loginWidgetLoginToField.setValue('/home');
|
52
|
-
loginWidgetLogoutToField.setValue('/home');
|
53
|
-
loginWidgetSignUpUrlField.setValue('/sign-up');
|
54
|
-
}
|
55
|
-
}
|
56
|
-
}
|
57
|
-
},
|
58
|
-
{
|
59
|
-
xtype:'textfield',
|
60
|
-
fieldLabel:'Login To',
|
61
|
-
allowBlank:false,
|
62
|
-
value:'/home',
|
63
|
-
id:'loginWidgetLoginTo'
|
64
|
-
},
|
65
|
-
{
|
66
|
-
xtype:'textfield',
|
67
|
-
fieldLabel:'Logout To',
|
68
|
-
allowBlank:false,
|
69
|
-
value:'/home',
|
70
|
-
id:'loginWidgetLogoutTo'
|
71
|
-
},
|
72
|
-
{
|
73
|
-
xtype:'textfield',
|
74
|
-
fieldLabel:'Login Url',
|
75
|
-
allowBlank:false,
|
76
|
-
hidden:true,
|
77
|
-
value:'/login',
|
78
|
-
id:'loginWidgetLoginUrl'
|
79
|
-
},
|
80
|
-
{
|
81
|
-
xtype:'textfield',
|
82
|
-
toolTip:'Only needed if Signup widget is setup.',
|
83
|
-
fieldLabel:'Sign Up Url',
|
84
|
-
allowBlank:true,
|
85
|
-
value:'/sign-up',
|
86
|
-
id:'loginWidgetSignUpUrl'
|
87
|
-
},
|
88
|
-
{
|
89
|
-
xtype:'textfield',
|
90
|
-
toolTip:'Only needed if Reset Password widget is setup.',
|
91
|
-
fieldLabel:'Reset Password Url',
|
92
|
-
allowBlank:true,
|
93
|
-
hidden:true,
|
94
|
-
value:'/reset-password',
|
95
|
-
id:'loginWidgetResetPasswordUrl'
|
96
|
-
}
|
97
|
-
]
|
98
|
-
}),
|
99
|
-
buttons: [{
|
100
|
-
text:'Submit',
|
101
|
-
listeners:{
|
102
|
-
'click':function(button){
|
103
|
-
var tpl = null;
|
104
|
-
var content = null;
|
105
|
-
var window = button.findParentByType('window');
|
106
|
-
var formPanel = window.query('form')[0];
|
107
|
-
var basicForm = formPanel.getForm();
|
108
|
-
var action = basicForm.findField('widgetLayout').getValue();
|
2
|
+
loginHeaderTemplate: new Ext.Template("<%= render_widget :login,\n",
|
3
|
+
" :action => :login_header,\n",
|
4
|
+
" :params => {:login_url => '{loginWidgetLoginUrl}',\n",
|
5
|
+
" :signup_url => '{loginWidgetSignUpUrl}'}%>"),
|
6
|
+
loginPageTemplate: new Ext.Template("<%= render_widget :login,\n",
|
7
|
+
" :params => {:login_to => '{loginWidgetLoginTo}',\n",
|
8
|
+
" :logout_to => '{loginWidgetLogoutTo}',\n",
|
9
|
+
" #optional field if Sign Up widget is setup\n",
|
10
|
+
" #:signup_url => '{loginWidgetSignUpUrl}',\n",
|
11
|
+
" #optional field if Reset Password widget is setup\n",
|
12
|
+
" #:reset_password_url => '{loginWidgetResetPasswordUrl}'}%>"),
|
109
13
|
|
110
|
-
|
111
|
-
|
112
|
-
var data = {
|
113
|
-
action:action
|
114
|
-
};
|
115
|
-
data.loginWidgetSignUpUrl = loginWidgetSignUpUrlField.getValue();
|
116
|
-
data.loginWidgetResetPasswordUrl = loginWidgetResetPasswordUrlField.getValue();
|
117
|
-
if(action == ':login_header'){
|
118
|
-
var loginWidgetLoginUrlField = basicForm.findField('loginWidgetLoginUrl');
|
119
|
-
data.loginWidgetLoginUrl = loginWidgetLoginUrlField.getValue();
|
120
|
-
tpl = new Ext.XTemplate("<%= render_widget :login,\n",
|
121
|
-
" :action => :login_header,\n",
|
122
|
-
" :params => {:login_url => '{loginWidgetLoginUrl}',\n",
|
123
|
-
" :signup_url => '{loginWidgetSignUpUrl}'}%>");
|
124
|
-
content = tpl.apply(data);
|
125
|
-
}
|
126
|
-
else{
|
127
|
-
var loginWidgetLoginToField = basicForm.findField('loginWidgetLoginTo');
|
128
|
-
var loginWidgetLogoutToField = basicForm.findField('loginWidgetLogoutTo');
|
129
|
-
data.loginWidgetLoginTo = loginWidgetLoginToField.getValue();
|
130
|
-
data.loginWidgetLogoutTo = loginWidgetLogoutToField.getValue();
|
131
|
-
tpl = new Ext.XTemplate("<%= render_widget :login,\n",
|
132
|
-
" :params => {:login_to => '{loginWidgetLoginTo}',\n",
|
133
|
-
" :logout_to => '{loginWidgetLogoutTo}',\n",
|
134
|
-
" #optional field if Sign Up widget is setup\n",
|
135
|
-
" #:signup_url => '{loginWidgetSignUpUrl}',\n",
|
136
|
-
" #optional field if Reset Password widget is setup\n",
|
137
|
-
" #:reset_password_url => '{loginWidgetResetPasswordUrl}'}%>");
|
138
|
-
content = tpl.apply(data);
|
139
|
-
}
|
14
|
+
addLogin: function () {
|
15
|
+
var self = this;
|
140
16
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
17
|
+
var addLoginWidgetWindow = Ext.create("Ext.window.Window", {
|
18
|
+
layout: 'fit',
|
19
|
+
width: 375,
|
20
|
+
title: 'Add Login Widget',
|
21
|
+
plain: true,
|
22
|
+
buttonAlign: 'center',
|
23
|
+
items: Ext.create("Ext.form.Panel", {
|
24
|
+
labelWidth: 100,
|
25
|
+
frame: false,
|
26
|
+
bodyStyle: 'padding:5px 5px 0',
|
27
|
+
defaults: {
|
28
|
+
width: 225
|
29
|
+
},
|
30
|
+
items: [
|
31
|
+
{
|
32
|
+
xtype: 'combo',
|
33
|
+
forceSelection: true,
|
34
|
+
store: [
|
35
|
+
[':login_header', 'Header'],
|
36
|
+
[':login_page', 'Page']
|
37
|
+
],
|
38
|
+
fieldLabel: 'Widget View',
|
39
|
+
value: ':login_page',
|
40
|
+
name: 'widgetLayout',
|
41
|
+
allowBlank: false,
|
42
|
+
triggerAction: 'all',
|
43
|
+
listeners: {
|
44
|
+
change: function (field, newValue, oldValue) {
|
45
|
+
var basicForm = field.findParentByType('form').getForm();
|
46
|
+
var loginWidgetLoginToField = basicForm.findField('loginWidgetLoginTo');
|
47
|
+
var loginWidgetLogoutToField = basicForm.findField('loginWidgetLogoutTo');
|
48
|
+
var loginWidgetLoginUrlField = basicForm.findField('loginWidgetLoginUrl');
|
49
|
+
var loginWidgetSignUpUrlField = basicForm.findField('loginWidgetSignUpUrl');
|
50
|
+
var loginWidgetResetPasswordUrlField = basicForm.findField('loginWidgetResetPasswordUrl');
|
51
|
+
if (newValue == ':login_header') {
|
52
|
+
loginWidgetLoginToField.hide();
|
53
|
+
loginWidgetLogoutToField.hide();
|
54
|
+
loginWidgetLoginUrlField.show();
|
55
|
+
loginWidgetResetPasswordUrlField.hide();
|
56
|
+
loginWidgetLoginUrlField.setValue('/login');
|
57
|
+
loginWidgetSignUpUrlField.setValue('/sign-up');
|
58
|
+
loginWidgetResetPasswordUrlField.setValue('/reset-password');
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
loginWidgetLoginToField.show();
|
62
|
+
loginWidgetLogoutToField.show();
|
63
|
+
loginWidgetLoginUrlField.hide();
|
64
|
+
loginWidgetResetPasswordUrlField.show();
|
65
|
+
loginWidgetLoginToField.setValue('/home');
|
66
|
+
loginWidgetLogoutToField.setValue('/home');
|
67
|
+
loginWidgetSignUpUrlField.setValue('/sign-up');
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
},
|
72
|
+
{
|
73
|
+
xtype: 'textfield',
|
74
|
+
fieldLabel: 'Login To',
|
75
|
+
allowBlank: false,
|
76
|
+
value: '/home',
|
77
|
+
id: 'loginWidgetLoginTo'
|
78
|
+
},
|
79
|
+
{
|
80
|
+
xtype: 'textfield',
|
81
|
+
fieldLabel: 'Logout To',
|
82
|
+
allowBlank: false,
|
83
|
+
value: '/home',
|
84
|
+
id: 'loginWidgetLogoutTo'
|
85
|
+
},
|
86
|
+
{
|
87
|
+
xtype: 'textfield',
|
88
|
+
fieldLabel: 'Login Url',
|
89
|
+
allowBlank: false,
|
90
|
+
hidden: true,
|
91
|
+
value: '/login',
|
92
|
+
id: 'loginWidgetLoginUrl'
|
93
|
+
},
|
94
|
+
{
|
95
|
+
xtype: 'textfield',
|
96
|
+
toolTip: 'Only needed if Signup widget is setup.',
|
97
|
+
fieldLabel: 'Sign Up Url',
|
98
|
+
allowBlank: true,
|
99
|
+
value: '/sign-up',
|
100
|
+
id: 'loginWidgetSignUpUrl'
|
101
|
+
},
|
102
|
+
{
|
103
|
+
xtype: 'textfield',
|
104
|
+
toolTip: 'Only needed if Reset Password widget is setup.',
|
105
|
+
fieldLabel: 'Reset Password Url',
|
106
|
+
allowBlank: true,
|
107
|
+
hidden: true,
|
108
|
+
value: '/reset-password',
|
109
|
+
id: 'loginWidgetResetPasswordUrl'
|
110
|
+
}
|
111
|
+
]
|
112
|
+
}),
|
113
|
+
buttons: [
|
114
|
+
{
|
115
|
+
text: 'Submit',
|
116
|
+
listeners: {
|
117
|
+
'click': function (button) {
|
118
|
+
var content = null;
|
119
|
+
var window = button.findParentByType('window');
|
120
|
+
var formPanel = window.query('form')[0];
|
121
|
+
var basicForm = formPanel.getForm();
|
122
|
+
var action = basicForm.findField('widgetLayout').getValue();
|
123
|
+
|
124
|
+
var loginWidgetSignUpUrlField = basicForm.findField('loginWidgetSignUpUrl');
|
125
|
+
var loginWidgetResetPasswordUrlField = basicForm.findField('loginWidgetResetPasswordUrl');
|
126
|
+
var data = {
|
127
|
+
action: action
|
128
|
+
};
|
129
|
+
data.loginWidgetSignUpUrl = loginWidgetSignUpUrlField.getValue();
|
130
|
+
data.loginWidgetResetPasswordUrl = loginWidgetResetPasswordUrlField.getValue();
|
131
|
+
if (action == ':login_header') {
|
132
|
+
var loginWidgetLoginUrlField = basicForm.findField('loginWidgetLoginUrl');
|
133
|
+
data.loginWidgetLoginUrl = loginWidgetLoginUrlField.getValue();
|
134
|
+
content = Compass.ErpApp.Widgets.Login.loginHeaderTemplate.apply(data);
|
135
|
+
}
|
136
|
+
else {
|
137
|
+
var loginWidgetLoginToField = basicForm.findField('loginWidgetLoginTo');
|
138
|
+
var loginWidgetLogoutToField = basicForm.findField('loginWidgetLogoutTo');
|
139
|
+
data.loginWidgetLoginTo = loginWidgetLoginToField.getValue();
|
140
|
+
data.loginWidgetLogoutTo = loginWidgetLogoutToField.getValue();
|
141
|
+
content = Compass.ErpApp.Widgets.Login.loginPageTemplate.apply(data);
|
142
|
+
}
|
143
|
+
|
144
|
+
//add rendered template to center region editor
|
145
|
+
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(content);
|
146
|
+
addLoginWidgetWindow.close();
|
147
|
+
}
|
148
|
+
}
|
149
|
+
},
|
150
|
+
{
|
151
|
+
text: 'Close',
|
152
|
+
handler: function () {
|
153
|
+
addLoginWidgetWindow.close();
|
154
|
+
}
|
155
|
+
}
|
156
|
+
]
|
157
|
+
});
|
158
|
+
addLoginWidgetWindow.show();
|
159
|
+
}
|
155
160
|
}
|
156
161
|
|
157
162
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
163
|
+
name: 'Login',
|
164
|
+
iconUrl: '/images/icons/key/key_48x48.png',
|
165
|
+
onClick: Compass.ErpApp.Widgets.Login.addLogin,
|
166
|
+
about: 'This widget creates a login form to allow users to log into the website.'
|
162
167
|
});
|
163
168
|
|
164
169
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Compass.ErpApp.Widgets.ManageProfile = {
|
2
|
+
template: new Ext.Template('<%= render_widget :manage_profile %>'),
|
3
|
+
|
2
4
|
addManageProfile:function(){
|
3
|
-
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(
|
5
|
+
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(Compass.ErpApp.Widgets.ManageProfile.template.apply());
|
4
6
|
}
|
5
7
|
}
|
6
8
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Compass.ErpApp.Widgets.ResetPassword = {
|
2
|
+
template: new Ext.Template('<%= render_widget :reset_password, :params => {:login_url => "/login"}%>'),
|
3
|
+
|
2
4
|
addResetPassword:function(){
|
3
|
-
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(
|
5
|
+
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(Compass.ErpApp.Widgets.ResetPassword.template.apply());
|
4
6
|
}
|
5
7
|
}
|
6
8
|
|