netzke-core 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05d5210d957afab4f3a032efa096fe2eee4155a8
4
- data.tar.gz: c570b5bb0b0ee2443e3bf9f1818704baea37b753
3
+ metadata.gz: c115e116b48b15a2c00f8064c391b222fc8f412d
4
+ data.tar.gz: 8ad27cb9381e1917dcadcf2f5034b4d521aa911b
5
5
  SHA512:
6
- metadata.gz: fe6735816ec199ec3da0a862dc9562ad9829f751ef8478f280b0c9bc151a6fa04dd04475ba015afb44d104c385441a2fbdaaf8e59fe44510f32bcd0552d29011
7
- data.tar.gz: bb0630e509ccfcba1d59aa959e3ead0be870391125f6e948bd73846637a0d8cd9e4a766a8641bb8701a28087c8343b8c7b79c01349fb0815c263cbaa6bb40a48
6
+ metadata.gz: 7835bf463b495d9d9e9f5dc4ef432f99d5833f7e4c3a7f95cbcadd9cb73505c90955d4c3abc16dfcd847ecfb320cd8b9fc4cb792406bc5581033963898c6ea5f
7
+ data.tar.gz: 02ace0ae80b73910a406e67610d0a94e1ce90e36b8a241f4977666eceaad04aed67fbe0edc79669a1940e244e7eb3ffaf7154916b051e1dbeda822c98330c204
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.12.1 - 2015-05-31
2
+
3
+ * Add `Base#client_config` shortcut to `config.client_config`, make it ActiveSupport::OrderedOptions
4
+ * Rename `clientConfig` to `netzkeClientConfig` on client
5
+
1
6
  # v0.12.0 - 2015-03-16
2
7
 
3
8
  * ExtJS 5.1
data/Gemfile CHANGED
@@ -1,3 +1,22 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'rails', '4.2.0'
6
+ gem 'sqlite3'
7
+ gem 'yard'
8
+ gem 'rake'
9
+
10
+ group :test do
11
+ gem 'rspec'
12
+ gem 'rspec-rails'
13
+ gem 'capybara'
14
+ gem 'selenium-webdriver'
15
+ end
16
+
17
+ group :development, :test do
18
+ gem 'byebug'
19
+ gem 'web-console', '~> 2.0'
20
+ gem 'pry-rails'
21
+ gem 'netzke-testing', github: 'netzke/netzke-testing'
22
+ end
data/javascripts/ext.js CHANGED
@@ -118,6 +118,8 @@ Ext.define(null, {
118
118
 
119
119
  // This is where we store the information about components that are currently being loaded with this.loadComponent()
120
120
  this.componentsBeingLoaded = {};
121
+
122
+ this.netzkeClientConfig = config.clientConfig || {};
121
123
  }
122
124
 
123
125
  this.callOverridden([config]);
@@ -198,17 +200,14 @@ Ext.define(null, {
198
200
  * @private
199
201
  */
200
202
  buildParentClientConfigs: function() {
201
- if (!this._parentClientConfig) {
202
- this._parentClientConfig = [];
203
- var parent = this;
204
- while (parent) {
205
- var cfg = parent.clientConfig || {};
206
- cfg.id = parent.id;
207
- this._parentClientConfig.unshift(cfg);
208
- parent = parent.netzkeGetParentComponent();
209
- }
203
+ this._parentClientConfig = [];
204
+ var parent = this;
205
+ while (parent) {
206
+ var cfg = Ext.clone(parent.netzkeClientConfig);
207
+ cfg.id = parent.id;
208
+ this._parentClientConfig.unshift(cfg);
209
+ parent = parent.netzkeGetParentComponent();
210
210
  }
211
-
212
211
  return this._parentClientConfig;
213
212
  },
214
213
 
data/lib/netzke/base.rb CHANGED
@@ -138,7 +138,7 @@ module Netzke
138
138
  @flash = []
139
139
 
140
140
  # Make +client_config+ accessible in +configure+ before calling +super+
141
- config.client_config = conf.delete(:client_config) || {}
141
+ config.client_config = (conf.delete(:client_config) || {}).symbolize_keys
142
142
 
143
143
  # Build complete component configuration
144
144
  configure(config)
@@ -8,12 +8,12 @@ module Netzke
8
8
  # end
9
9
  # end
10
10
  class ClientClass
11
- attr_accessor :required_files, :base_class, :properties, :mixins, :translated_properties
11
+ attr_accessor :required_files, :base_class, :properties, :netzke_mixins, :translated_properties
12
12
 
13
13
  def initialize(klass)
14
14
  @klass = klass
15
15
  @required_files = []
16
- @mixins = []
16
+ @netzke_mixins = []
17
17
  @properties = {
18
18
  extend: extended_class,
19
19
  alias: class_alias,
@@ -115,14 +115,14 @@ module Netzke
115
115
  # }
116
116
  #
117
117
  # Also accepts a string, which will be interpreted as a full path to the file (useful for sharing mixins between classes).
118
- # With no parameters, will assume :component_class_name_underscored.
118
+ # With no parameters, will assume :<component_class_name>.
119
119
  #
120
120
  # Also, see defining JavaScript prototype properties with {ClientClass#method_missing}.
121
121
  def mixin(*args)
122
122
  args << @klass.name.split("::").last.underscore.to_sym if args.empty?
123
123
  callr = caller.first
124
124
  args.each do |a|
125
- @mixins << (a.is_a?(Symbol) ? expand_require_path(a, callr) : a)
125
+ @netzke_mixins << (a.is_a?(Symbol) ? expand_require_path(a, callr) : a)
126
126
  end
127
127
  end
128
128
 
@@ -226,7 +226,7 @@ Netzke.cache.push('#{xtype}');
226
226
  end
227
227
 
228
228
  def mixins_as_string
229
- mixins.presence && mixins.map do |f|
229
+ netzke_mixins.presence && netzke_mixins.map do |f|
230
230
  as_string = File.read(f)
231
231
  as_string.sub!('{', ' ')
232
232
  as_string[as_string.rindex('}')] = ' '
@@ -50,7 +50,8 @@ module Netzke::Core
50
50
  c.merge!(@passed_config)
51
51
  end
52
52
 
53
- # Complete configuration for server class instance. Can be accessed from within endpoint, component, and action blocks, as well as any other instance method, for example:
53
+ # Complete configuration for server class instance. Can be accessed from within endpoint, component, and action
54
+ # blocks, as well as any other instance method, for example:
54
55
  #
55
56
  # action :do_something do |c|
56
57
  # c.title = "Do it for #{config.title}"
@@ -59,6 +60,28 @@ module Netzke::Core
59
60
  @config ||= ActiveSupport::OrderedOptions.new
60
61
  end
61
62
 
63
+ # Config options that have been set on the fly on the client side of the component in the `netzkeClientConfig` object. Can be
64
+ # used to dynamically change component configuration. Those changes won't affect the way component is rendered, of
65
+ # course, but can be useful to reconfigure child components, e.g.:
66
+ #
67
+ # // Client
68
+ # initConfig: function() {
69
+ # this.callParent();
70
+ #
71
+ # this.netzkeGetComponent('authors').on('rowclick', function(grid, record) {
72
+ # this.netzkeClientConfig.author_id = record.getId();
73
+ # this.netzkeGetComponent('book_grid').getStore().load();
74
+ # }
75
+ # }
76
+ #
77
+ # # Server
78
+ # component :book_grid do |c|
79
+ # c.scope = { author_id: client_config.author_id }
80
+ # end
81
+ def client_config
82
+ ActiveSupport::OrderedOptions.new.merge!(config.client_config)
83
+ end
84
+
62
85
  protected
63
86
 
64
87
  # Override to validate configuration and raise eventual exceptions
@@ -70,15 +93,17 @@ module Netzke::Core
70
93
  def validate_config(c)
71
94
  end
72
95
 
73
- # During the normalization of config object, +extend_item+ is being called with each item found (recursively) in there.
74
- # For example, symbols representing nested child components get replaced with a proper config hash, same goes for actions (see +Composition+ and +Actions+ respectively).
75
- # Override to do any additional checks/enhancements. See, for example, +Netzke::Basepack::WrapLazyLoaded+ or +Netzke::Basepack::Fields+.
96
+ # During the normalization of config object, +extend_item+ is being called with each item found (recursively) in
97
+ # there. For example, symbols representing nested child components get replaced with a proper config hash, same
98
+ # goes for actions (see +Composition+ and +Actions+ respectively). Override to do any additional
99
+ # checks/enhancements. See, for example, +Netzke::Basepack::WrapLazyLoaded+ or +Netzke::Basepack::Fields+.
76
100
  # @return [Object|nil] normalized item or nil. If nil is returned, this item will be excluded from the config.
77
101
  def extend_item(item)
78
102
  item.is_a?(Hash) && item[:excluded] ? nil : item
79
103
  end
80
104
 
81
- # Used for detecting actions and components referred by symbols. For example, say, action +do_something+ is declared. Then:
105
+ # Used for detecting actions and components referred by symbols. For example, say, action +do_something+ is
106
+ # declared. Then:
82
107
  #
83
108
  # item #=> :do_something
84
109
  # item = detect_and_normalize :action, item
@@ -1,5 +1,5 @@
1
1
  module Netzke
2
2
  module Core
3
- VERSION = "0.12.0"
3
+ VERSION = "0.12.1"
4
4
  end
5
5
  end
data/netzke-core.gemspec CHANGED
@@ -16,15 +16,5 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency 'uglifier'
17
17
  s.add_dependency 'execjs'
18
18
 
19
- s.add_development_dependency 'rails', '~> 4.2.0'
20
- s.add_development_dependency 'sqlite3'
21
- s.add_development_dependency 'redcarpet'
22
- s.add_development_dependency 'yard'
23
- s.add_development_dependency 'coffee-script'
24
- s.add_development_dependency 'capybara'
25
- s.add_development_dependency 'selenium-webdriver'
26
- s.add_development_dependency 'rspec-rails'
27
- s.add_development_dependency 'netzke-testing', '~> 0.12.0'
28
-
29
19
  s.required_rubygems_version = ">= 1.3.4"
30
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
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-16 00:00:00.000000000 Z
11
+ date: 2015-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uglifier
@@ -38,132 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rails
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 4.2.0
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 4.2.0
55
- - !ruby/object:Gem::Dependency
56
- name: sqlite3
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: redcarpet
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: yard
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: coffee-script
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: capybara
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: selenium-webdriver
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: rspec-rails
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: netzke-testing
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: 0.12.0
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: 0.12.0
167
41
  description: Build complex web GUI in a modular way
168
42
  email: max@goodbitlabs.com
169
43
  executables: []