netzke-core 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.2.11
2
+ Introduction of getOwnerWidget()-method to Ext.Component. It provides the Netzke widget this Component belongs to.
3
+
1
4
  v0.2.10
2
5
  Removed dependency on 'json' gem.
3
6
  Rails v2.3.2 compatibility.
data/README.mdown CHANGED
@@ -8,6 +8,8 @@ See the introduction to the Netzke framework at http://github.com/skozlov/netzke
8
8
 
9
9
  The tutorials: http://blog.writelesscode.com
10
10
 
11
+ Live-demo: http://netzke-demo.writelesscode.com
12
+
11
13
  Also see the netzke-basepack project: http://github.com/skozlov/netzke-basepack/tree/master
12
14
 
13
15
  Copyright (c) 2008-2009 Sergei Kozlov, released under LGPL 3.0
data/javascripts/core.js CHANGED
@@ -3,29 +3,26 @@ This file gets loaded along with the rest of Ext library at the initial load
3
3
  */
4
4
 
5
5
  Ext.BLANK_IMAGE_URL = "/extjs/resources/images/default/s.gif";
6
- Ext.namespace('Ext.netzke');
6
+ Ext.namespace('Ext.netzke'); // namespace for extensions that depend on Ext
7
+ Ext.namespace('Netzke'); // namespace for extensions that do not depend on Ext
7
8
  Ext.netzke.cache = {};
8
9
 
9
10
  Ext.QuickTips.init(); // seems obligatory in Ext v2.2.1, otherwise Ext.Component#destroy() stops working properly
10
11
 
11
12
  // to comply with Rails' forgery protection
12
13
  Ext.Ajax.extraParams = {
13
- 'authenticity_token': Ext.authenticityToken
14
+ authenticity_token : Ext.authenticityToken
14
15
  };
15
16
 
16
17
  // helper method to do multiple Ext.apply's
17
- Ext.chainApply = function(objectArray){
18
+ Ext.netzke.chainApply = function(objectArray){
18
19
  var res = {};
19
20
  Ext.each(objectArray, function(obj){Ext.apply(res, obj)});
20
21
  return res;
21
22
  };
22
23
 
23
24
  // Type detection functions
24
- function isArray(o) {
25
- return (o != null && typeof o == "object" && o.constructor.toString() == Array.toString());
26
- }
27
-
28
- function isObject(o) {
25
+ Netzke.isObject = function(o) {
29
26
  return (o != null && typeof o == "object" && o.constructor.toString() == Object.toString());
30
27
  }
31
28
 
@@ -143,10 +140,10 @@ Ext.widgetMixIn = {
143
140
  // if there's no action with this name, maybe it's a separator or something
144
141
  res.push(o);
145
142
  }
146
- } else if (isObject(o)) {
143
+ } else if (Netzke.isObject(o)) {
147
144
  // look inside the objects...
148
145
  for (var key in o) {
149
- if (isArray(o[key])) {
146
+ if (Ext.isArray(o[key])) {
150
147
  // ... and recursively process inner arrays found
151
148
  o[key] = replaceStringsWithActions(o[key], scope);
152
149
  }
@@ -224,8 +221,8 @@ Ext.widgetMixIn = {
224
221
  if (!!this.hostMenu) {
225
222
  this.hostMenu(menu, owner);
226
223
  } else {
227
- if (this.parent) {
228
- this.parent.addMenu(menu, owner);
224
+ if (this.ownerWidget) {
225
+ this.ownerWidget.addMenu(menu, owner);
229
226
  }
230
227
  }
231
228
  },
@@ -238,8 +235,8 @@ Ext.widgetMixIn = {
238
235
  if (!!this.unhostMenu) {
239
236
  this.unhostMenu(owner);
240
237
  } else {
241
- if (this.parent) {
242
- this.parent.cleanUpMenu(owner);
238
+ if (this.ownerWidget) {
239
+ this.ownerWidget.cleanUpMenu(owner);
243
240
  }
244
241
  }
245
242
  },
@@ -247,7 +244,27 @@ Ext.widgetMixIn = {
247
244
  onWidgetLoad:Ext.emptyFn // gets overridden
248
245
  };
249
246
 
250
- // Make Panel with layout 'fit' capable to dynamically load widgets
247
+ // Netzke extensions for Ext.Container
248
+ Ext.override(Ext.Container, {
249
+ /**
250
+ Get Netzke widget that this Ext.Container is part of.
251
+ It searches up the Ext.Container hierarchy until it finds a Container that has isNetzke property set to true
252
+ (or until it reaches the top).
253
+ */
254
+ getOwnerWidget : function(){
255
+ if (this.initialConfig.isNetzke) {
256
+ return this;
257
+ } else {
258
+ if (this.ownerCt){
259
+ return this.ownerCt.getOwnerWidget()
260
+ } else {
261
+ return null
262
+ }
263
+ }
264
+ }
265
+ });
266
+
267
+ // Make Panel with layout 'fit' capable of dynamic widgets loading
251
268
  Ext.override(Ext.Panel, {
252
269
  getWidget: function(){
253
270
  return this.items.get(0);
@@ -292,11 +309,12 @@ Ext.override(Ext.Panel, {
292
309
  eval(responseObj.js);
293
310
  }
294
311
 
295
- responseObj.config.parent = this.ownerCt; // we might want to know the parent panel in advance (e.g. to know its size)
312
+ responseObj.config.ownerWidget = this.getOwnerWidget();
296
313
  var instance = new Ext.netzke.cache[responseObj.config.widgetClassName](responseObj.config)
297
314
 
298
315
  this.add(instance);
299
316
  this.doLayout();
317
+
300
318
  } else {
301
319
  // we didn't get normal response - desplay the flash with eventual errors
302
320
  this.ownerCt.feedback(responseObj.flash);
@@ -1,9 +1,9 @@
1
1
  module Netzke
2
2
  module BaseExtras
3
3
  #
4
- # Module which provides JS-class generation functionality for the widgets ("client-side"). This code is executed only once per widget class, and the results are cached at the server (unless widget specifies config[:no_caching] => true).
5
- # Included into Netzke::Base class
6
- # Most of the methods below are meant to be overwritten
4
+ # Module which provides JS-class generation functionality for the widgets ("client-side"). This code is executed only once per widget class, and the results are cached at the server.
5
+ # Included into Netzke::Base class.
6
+ # Most of the methods below are meant to be overwritten.
7
7
  #
8
8
  module JsBuilder
9
9
  def self.included(base)
@@ -127,7 +127,8 @@ module Netzke
127
127
  # :items => js_items,
128
128
  :height => 400,
129
129
  :width => 800,
130
- :border => false
130
+ :border => false,
131
+ :is_netzke => true # to distinguish a Netzke widget from regular Ext components
131
132
  }
132
133
  end
133
134
 
data/netzke-core.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{netzke-core}
5
- s.version = "0.2.10"
5
+ s.version = "0.2.11"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sergei Kozlov"]
9
- s.date = %q{2009-03-24}
9
+ s.date = %q{2009-04-17}
10
10
  s.description = %q{Build ExtJS/Rails widgets with minimum effort}
11
11
  s.email = %q{sergei@writelesscode.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "lib/app/controllers/netzke_controller.rb", "lib/app/models/netzke_layout.rb", "lib/app/models/netzke_preference.rb", "lib/netzke/action_view_ext.rb", "lib/netzke/base.rb", "lib/netzke/base_extras/interface.rb", "lib/netzke/base_extras/js_builder.rb", "lib/netzke/controller_extensions.rb", "lib/netzke/core_ext.rb", "lib/netzke/feedback_ghost.rb", "lib/netzke/routing.rb", "lib/netzke-core.rb", "lib/vendor/facets/hash/recursive_merge.rb", "LICENSE", "README.mdown", "tasks/netzke_core_tasks.rake", "TODO"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei Kozlov
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-24 00:00:00 +01:00
12
+ date: 2009-04-17 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15