netzke-core 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,4 +1,9 @@
1
- = v0.5.0
1
+ = v0.5.1 - 2010-02-26
2
+ * Compatibility with Ext 3.1.1
3
+ * New: <tt>Netzke.page</tt> object now contains all the widgets declared on the page
4
+ * Code: replaced (references to) deprecated function names
5
+
6
+ = v0.5.0 - 2010-01-10
2
7
  * Compatibility with Ext 3.1.0
3
8
  * API change: Netzke widget's now should be declared directly in the views instead of controllers.
4
9
  * API change: all ExtJS and Netzke JavaScript and styles are now loaded with the help of <tt>netzke_init</tt> helper.
data/README.rdoc CHANGED
@@ -10,19 +10,13 @@ For the latest ("edge") stuff, install as plugin (recommended!):
10
10
 
11
11
  ./script/plugin install git://github.com/skozlov/netzke-core.git
12
12
 
13
- Otherwise, install as gem. The gem is hosted on gemcutter. If you haven't yet enabled gemcutter, run the following:
13
+ Otherwise, install as gem:
14
14
 
15
- sudo gem install gemcutter && gem tumble
16
-
17
- Install the gem
18
-
19
- sudo gem install netzke-core
15
+ gem install netzke-core
20
16
 
21
- Generate the migrations for Netzke persistent storage:
17
+ To generate the migrations for Netzke persistent storage (if you want to use it):
22
18
 
23
19
  ./script/generate netzke_core
24
-
25
- Run the migrations.
26
20
 
27
21
  Netzke assumes that your ExtJS library is in public/extjs (which may be a symbolic link).
28
22
 
@@ -31,25 +25,29 @@ Here's how to embed a Netzke widget into your Rails view.
31
25
 
32
26
  1. In your layout, within the "head" tag, use the <tt>netzke_init</tt> helper to include all the necessary JavaScript and styles.
33
27
 
34
- <%= netzke_init %>
35
-
36
- 2. In your view use the <tt>netzke</tt> helper wherever you want to insert a widget.
28
+ <%= netzke_init %>
29
+
30
+ 2. In config/routes.rb declare the Netzke routes:
37
31
 
38
- <%= netzke :grid_panel, :data_class_name => "User", :columns => [:id, :name, :created_at] %>
39
-
32
+ map.netzke
33
+
34
+ 3. In your view use the <tt>netzke</tt> helper wherever you want to insert a widget.
35
+
36
+ <%= netzke :grid_panel, :model => "User", :columns => [:id, :name, :created_at] %>
37
+
40
38
  (here we use the GridPanel widget from the netzke-basepack project)
41
39
 
42
40
  == More info
43
41
  Introduction to Netzke framework and wiki: http://github.com/skozlov/netzke
44
42
 
45
- Twitter: <http://twitter.com/skozlov>
43
+ Twitter: http://twitter.com/skozlov
46
44
 
47
- Tutorials: <http://blog.writelesscode.com>
45
+ Tutorials: http://blog.writelesscode.com
48
46
 
49
- Live-demo: <http://netzke-demo.writelesscode.com>
47
+ Live-demo with sample code: http://netzke-demo.writelesscode.com
50
48
 
51
- The netzke-basepack project (pre-built full-featured widgets): <http://github.com/skozlov/netzke-basepack>
49
+ The netzke-basepack project (pre-built full-featured widgets): http://github.com/skozlov/netzke-basepack
52
50
 
53
51
  ---
54
52
 
55
- Copyright (c) 2009 Sergei Kozlov, released under the MIT license
53
+ Copyright (c) 2008-2010 Sergei Kozlov, released under the MIT license
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  begin
2
2
  require 'jeweler'
3
3
  Jeweler::Tasks.new do |gemspec|
4
- gemspec.version = "0.5.0"
4
+ gemspec.version = "0.5.1"
5
5
  gemspec.name = "netzke-core"
6
6
  gemspec.summary = "Build ExtJS/Rails widgets with minimum effort"
7
7
  gemspec.description = "Allows building ExtJS/Rails reusable code in a DRY way"
data/javascripts/core.js CHANGED
@@ -3,7 +3,7 @@ This file gets loaded along with the rest of Ext library at the initial load
3
3
  */
4
4
 
5
5
  // Check Ext JS version
6
- var requiredExtVersion = "3.1.0";
6
+ var requiredExtVersion = "3.1.1";
7
7
  var currentExtVersion = Ext.version;
8
8
  if (requiredExtVersion !== currentExtVersion) {
9
9
  alert("Netzke needs Ext " + requiredExtVersion + ". You have " + currentExtVersion + ".");
@@ -13,6 +13,7 @@ if (requiredExtVersion !== currentExtVersion) {
13
13
  Ext.BLANK_IMAGE_URL = "/extjs/resources/images/default/s.gif";
14
14
  Ext.ns('Ext.netzke'); // namespace for extensions that depend on Ext
15
15
  Ext.ns('Netzke'); // Netzke namespace
16
+ Ext.ns('Netzke.page'); // namespace for all widget instantces on the page
16
17
 
17
18
  Ext.QuickTips.init();
18
19
 
@@ -40,7 +40,7 @@ module Netzke
40
40
  end
41
41
 
42
42
  # Use this helper in your views to embed Netzke widgets. E.g.:
43
- # netzke :my_grid, :widget_class_name => "GridPanel", :columns => [:id, :name, :created_at]
43
+ # netzke :my_grid, :class_name => "GridPanel", :columns => [:id, :name, :created_at]
44
44
  # On how to configure a widget, see documentation for Netzke::Base or/and specific widget
45
45
  def netzke(name, config = {})
46
46
  ::ActiveSupport::Deprecation.warn("widget_class_name option is deprecated. Use class_name instead", caller) if config[:widget_class_name]
data/lib/netzke/base.rb CHANGED
@@ -9,13 +9,13 @@ module Netzke
9
9
  # netzke :widget_name, configuration_hash
10
10
  #
11
11
  # == Configuration
12
- # * <tt>:widget_class_name</tt> - name of the widget class in the scope of the Netzke module, e.g. "FormPanel".
12
+ # * <tt>:class_name</tt> - name of the widget class in the scope of the Netzke module, e.g. "FormPanel".
13
13
  # When a widget is defined in the controller and this option is omitted, widget class is deferred from the widget's
14
14
  # name. E.g.:
15
15
  #
16
- # netzke :grid_panel, :data_class_name => "User"
16
+ # netzke :grid_panel, :model => "User"
17
17
  #
18
- # In this case <tt>:widget_class_name</tt> is assumed to be "GridPanel"
18
+ # In this case <tt>:class_name</tt> is assumed to be "GridPanel"
19
19
  #
20
20
  # * <tt>:ext_config</tt> - a config hash that is used to create a javascript instance of the widget. Every
21
21
  # configuration that comes here will be available inside the javascript instance of the widget.
@@ -27,8 +27,8 @@ module Netzke
27
27
  # Examples of configuration:
28
28
  #
29
29
  # netzke :books,
30
- # :widget_class_name => "GridPanel",
31
- # :data_class_name => "Book", # GridPanel specific option
30
+ # :class_name => "GridPanel",
31
+ # :model => "Book", # GridPanel specific option
32
32
  # :persistent_config => false, # don't use persistent config for this instance
33
33
  # :ext_config => {
34
34
  # :icon_cls => 'icon-grid',
@@ -36,7 +36,7 @@ module Netzke
36
36
  # }
37
37
  #
38
38
  # netzke :form_panel,
39
- # :data_class_name => "User" # FormPanel specific option
39
+ # :model => "User" # FormPanel specific option
40
40
  class Base
41
41
  extend ActiveSupport::Memoizable
42
42
 
@@ -153,7 +153,7 @@ module Netzke
153
153
  # Instance of widget by config
154
154
  def self.instance_by_config(config)
155
155
  ::ActiveSupport::Deprecation.warn("widget_class_name option is deprecated. Use class_name instead", caller) if config[:widget_class_name]
156
- widget_class = "Netzke::#{config[:class_name] || config[:widget_class_name]}".constantize
156
+ widget_class = "Netzke::#{config[:class_name] || config[:class_name]}".constantize
157
157
  widget_class.new(config)
158
158
  end
159
159
 
@@ -362,7 +362,7 @@ module Netzke
362
362
  ## Dependencies
363
363
  def dependencies
364
364
  @dependencies ||= begin
365
- non_late_aggregatees_widget_classes = non_late_aggregatees.values.map{|v| v[:widget_class_name]}
365
+ non_late_aggregatees_widget_classes = non_late_aggregatees.values.map{|v| v[:class_name]}
366
366
  (initial_dependencies + non_late_aggregatees_widget_classes << self.class.short_widget_class_name).uniq
367
367
  end
368
368
  end
@@ -414,9 +414,9 @@ module Netzke
414
414
  aggregatee_config = aggregator.aggregatees[aggr]
415
415
  raise ArgumentError, "No aggregatee '#{aggr}' defined for widget '#{aggregator.global_id}'" if aggregatee_config.nil?
416
416
  ::ActiveSupport::Deprecation.warn("widget_class_name option is deprecated. Use class_name instead", caller) if aggregatee_config[:widget_class_name]
417
- short_class_name = aggregatee_config[:class_name] || aggregatee_config[:widget_class_name]
418
- raise ArgumentError, "No widget_class_name specified for aggregatee #{aggr} of #{aggregator.global_id}" if short_class_name.nil?
419
- widget_class = "Netzke::#{short_class_name}".constantize
417
+ short_widget_class_name = aggregatee_config[:class_name] || aggregatee_config[:class_name]
418
+ raise ArgumentError, "No class_name specified for aggregatee #{aggr} of #{aggregator.global_id}" if short_widget_class_name.nil?
419
+ widget_class = "Netzke::#{short_widget_class_name}".constantize
420
420
 
421
421
  conf = weak_children_config.
422
422
  deep_merge(aggregatee_config).
@@ -430,7 +430,7 @@ module Netzke
430
430
  aggregator
431
431
  end
432
432
 
433
- def full_widget_class_name(short_name)
433
+ def full_class_name(short_name)
434
434
  "Netzke::#{short_name}"
435
435
  end
436
436
 
@@ -83,12 +83,12 @@ module Netzke
83
83
 
84
84
  # instantiating
85
85
  def js_widget_instance
86
- %Q{var #{name.jsonify} = new #{self.class.js_full_class_name}(#{js_config.to_nifty_json});}
86
+ %Q{Netzke.page.#{name.jsonify} = new #{self.class.js_full_class_name}(#{js_config.to_nifty_json});}
87
87
  end
88
88
 
89
89
  # rendering
90
90
  def js_widget_render
91
- self.class.js_xtype == "netzkewindow" ? %Q{#{name.jsonify}.show();} : %Q{#{name.jsonify}.render("#{name.to_s.split('_').join('-')}-div");}
91
+ %Q{Netzke.page.#{name.jsonify}.render("#{name.to_s.split('_').join('-')}-div");} unless self.class.js_xtype == "netzkewindow"
92
92
  end
93
93
 
94
94
  # container for rendering
@@ -14,8 +14,8 @@ module Netzke
14
14
 
15
15
  def initial_aggregatees
16
16
  {
17
- :nested_one => {:widget_class_name => 'NestedWidgetOne'},
18
- :nested_two => {:widget_class_name => 'NestedWidgetTwo'}
17
+ :nested_one => {:class_name => 'NestedWidgetOne'},
18
+ :nested_two => {:class_name => 'NestedWidgetTwo'}
19
19
  }
20
20
  end
21
21
 
@@ -37,7 +37,7 @@ module Netzke
37
37
  class NestedWidgetTwo < Base
38
38
  def initial_aggregatees
39
39
  {
40
- :nested => {:widget_class_name => 'DeepNestedWidget'}
40
+ :nested => {:class_name => 'DeepNestedWidget'}
41
41
  }
42
42
  end
43
43
  end
@@ -45,7 +45,7 @@ module Netzke
45
45
  class DeepNestedWidget < Base
46
46
  def initial_aggregatees
47
47
  {
48
- :nested => {:widget_class_name => "VeryDeepNestedWidget"}
48
+ :nested => {:class_name => "VeryDeepNestedWidget"}
49
49
  }
50
50
  end
51
51
  end
@@ -142,7 +142,7 @@ class NetzkeCoreTest < ActiveSupport::TestCase
142
142
  end
143
143
 
144
144
  test "widget instance by config" do
145
- widget = Netzke::Base.instance_by_config({:widget_class_name => 'Widget', :name => 'a_widget'})
145
+ widget = Netzke::Base.instance_by_config({:class_name => 'Widget', :name => 'a_widget'})
146
146
  assert(Widget, widget.class)
147
147
  assert('a_widget', widget.name)
148
148
  end
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.5.0
4
+ version: 0.5.1
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: 2010-01-20 00:00:00 -03:00
12
+ date: 2010-02-26 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies: []
15
15