netzke-basepack 0.12.9 → 1.0.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +75 -44
- data/Gemfile +4 -2
- data/LICENSE +2 -6
- data/README.md +22 -24
- data/javascripts/basepack.js +0 -8
- data/javascripts/{columns.js → grid/columns.js} +59 -71
- data/javascripts/grid/event_handlers.js +218 -0
- data/javascripts/netzkeremotecombo.js +5 -13
- data/javascripts/tristate.js +62 -0
- data/javascripts/xdatetime.js +8 -37
- data/lib/netzke-basepack.rb +3 -2
- data/lib/netzke/basepack.rb +1 -1
- data/lib/netzke/basepack/action_column.rb +6 -23
- data/lib/netzke/basepack/active_record.rb +0 -6
- data/lib/netzke/basepack/attr_config.rb +20 -11
- data/lib/netzke/basepack/attribute_config.rb +10 -0
- data/lib/netzke/basepack/attributes.rb +196 -0
- data/lib/netzke/basepack/column_config.rb +47 -39
- data/lib/netzke/basepack/columns.rb +127 -97
- data/lib/netzke/basepack/data_accessor.rb +7 -48
- data/lib/netzke/basepack/data_adapters/abstract_adapter.rb +15 -17
- data/lib/netzke/basepack/data_adapters/active_record_adapter.rb +111 -90
- data/lib/netzke/basepack/dynamic_tab_panel.rb +3 -5
- data/lib/netzke/basepack/dynamic_tab_panel/{javascripts → client}/dynamic_tab_panel.js +6 -5
- data/lib/netzke/basepack/field_config.rb +30 -19
- data/lib/netzke/basepack/fields.rb +22 -12
- data/lib/netzke/basepack/grid_live_search.rb +1 -4
- data/lib/netzke/basepack/grid_live_search/{javascripts → client}/grid_live_search.js +9 -7
- data/lib/netzke/basepack/item_persistence.rb +3 -3
- data/lib/netzke/basepack/item_persistence/events_plugin.rb +8 -10
- data/lib/netzke/basepack/paging_form.rb +7 -11
- data/lib/netzke/basepack/paging_form/{javascripts → client}/paging_form.js +4 -4
- data/lib/netzke/basepack/query_builder.rb +12 -10
- data/lib/netzke/basepack/query_builder/{javascripts → client}/query_builder.js +14 -12
- data/lib/netzke/basepack/record_form_window.rb +8 -8
- data/lib/netzke/basepack/search_panel.rb +4 -6
- data/lib/netzke/basepack/search_panel/{javascripts → client}/condition_field.js +13 -16
- data/lib/netzke/basepack/search_panel/{javascripts → client}/search_panel.js +7 -7
- data/lib/netzke/basepack/search_window.rb +6 -6
- data/lib/netzke/basepack/simple_app/{javascripts → client}/statusbar_ext.js +0 -0
- data/lib/netzke/basepack/version.rb +1 -1
- data/lib/netzke/form/base.rb +166 -0
- data/lib/netzke/{basepack/form/javascripts/form.js → form/base/client/base.js} +77 -38
- data/lib/netzke/form/base/client/readonly_mode.css +4 -0
- data/lib/netzke/{basepack/form/javascripts → form/base/client}/readonly_mode.js +5 -5
- data/lib/netzke/form/endpoints.rb +33 -0
- data/lib/netzke/form/services.rb +74 -0
- data/lib/netzke/grid/actions.rb +52 -0
- data/lib/netzke/grid/base.rb +289 -0
- data/lib/netzke/{basepack/grid/javascripts → grid/base/client}/advanced_search.js +5 -1
- data/lib/netzke/{basepack/grid/javascripts/grid.js → grid/base/client/base.js} +61 -53
- data/lib/netzke/{basepack/grid/javascripts → grid/base/client}/extensions.js +19 -13
- data/lib/netzke/{basepack/grid/javascripts → grid/base/client}/remember_selection.js +0 -1
- data/lib/netzke/grid/client.rb +8 -0
- data/lib/netzke/grid/components.rb +55 -0
- data/lib/netzke/grid/configuration.rb +72 -0
- data/lib/netzke/grid/endpoints.rb +99 -0
- data/lib/netzke/grid/permissions.rb +18 -0
- data/lib/netzke/grid/services.rb +141 -0
- data/lib/netzke/tree/base.rb +173 -0
- data/lib/netzke/{basepack/tree/javascripts/tree.js → tree/base/client/base.js} +55 -26
- data/lib/netzke/{basepack/tree/javascripts → tree/base/client}/extensions.js +7 -7
- data/lib/netzke/tree/endpoints.rb +34 -0
- data/lib/netzke/{basepack/viewport.rb → viewport/base.rb} +3 -3
- data/lib/netzke/{basepack/window.rb → window/base.rb} +7 -8
- data/lib/netzke/window/base/client/base.js +26 -0
- data/locales/de.yml +49 -33
- data/locales/en.yml +32 -39
- data/locales/es.yml +39 -25
- data/locales/nl.yml +39 -25
- data/locales/ru.yml +38 -25
- data/locales/uk.yml +40 -26
- data/stylesheets/basepack.css +10 -0
- metadata +48 -45
- data/javascripts/mixins/grid_event_handlers.js +0 -139
- data/lib/netzke/basepack/accordion.rb +0 -45
- data/lib/netzke/basepack/active_record/relation_extensions.rb +0 -27
- data/lib/netzke/basepack/form.rb +0 -131
- data/lib/netzke/basepack/form/endpoints.rb +0 -35
- data/lib/netzke/basepack/form/services.rb +0 -74
- data/lib/netzke/basepack/form/stylesheets/readonly_mode.css +0 -14
- data/lib/netzke/basepack/grid.rb +0 -570
- data/lib/netzke/basepack/grid/endpoints.rb +0 -111
- data/lib/netzke/basepack/grid/javascripts/edit_in_form.js +0 -51
- data/lib/netzke/basepack/grid/services.rb +0 -148
- data/lib/netzke/basepack/tab_panel.rb +0 -22
- data/lib/netzke/basepack/tab_panel/javascripts/tab_panel.js +0 -11
- data/lib/netzke/basepack/tree.rb +0 -269
- data/lib/netzke/basepack/window/javascripts/window.js +0 -26
- data/lib/netzke/basepack/wrap_lazy_loaded.rb +0 -29
@@ -0,0 +1,218 @@
|
|
1
|
+
/**
|
2
|
+
* Event handlers for grid-like components, gets mixed into `Netzke.Grid.Base` and `Netzke.Tree.Base`
|
3
|
+
* @class Netzke.Grid.EventHandlers
|
4
|
+
*/
|
5
|
+
Ext.define("Netzke.Grid.EventHandlers", {
|
6
|
+
// Handler for the 'add' button
|
7
|
+
netzkeOnAdd: function(){
|
8
|
+
if (!this.editInline) {
|
9
|
+
this.netzkeOnAddInForm();
|
10
|
+
} else {
|
11
|
+
// Note: default values are taken from the model's field's defaultValue property
|
12
|
+
var r = Ext.create(this.store.getModel(), {});
|
13
|
+
|
14
|
+
r.isNew = true; // to distinguish new records
|
15
|
+
|
16
|
+
this.getStore().add(r);
|
17
|
+
|
18
|
+
this.netzkeTryStartEditing(r);
|
19
|
+
}
|
20
|
+
},
|
21
|
+
|
22
|
+
netzkeOnDelete: function() {
|
23
|
+
Ext.Msg.confirm(this.i18n.confirmation, this.i18n.areYouSure, function(btn){
|
24
|
+
if (btn == 'yes') {
|
25
|
+
var toDelete = this.getSelectionModel().getSelection();
|
26
|
+
this.server.destroy(toDelete.map(function(r) { return r.id; }), function(res){
|
27
|
+
var errors = [];
|
28
|
+
for (var id in res) {
|
29
|
+
var error;
|
30
|
+
if (error = res[id].error) {
|
31
|
+
errors.push(error);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
if (errors.length > 0) {
|
36
|
+
this.netzkeNotify(errors);
|
37
|
+
}
|
38
|
+
});
|
39
|
+
this.netzkeReloadStore();
|
40
|
+
}
|
41
|
+
}, this);
|
42
|
+
},
|
43
|
+
|
44
|
+
netzkeOnApply: function(){
|
45
|
+
this.getStore().sync();
|
46
|
+
},
|
47
|
+
|
48
|
+
// Handlers for tools
|
49
|
+
//
|
50
|
+
|
51
|
+
netzkeOnRefreshTool: function() {
|
52
|
+
if (this.fireEvent('netzkerefresh', this) !== false) {
|
53
|
+
this.netzkeReloadStore();
|
54
|
+
}
|
55
|
+
},
|
56
|
+
|
57
|
+
// Event handlers
|
58
|
+
//
|
59
|
+
|
60
|
+
netzkeOnItemContextMenu: function(grid, record, item, rowIndex, e){
|
61
|
+
e.stopEvent();
|
62
|
+
var coords = e.getXY();
|
63
|
+
|
64
|
+
this.getSelectionModel().select(record, true);
|
65
|
+
|
66
|
+
var menu = new Ext.menu.Menu({
|
67
|
+
items: this.contextMenu
|
68
|
+
});
|
69
|
+
|
70
|
+
menu.showAt(coords);
|
71
|
+
},
|
72
|
+
|
73
|
+
netzkeOnAfterRowMove: function(dt, oldIndex, newIndex, records){
|
74
|
+
var ids = [];
|
75
|
+
// collect records ids
|
76
|
+
Ext.each(records, function(r){ids.push(r.id)});
|
77
|
+
// call Grid's API
|
78
|
+
this.server.moveRows({ids: Ext.encode(ids), new_index: newIndex});
|
79
|
+
},
|
80
|
+
|
81
|
+
/* Exception handler. TODO: will responses with status 200 land here? */
|
82
|
+
loadExceptionHandler: function(proxy, response, operation){
|
83
|
+
Netzke.warning('Server exception occured. Override loadExceptionHandler, or catch globally by listenning to exception event of Netzke.directProvider');
|
84
|
+
},
|
85
|
+
|
86
|
+
netzkeOnEdit: function(){
|
87
|
+
var selection = this.getSelectionModel().getSelection();
|
88
|
+
if (selection.length == 1) {
|
89
|
+
this.doEdit(selection[0]);
|
90
|
+
} else {
|
91
|
+
this.doMultiEdit(selection);
|
92
|
+
}
|
93
|
+
},
|
94
|
+
|
95
|
+
// Not a very clean approach to clean-up. The problem is that this way the advanced search functionality stops being really pluggable. With Ext JS 4 find the way to make it truely so.
|
96
|
+
netzkeOnDestroy: function(){
|
97
|
+
this.callParent();
|
98
|
+
|
99
|
+
// Destroy the search window (here's the problem: we are not supposed to know it exists)
|
100
|
+
if (this.searchWindow) {
|
101
|
+
this.searchWindow.destroy();
|
102
|
+
}
|
103
|
+
},
|
104
|
+
|
105
|
+
netzkeOnAddInForm: function(){
|
106
|
+
this.netzkeLoadComponent("add_window", {
|
107
|
+
callback: function(w) {
|
108
|
+
w.show();
|
109
|
+
w.on('close', function(){
|
110
|
+
if (w.closeRes === "ok") {
|
111
|
+
this.netzkeReloadStore();
|
112
|
+
}
|
113
|
+
}, this);
|
114
|
+
}
|
115
|
+
});
|
116
|
+
},
|
117
|
+
|
118
|
+
// Edit single record
|
119
|
+
doEdit: function(record){
|
120
|
+
if (this.editInline) {
|
121
|
+
this.doEditInline(record);
|
122
|
+
} else {
|
123
|
+
this.doEditInForm(record);
|
124
|
+
}
|
125
|
+
},
|
126
|
+
|
127
|
+
// Edit multiple records via form
|
128
|
+
doMultiEdit: function(records){
|
129
|
+
this.netzkeLoadComponent("multiedit_window", {
|
130
|
+
callback: function(w){
|
131
|
+
var form = w.items.first();
|
132
|
+
// +apply+ is called by wrapping window on OK click
|
133
|
+
form.on('apply', function(){
|
134
|
+
var ids = [];
|
135
|
+
Ext.each(records, function(r){
|
136
|
+
ids.push(r.getId());
|
137
|
+
});
|
138
|
+
if (!form.baseParams) form.baseParams = {};
|
139
|
+
form.baseParams.ids = Ext.encode(ids);
|
140
|
+
}, this);
|
141
|
+
|
142
|
+
w.on('close', function(){
|
143
|
+
if (w.closeRes === "ok") {
|
144
|
+
this.netzkeReloadStore();
|
145
|
+
}
|
146
|
+
}, this);
|
147
|
+
}
|
148
|
+
});
|
149
|
+
},
|
150
|
+
|
151
|
+
// Edit record inline
|
152
|
+
doEditInline: function(record){
|
153
|
+
this.netzkeTryStartEditing(record);
|
154
|
+
},
|
155
|
+
|
156
|
+
// Single record editing
|
157
|
+
doEditInForm: function(record){
|
158
|
+
this.netzkeLoadComponent("edit_window", {
|
159
|
+
serverConfig: {record_id: record.id},
|
160
|
+
callback: function(w){
|
161
|
+
w.show();
|
162
|
+
w.on('close', function(){
|
163
|
+
if (w.closeRes === "ok") {
|
164
|
+
this.netzkeReloadStore();
|
165
|
+
}
|
166
|
+
}, this);
|
167
|
+
}});
|
168
|
+
},
|
169
|
+
|
170
|
+
netzkeReloadStore: function(){
|
171
|
+
var store = this.getStore();
|
172
|
+
|
173
|
+
// HACK to work around buffered store's buggy reload()
|
174
|
+
if (!store.lastRequestStart) {
|
175
|
+
store.load();
|
176
|
+
} else store.reload();
|
177
|
+
},
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Process selectionchange event to enable/disable actions.
|
181
|
+
* @method netzkeSetActionEvents
|
182
|
+
* @private
|
183
|
+
*/
|
184
|
+
netzkeSetActionEvents: function(){
|
185
|
+
this.getSelectionModel().on('selectionchange', function(selModel, selected){
|
186
|
+
if (this.actions.delete) this.actions.delete.setDisabled(selected.length == 0);
|
187
|
+
if (this.actions.edit) {
|
188
|
+
var disabled = false;
|
189
|
+
Ext.each(selected, function(r){
|
190
|
+
if (r.isNew) { disabled = true; return false; }
|
191
|
+
});
|
192
|
+
this.actions.edit.setDisabled(selected.length == 0 || disabled);
|
193
|
+
}
|
194
|
+
}, this);
|
195
|
+
},
|
196
|
+
|
197
|
+
/**
|
198
|
+
* Loads edit form if editing in form is possible.
|
199
|
+
* @method netzkeHandleItemdblclick
|
200
|
+
*/
|
201
|
+
netzkeHandleItemdblclick: function(view, record){
|
202
|
+
if (this.editInline) return;
|
203
|
+
|
204
|
+
if ((this.permissions || {}).update !== false) {
|
205
|
+
this.doEditInForm(record);
|
206
|
+
}
|
207
|
+
},
|
208
|
+
|
209
|
+
netzkeOnColumnAction: function(self, i, j, options){
|
210
|
+
var handlerName = "netzkeOn" + options.passedHandler;
|
211
|
+
var f = this[handlerName];
|
212
|
+
if (Ext.isFunction(f)) {
|
213
|
+
f.apply(this, arguments);
|
214
|
+
} else {
|
215
|
+
Netzke.warning("Undefined handler '"+handlerName+"'");
|
216
|
+
}
|
217
|
+
},
|
218
|
+
});
|
@@ -8,24 +8,16 @@ Ext.define('Ext.netzke.ComboBox', {
|
|
8
8
|
forceSelection: true,
|
9
9
|
|
10
10
|
initComponent : function(){
|
11
|
-
var parent = this.netzkeParent || this.findParentBy(function(c) { return c.isNetzke; })
|
12
|
-
modelName = parent.id + "_" + this.name;
|
11
|
+
var parent = this.netzkeParent || this.findParentBy(function(c) { return c.isNetzke; });
|
13
12
|
|
14
13
|
if (this.blankLine == undefined) this.blankLine = "---";
|
15
14
|
|
16
|
-
if (!Netzke.isModelDefined(modelName)) {
|
17
|
-
Ext.define(Netzke.modelName(modelName), {
|
18
|
-
extend: 'Ext.data.Model',
|
19
|
-
fields: ['value', 'text']
|
20
|
-
});
|
21
|
-
};
|
22
|
-
|
23
15
|
var store = new Ext.data.Store({
|
24
|
-
|
16
|
+
fields: ['value', 'text'],
|
25
17
|
proxy: {
|
26
18
|
type: 'direct',
|
27
|
-
directFn:
|
28
|
-
extraParams: {configs: parent.
|
19
|
+
directFn: parent.netzkeGetDirectFunction("getComboboxOptions"),
|
20
|
+
extraParams: {configs: parent.netzkeBuildParentConfigs()},
|
29
21
|
reader: {
|
30
22
|
type: 'array',
|
31
23
|
rootProperty: 'data'
|
@@ -41,7 +33,7 @@ Ext.define('Ext.netzke.ComboBox', {
|
|
41
33
|
if (this.blankLine) {
|
42
34
|
store.on('load', function(self, params) {
|
43
35
|
// append a selectable "empty line" which will allow remove the association
|
44
|
-
self.add(Ext.create(
|
36
|
+
self.add(Ext.create(store.getModel(), {value: -1, text: this.blankLine}));
|
45
37
|
}, this);
|
46
38
|
}
|
47
39
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
Ext.define('Ext.netzke.Tristate', {
|
2
|
+
extend: 'Ext.form.FieldContainer',
|
3
|
+
alias: 'widget.netzketristate',
|
4
|
+
layout: 'hbox',
|
5
|
+
|
6
|
+
mixins: {
|
7
|
+
field: 'Ext.form.field.Field'
|
8
|
+
},
|
9
|
+
|
10
|
+
setValue: function(value){
|
11
|
+
if (this.value != value) this.triggerValue(value);
|
12
|
+
},
|
13
|
+
|
14
|
+
getValue: function(){
|
15
|
+
return this.value == undefined ? "" : this.value;
|
16
|
+
},
|
17
|
+
|
18
|
+
items: [{
|
19
|
+
xtype: 'menucheckitem',
|
20
|
+
checked: true,
|
21
|
+
text: ' ',
|
22
|
+
itemId: 'item-true',
|
23
|
+
cls: "x-btn-default-toolbar-small nz-btn-tristate",
|
24
|
+
activeCls: "",
|
25
|
+
listeners: {
|
26
|
+
render: function(){
|
27
|
+
var el = this.getEl(), me = this;
|
28
|
+
el.on('click', function(e){
|
29
|
+
e.preventDefault();
|
30
|
+
me.ownerCt.triggerValue(true);
|
31
|
+
})
|
32
|
+
}
|
33
|
+
}
|
34
|
+
},{
|
35
|
+
xtype: 'menucheckitem',
|
36
|
+
checked: false,
|
37
|
+
itemId: 'item-false',
|
38
|
+
text: ' ',
|
39
|
+
cls: "x-btn-default-toolbar-small nz-btn-tristate",
|
40
|
+
activeCls: "",
|
41
|
+
listeners: {
|
42
|
+
render: function(){
|
43
|
+
var el = this.getEl(), me = this;
|
44
|
+
el.on('click', function(e){
|
45
|
+
e.preventDefault();
|
46
|
+
me.ownerCt.triggerValue(false);
|
47
|
+
})
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}],
|
51
|
+
|
52
|
+
triggerValue: function(val){
|
53
|
+
if (this.value == val) {
|
54
|
+
this.getComponent("item-" + val).removeCls('nz-tristate-selected');
|
55
|
+
this.value = undefined;
|
56
|
+
} else {
|
57
|
+
this.getComponent("item-" + val).addCls('nz-tristate-selected');
|
58
|
+
this.getComponent("item-" + !val).removeCls('nz-tristate-selected');
|
59
|
+
this.value = val;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
});
|
data/javascripts/xdatetime.js
CHANGED
@@ -1,13 +1,4 @@
|
|
1
|
-
|
2
|
-
* @class Ext.ux.form.field.DateTime
|
3
|
-
* @extends Ext.form.FieldContainer
|
4
|
-
* @version 0.2 (July 20th, 2011)
|
5
|
-
* @author atian25 (http://www.sencha.com/forum/member.php?51682-atian25)
|
6
|
-
* @author ontho (http://www.sencha.com/forum/member.php?285806-ontho)
|
7
|
-
* @author jakob.ketterl (http://www.sencha.com/forum/member.php?25102-jakob.ketterl)
|
8
|
-
* @link http://www.sencha.com/forum/showthread.php?134345-Ext.ux.form.field.DateTime
|
9
|
-
* from http://www.sencha.com/forum/showthread.php?134345-Ext.ux.form.field.DateTime&p=863449&viewfull=1#post863449
|
10
|
-
*/
|
1
|
+
// From http://www.sencha.com/forum/showthread.php?134345-Ext.ux.form.field.DateTime&p=863449&viewfull=1#post863449
|
11
2
|
Ext.define('Ext.ux.form.field.DateTime', {
|
12
3
|
extend:'Ext.form.FieldContainer',
|
13
4
|
mixins:{
|
@@ -22,52 +13,35 @@ Ext.define('Ext.ux.form.field.DateTime', {
|
|
22
13
|
layout: 'hbox',
|
23
14
|
readOnly: false,
|
24
15
|
|
25
|
-
|
26
|
-
* @cfg {String} dateFormat
|
16
|
+
/*
|
27
17
|
* Convenience config for specifying the format of the date portion.
|
28
18
|
* This value is overridden if format is specified in the dateConfig.
|
29
19
|
* The default is 'Y-m-d'
|
30
20
|
*/
|
31
21
|
dateFormat: 'Y-m-d',
|
32
22
|
dateSubmitFormat: 'Y-m-d',
|
33
|
-
|
34
|
-
* @cfg {String} timeFormat
|
23
|
+
/*
|
35
24
|
* Convenience config for specifying the format of the time portion.
|
36
25
|
* This value is overridden if format is specified in the timeConfig.
|
37
26
|
* The default is 'H:i:s'
|
38
27
|
*/
|
39
28
|
timeFormat: 'H:i:s',
|
40
|
-
timeSubmitFormat: 'H:i:s',
|
41
|
-
|
42
|
-
// * @cfg {String} dateTimeFormat
|
43
|
-
// * The format used when submitting the combined value.
|
44
|
-
// * Defaults to 'Y-m-d H:i:s'
|
45
|
-
// */
|
46
|
-
// dateTimeFormat: 'Y-m-d H:i:s',
|
47
|
-
/**
|
29
|
+
timeSubmitFormat: 'H:i:s',
|
30
|
+
/*
|
48
31
|
* @cfg {Object} dateConfig
|
49
32
|
* Additional config options for the date field.
|
50
33
|
*/
|
51
34
|
dateConfig:{},
|
52
|
-
|
35
|
+
/*
|
53
36
|
* @cfg {Object} timeConfig
|
54
37
|
* Additional config options for the time field.
|
55
38
|
*/
|
56
39
|
timeConfig:{},
|
57
40
|
|
58
|
-
|
59
41
|
// properties
|
60
42
|
|
61
43
|
dateValue: null, // Holds the actual date
|
62
|
-
/**
|
63
|
-
* @property dateField
|
64
|
-
* @type Ext.form.field.Date
|
65
|
-
*/
|
66
44
|
dateField: null,
|
67
|
-
/**
|
68
|
-
* @property timeField
|
69
|
-
* @type Ext.form.field.Time
|
70
|
-
*/
|
71
45
|
timeField: null,
|
72
46
|
|
73
47
|
initComponent: function(){
|
@@ -83,7 +57,7 @@ Ext.define('Ext.ux.form.field.DateTime', {
|
|
83
57
|
flex:1,
|
84
58
|
isFormField:false, //exclude from field query's
|
85
59
|
submitValue:false,
|
86
|
-
submitFormat: me.dateSubmitFormat,
|
60
|
+
submitFormat: me.dateSubmitFormat,
|
87
61
|
readOnly: me.readOnly
|
88
62
|
}, me.dateConfig));
|
89
63
|
me.items.push(me.dateField);
|
@@ -166,14 +140,11 @@ Ext.define('Ext.ux.form.field.DateTime', {
|
|
166
140
|
},
|
167
141
|
|
168
142
|
getSubmitValue: function(){
|
169
|
-
// var value = this.getValue();
|
170
|
-
// return value ? Ext.Date.format(value, this.dateTimeFormat) : null;
|
171
|
-
|
172
143
|
var me = this
|
173
144
|
,format = me.getFormat()
|
174
145
|
,value = me.getValue();
|
175
146
|
|
176
|
-
return value ? Ext.Date.format(value, format) :
|
147
|
+
return value ? Ext.Date.format(value, format) : "";
|
177
148
|
},
|
178
149
|
|
179
150
|
setValue: function(value){
|
data/lib/netzke-basepack.rb
CHANGED
@@ -8,8 +8,9 @@ module Netzke
|
|
8
8
|
module Basepack
|
9
9
|
class Engine < ::Rails::Engine
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
# load Basepack locale files
|
12
|
+
Dir[File.dirname(__FILE__) + "/../locales/*.yml"].each do |file|
|
13
|
+
I18n.load_path << file
|
13
14
|
end
|
14
15
|
|
15
16
|
# Make components and modules auto-loadable
|
data/lib/netzke/basepack.rb
CHANGED
@@ -18,7 +18,7 @@ module Netzke
|
|
18
18
|
class << self
|
19
19
|
# Called from netzke-basepack.rb
|
20
20
|
def init
|
21
|
-
%w[netzkeremotecombo xdatetime basepack columns
|
21
|
+
%w[tristate netzkeremotecombo xdatetime basepack grid/columns grid/event_handlers].each do |name|
|
22
22
|
Netzke::Core.ext_javascripts << "#{File.dirname(__FILE__)}/../../javascripts/#{name}.js"
|
23
23
|
end
|
24
24
|
|
@@ -3,7 +3,7 @@ module Netzke
|
|
3
3
|
# An extension for {Grid} that allows specifying (multiple) action columns.
|
4
4
|
# Example:
|
5
5
|
#
|
6
|
-
# class Books < Netzke::
|
6
|
+
# class Books < Netzke::Grid::Base
|
7
7
|
# include Netzke::Basepack::ActionColumn
|
8
8
|
#
|
9
9
|
# def configure(c)
|
@@ -25,7 +25,7 @@ module Netzke
|
|
25
25
|
# ]
|
26
26
|
# end
|
27
27
|
#
|
28
|
-
#
|
28
|
+
# client_class do |c|
|
29
29
|
# # handler for column action 'delete_row'
|
30
30
|
# c.on_delete_row = <<-JS
|
31
31
|
# function(record){
|
@@ -39,12 +39,11 @@ module Netzke
|
|
39
39
|
extend ActiveSupport::Concern
|
40
40
|
|
41
41
|
def augment_column_config(c)
|
42
|
-
|
42
|
+
super
|
43
|
+
if c.type == :action
|
43
44
|
c.xtype = :actioncolumn
|
44
45
|
c.items = c.actions.map {|a| build_action_config(a)}.netzke_jsonify
|
45
46
|
end
|
46
|
-
|
47
|
-
super
|
48
47
|
end
|
49
48
|
|
50
49
|
private
|
@@ -55,24 +54,8 @@ module Netzke
|
|
55
54
|
a.tap do |a|
|
56
55
|
a[:tooltip] ||= a[:name].to_s.humanize
|
57
56
|
a[:icon] ||= a[:name].to_sym
|
58
|
-
a[:
|
59
|
-
|
60
|
-
var cmp = Ext.getCmp('#{js_id}'),
|
61
|
-
f = cmp.on#{a[:handler].to_s.camelize};
|
62
|
-
if (Ext.isFunction(f)) {
|
63
|
-
f.apply(cmp, arguments);
|
64
|
-
} else {
|
65
|
-
Netzke.warning("Undefined handler for action '#{a[:name]}'");
|
66
|
-
}
|
67
|
-
}
|
68
|
-
JS
|
69
|
-
|
70
|
-
a[:is_disabled] &&= Netzke::Core::JsonLiteral.new <<-JS
|
71
|
-
function() {
|
72
|
-
var cmp = Ext.getCmp('#{js_id}');
|
73
|
-
return cmp.#{a[:is_disabled].to_s.camelize(:lower)}.apply(cmp, arguments);
|
74
|
-
}
|
75
|
-
JS
|
57
|
+
a[:passed_handler] = a[:handler].to_s.camelize
|
58
|
+
a[:handler] = f(:netzke_on_column_action)
|
76
59
|
a[:icon] = "#{Netzke::Core.icons_uri}/#{a[:icon]}.png" if a[:icon].is_a?(Symbol)
|
77
60
|
end
|
78
61
|
end
|