netzke-basepack 0.12.0.beta → 0.12.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/javascripts/basepack.js +8 -0
- data/javascripts/netzkeremotecombo.js +11 -8
- data/lib/netzke/basepack/action_column.rb +15 -14
- data/lib/netzke/basepack/dynamic_tab_panel.rb +22 -0
- data/lib/netzke/basepack/dynamic_tab_panel/javascripts/dynamic_tab_panel.js +29 -0
- data/lib/netzke/basepack/fields.rb +0 -3
- data/lib/netzke/basepack/grid/endpoints.rb +1 -0
- data/lib/netzke/basepack/grid/javascripts/event_handling.js +1 -1
- data/lib/netzke/basepack/grid/javascripts/grid.js +4 -12
- data/lib/netzke/basepack/version.rb +1 -1
- data/netzke-basepack.gemspec +3 -2
- metadata +21 -6
- data/lib/netzke/basepack/action_column/javascripts/action_column.js +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 817d2e083cf6654f2cda858ad90bcce10f0186d0
|
4
|
+
data.tar.gz: f6eea32b664e1167d575c1dceaefb04a8e39c01a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1618ba135de66f165e85463dbdd9f0a3907b97bd8a065dacd67d77707a8b3dda2543f6096b7ac5d76b0ee1048044a1fca94532422c37b0fbf83386b923c4fe43
|
7
|
+
data.tar.gz: 7df2684b6ccb8bf81a9235896f2fe7e1f12345cdf11b578330eee7f033d8da40fc1b2767e8c7e4c72de8e851980aed0a49210065d30436d5be2aa8948e72acb0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/javascripts/basepack.js
CHANGED
@@ -8,20 +8,24 @@ Ext.define('Ext.netzke.ComboBox', {
|
|
8
8
|
forceSelection: true,
|
9
9
|
|
10
10
|
initComponent : function(){
|
11
|
-
var
|
11
|
+
var parent = this.netzkeParent || this.findParentBy(function(c) { return c.isNetzke; }),
|
12
|
+
modelName = parent.id + "_" + this.name;
|
12
13
|
|
13
14
|
if (this.blankLine == undefined) this.blankLine = "---";
|
14
15
|
|
15
|
-
|
16
|
+
if (!Netzke.isModelDefined(modelName)) {
|
17
|
+
Ext.define(Netzke.modelName(modelName), {
|
16
18
|
extend: 'Ext.data.Model',
|
17
19
|
fields: ['value', 'text']
|
18
|
-
|
20
|
+
});
|
21
|
+
};
|
19
22
|
|
20
23
|
var store = new Ext.data.Store({
|
21
|
-
model: modelName,
|
24
|
+
model: Netzke.modelName(modelName),
|
22
25
|
proxy: {
|
23
26
|
type: 'direct',
|
24
|
-
directFn: Netzke.providers[
|
27
|
+
directFn: Netzke.providers[parent.id].getComboboxOptions,
|
28
|
+
extraParams: {configs: parent.buildParentClientConfigs()},
|
25
29
|
reader: {
|
26
30
|
type: 'array',
|
27
31
|
rootProperty: 'data'
|
@@ -37,7 +41,7 @@ Ext.define('Ext.netzke.ComboBox', {
|
|
37
41
|
if (this.blankLine) {
|
38
42
|
store.on('load', function(self, params) {
|
39
43
|
// append a selectable "empty line" which will allow remove the association
|
40
|
-
self.add(Ext.create(modelName, {value: -1, text: this.blankLine}));
|
44
|
+
self.add(Ext.create(Netzke.modelName(modelName), {value: -1, text: this.blankLine}));
|
41
45
|
}, this);
|
42
46
|
}
|
43
47
|
|
@@ -47,6 +51,5 @@ Ext.define('Ext.netzke.ComboBox', {
|
|
47
51
|
this.store = store;
|
48
52
|
|
49
53
|
this.callParent();
|
50
|
-
}
|
51
|
-
|
54
|
+
}
|
52
55
|
});
|
@@ -12,7 +12,7 @@ module Netzke
|
|
12
12
|
# end
|
13
13
|
#
|
14
14
|
# def columns
|
15
|
-
# super + [:
|
15
|
+
# super + [:actions]
|
16
16
|
# end
|
17
17
|
#
|
18
18
|
# column :actions do |c|
|
@@ -38,20 +38,10 @@ module Netzke
|
|
38
38
|
module ActionColumn
|
39
39
|
extend ActiveSupport::Concern
|
40
40
|
|
41
|
-
included do |base|
|
42
|
-
js_configure do |c|
|
43
|
-
c.require :action_column
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# This can be optimized in order to generate less json in the column getter
|
48
41
|
def augment_column_config(c)
|
49
42
|
if c[:type] == :action
|
50
|
-
c.xtype = :
|
51
|
-
|
52
|
-
c[:getter] = lambda do |r|
|
53
|
-
c.actions.map {|a| build_action_config(a)}.netzke_jsonify.to_json
|
54
|
-
end
|
43
|
+
c.xtype = :actioncolumn
|
44
|
+
c.items = c.actions.map {|a| build_action_config(a)}.netzke_jsonify
|
55
45
|
end
|
56
46
|
|
57
47
|
super
|
@@ -61,10 +51,21 @@ module Netzke
|
|
61
51
|
|
62
52
|
def build_action_config(a)
|
63
53
|
a = {name: a} if a.is_a?(Symbol)
|
54
|
+
a[:handler] ||= a[:name]
|
64
55
|
a.tap do |a|
|
65
56
|
a[:tooltip] ||= a[:name].to_s.humanize
|
66
57
|
a[:icon] ||= a[:name].to_sym
|
67
|
-
a[:handler]
|
58
|
+
a[:handler] = Netzke::Core::JsonLiteral.new <<-JS
|
59
|
+
function() {
|
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
|
68
69
|
|
69
70
|
a[:icon] = "#{Netzke::Core.icons_uri}/#{a[:icon]}.png" if a[:icon].is_a?(Symbol)
|
70
71
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Netzke
|
2
|
+
module Basepack
|
3
|
+
# A tab panel that can load components dynamically by their class name. Components can be loaded in the current or new tab.
|
4
|
+
# For example:
|
5
|
+
#
|
6
|
+
# this.netzkeLoadComponentByClass('BookGrid', {newTab: true, clientConfig: {read_only: true}});
|
7
|
+
#
|
8
|
+
class DynamicTabPanel < Netzke::Base
|
9
|
+
js_configure do |c|
|
10
|
+
c.extend = "Ext.tab.Panel"
|
11
|
+
c.mixin
|
12
|
+
end
|
13
|
+
|
14
|
+
# Override this method if you need more control on what components can/cannot be loaded, or in order to access
|
15
|
+
# `client_config`
|
16
|
+
component :child do |c|
|
17
|
+
# c.client_config <== is accessible here
|
18
|
+
c.klass = (c.client_config[:klass] || "Netzke::Core::Panel").constantize
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
netzkeTabComponentDelivered: function(c, config) {
|
3
|
+
var tab,
|
4
|
+
i,
|
5
|
+
activeTab = this.getActiveTab(),
|
6
|
+
cmp = Ext.ComponentManager.create(Ext.apply(c, {closable: true}));
|
7
|
+
|
8
|
+
if (config.newTab || activeTab == null) {
|
9
|
+
tab = this.add(cmp);
|
10
|
+
} else {
|
11
|
+
tab = this.getActiveTab();
|
12
|
+
i = this.items.indexOf(tab);
|
13
|
+
this.remove(tab);
|
14
|
+
tab = this.insert(i, cmp);
|
15
|
+
}
|
16
|
+
|
17
|
+
this.setActiveTab(tab);
|
18
|
+
},
|
19
|
+
|
20
|
+
netzkeLoadComponentByClass: function(klass, options) {
|
21
|
+
this.netzkeLoadComponent('child', Ext.apply(options, {
|
22
|
+
configOnly: true,
|
23
|
+
clone: true,
|
24
|
+
clientConfig: Ext.apply(options.clientConfig || {}, {klass: klass}),
|
25
|
+
callback: this.netzkeTabComponentDelivered,
|
26
|
+
scope: this,
|
27
|
+
}));
|
28
|
+
}
|
29
|
+
}
|
@@ -31,6 +31,7 @@ module Netzke
|
|
31
31
|
# +query+ - what's typed-in in the combobox
|
32
32
|
# +id+ - selected record id
|
33
33
|
endpoint :get_combobox_options do |params, this|
|
34
|
+
::Rails.logger.debug "\n!!! params: #{params.inspect}\n"
|
34
35
|
column = final_columns.detect{ |c| c[:name] == params[:attr] }
|
35
36
|
this.data = data_adapter.combo_data(column, params[:query])
|
36
37
|
end
|
@@ -67,7 +67,7 @@
|
|
67
67
|
|
68
68
|
/* Exception handler. TODO: will responses with status 200 land here? */
|
69
69
|
loadExceptionHandler: function(proxy, response, operation){
|
70
|
-
Netzke.warning('Server exception occured. Override loadExceptionHandler, or catch globally by listenning to
|
70
|
+
Netzke.warning('Server exception occured. Override loadExceptionHandler, or catch globally by listenning to exception event of Netzke.directProvider');
|
71
71
|
},
|
72
72
|
|
73
73
|
// Inline editing of 1 row
|
@@ -22,8 +22,8 @@
|
|
22
22
|
this.netzkeProcessColumns();
|
23
23
|
|
24
24
|
// Define the model
|
25
|
-
if (!this.
|
26
|
-
Ext.define(this.
|
25
|
+
if (!Netzke.isModelDefined(this.id)) {
|
26
|
+
Ext.define(Netzke.modelName(this.id), {
|
27
27
|
extend: 'Ext.data.Model',
|
28
28
|
idProperty: this.pri, // Primary key
|
29
29
|
fields: this.fields
|
@@ -218,7 +218,7 @@
|
|
218
218
|
}
|
219
219
|
|
220
220
|
if (c.editor) {
|
221
|
-
Ext.applyIf(c.editor, {selectOnFocus: true,
|
221
|
+
Ext.applyIf(c.editor, {selectOnFocus: true, netzkeParent: this});
|
222
222
|
}
|
223
223
|
|
224
224
|
// Setting the default filter type
|
@@ -234,7 +234,7 @@
|
|
234
234
|
|
235
235
|
netzkeBuildStore: function() {
|
236
236
|
var store = Ext.create('Ext.data.Store', Ext.apply({
|
237
|
-
model: this.
|
237
|
+
model: Netzke.modelName(this.id),
|
238
238
|
proxy: this.netzkeBuildProxy(),
|
239
239
|
pruneModifiedRecords: true,
|
240
240
|
remoteSort: true,
|
@@ -309,14 +309,6 @@
|
|
309
309
|
return r.isNew ? "grid-dirty-record" : ""
|
310
310
|
},
|
311
311
|
|
312
|
-
netzkeModelName: function(){
|
313
|
-
return "Netzke.models." + this.id;
|
314
|
-
},
|
315
|
-
|
316
|
-
netzkeIsModelDefined: function(){
|
317
|
-
return !!(Netzke.models || {})[this.id];
|
318
|
-
},
|
319
|
-
|
320
312
|
// Normalizes the renderer for a column.
|
321
313
|
// Renderer may be:
|
322
314
|
// 1) a string that contains the name of the function to be used as renderer.
|
data/netzke-basepack.gemspec
CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.name = "netzke-basepack"
|
5
5
|
s.version = Netzke::Basepack::VERSION
|
6
6
|
s.author = "Max Gorin"
|
7
|
-
s.email = "
|
7
|
+
s.email = "max@goodbitlabs.com"
|
8
8
|
s.homepage = "http://netzke.org"
|
9
9
|
s.summary = "Pre-built Netzke components"
|
10
10
|
s.description = "A set of feature-rich extendible Netzke components (such as Form, Grid, Window, TabPanel, etc) and component extensions which can be used as building blocks for your RIA"
|
@@ -13,7 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.test_files = Dir["{test}/**/*"]
|
14
14
|
s.require_paths = ["lib"]
|
15
15
|
|
16
|
-
s.add_dependency 'netzke-core', '~> 0.12.0.
|
16
|
+
s.add_dependency 'netzke-core', '~> 0.12.0.rc1'
|
17
|
+
s.add_dependency 'netzke-testing', '~> 0.12.0.beta2'
|
17
18
|
|
18
19
|
s.add_development_dependency 'rails', '~> 4.2.0'
|
19
20
|
s.add_development_dependency 'sqlite3'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netzke-basepack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.0.
|
4
|
+
version: 0.12.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Gorin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: netzke-core
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.12.0.
|
19
|
+
version: 0.12.0.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.12.0.
|
26
|
+
version: 0.12.0.rc1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: netzke-testing
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.12.0.beta2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.12.0.beta2
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rails
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,7 +111,7 @@ dependencies:
|
|
97
111
|
description: A set of feature-rich extendible Netzke components (such as Form, Grid,
|
98
112
|
Window, TabPanel, etc) and component extensions which can be used as building blocks
|
99
113
|
for your RIA
|
100
|
-
email:
|
114
|
+
email: max@goodbitlabs.com
|
101
115
|
executables: []
|
102
116
|
extensions: []
|
103
117
|
extra_rdoc_files: []
|
@@ -115,7 +129,6 @@ files:
|
|
115
129
|
- lib/netzke/basepack.rb
|
116
130
|
- lib/netzke/basepack/accordion.rb
|
117
131
|
- lib/netzke/basepack/action_column.rb
|
118
|
-
- lib/netzke/basepack/action_column/javascripts/action_column.js
|
119
132
|
- lib/netzke/basepack/active_record.rb
|
120
133
|
- lib/netzke/basepack/active_record/relation_extensions.rb
|
121
134
|
- lib/netzke/basepack/attr_config.rb
|
@@ -124,6 +137,8 @@ files:
|
|
124
137
|
- lib/netzke/basepack/data_accessor.rb
|
125
138
|
- lib/netzke/basepack/data_adapters/abstract_adapter.rb
|
126
139
|
- lib/netzke/basepack/data_adapters/active_record_adapter.rb
|
140
|
+
- lib/netzke/basepack/dynamic_tab_panel.rb
|
141
|
+
- lib/netzke/basepack/dynamic_tab_panel/javascripts/dynamic_tab_panel.js
|
127
142
|
- lib/netzke/basepack/field_config.rb
|
128
143
|
- lib/netzke/basepack/fields.rb
|
129
144
|
- lib/netzke/basepack/form.rb
|
@@ -1,61 +0,0 @@
|
|
1
|
-
Ext.define('Ext.grid.column.NetzkeAction', {
|
2
|
-
extend: 'Ext.grid.column.Action',
|
3
|
-
alias: ['widget.netzkeactioncolumn'],
|
4
|
-
|
5
|
-
constructor: function(config) {
|
6
|
-
var me = this,
|
7
|
-
cfg = Ext.apply({}, config),
|
8
|
-
i,
|
9
|
-
item;
|
10
|
-
|
11
|
-
me.callParent([cfg]);
|
12
|
-
|
13
|
-
me.renderer = function(actions, meta) {
|
14
|
-
// previous renderer
|
15
|
-
var v = Ext.isFunction(cfg.renderer) ? cfg.renderer.apply(this, arguments)||'' : '',
|
16
|
-
actions = Ext.isEmpty(actions) ? [] : Ext.decode(actions),
|
17
|
-
l = actions.length,
|
18
|
-
action;
|
19
|
-
|
20
|
-
meta.tdCls += ' ' + Ext.baseCSSPrefix + 'action-col-cell';
|
21
|
-
|
22
|
-
for (i = 0; i < l; i++) {
|
23
|
-
action = actions[i];
|
24
|
-
if (!action.hidden) {
|
25
|
-
v += '<img alt="' + (action.altText || me.altText) + '" src="' + (action.icon || Ext.BLANK_IMAGE_URL) +
|
26
|
-
'" class="' + Ext.baseCSSPrefix + 'action-col-icon ' + Ext.baseCSSPrefix + 'action-col-' + String(i) + ' ' + (action.iconCls || '') +
|
27
|
-
' ' + (Ext.isFunction(action.getClass) ? action.getClass.apply(action.scope||me.scope||me, arguments) : (me.iconCls || '')) + '"' +
|
28
|
-
((action.tooltip) ? ' data-qtip="' + action.tooltip + '"' : '') +
|
29
|
-
' data-name="' + action.name + '"' +
|
30
|
-
((action.handler) ? ' data-handler="' + action.handler + '"' : '') + ' />';
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
return v;
|
35
|
-
};
|
36
|
-
},
|
37
|
-
|
38
|
-
processEvent : function(type, view, cell, recordIndex, cellIndex, e){
|
39
|
-
var me = this,
|
40
|
-
target = e.getTarget(),
|
41
|
-
match = target.className.match("x-action-col-icon"),
|
42
|
-
fn, grid, record;
|
43
|
-
if (match) {
|
44
|
-
if (type == 'click') {
|
45
|
-
grid = me.ownerCt.ownerCt;
|
46
|
-
fn = (target.getAttribute("data-handler") || "").camelize(true);
|
47
|
-
fn = Ext.isFunction(grid[fn]) ? grid[fn] : undefined;
|
48
|
-
// if (fn) fn.call(grid, view, recordIndex, cellIndex, target, e);
|
49
|
-
if (fn) {
|
50
|
-
record = grid.getStore().getAt(recordIndex);
|
51
|
-
fn.call(grid, record, target, e);
|
52
|
-
} else {
|
53
|
-
Netzke.warning("Undefined handler for column action '" + target.getAttribute("data-name") + "'");
|
54
|
-
}
|
55
|
-
} else if (type == 'mousedown') {
|
56
|
-
return false;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
return me.callParent(arguments);
|
60
|
-
}
|
61
|
-
});
|