netzke-core 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +9 -6
- data/README.rdoc +14 -15
- data/Rakefile +20 -15
- data/TODO +1 -1
- data/app/controllers/netzke_controller.rb +9 -9
- data/app/models/netzke_preference.rb +27 -27
- data/features/actions.feature +1 -1
- data/features/basic.feature +1 -1
- data/features/client-server.feature +1 -1
- data/features/component_loader.feature +6 -7
- data/features/composition.feature +5 -6
- data/features/custom_css.feature +1 -1
- data/features/inheritance.feature +0 -1
- data/features/persistence.feature +3 -3
- data/features/scopes.feature +3 -3
- data/features/step_definitions/web_steps.rb +5 -5
- data/features/support/env.rb +6 -6
- data/generators/netzke_core/netzke_core_generator.rb +2 -2
- data/javascripts/core.js +43 -43
- data/lib/generators/migration_helper.rb +6 -6
- data/lib/generators/netzke/USAGE +2 -3
- data/lib/generators/netzke/core_generator.rb +7 -7
- data/lib/netzke/actions.rb +18 -18
- data/lib/netzke/base.rb +72 -85
- data/lib/netzke/composition.rb +30 -30
- data/lib/netzke/configuration.rb +15 -15
- data/lib/netzke/core/masquerading.rb +3 -3
- data/lib/netzke/core/session.rb +1 -1
- data/lib/netzke/core/version.rb +1 -1
- data/lib/netzke/core.rb +9 -9
- data/lib/netzke/core_ext/array.rb +5 -5
- data/lib/netzke/core_ext/hash.rb +7 -7
- data/lib/netzke/core_ext/string.rb +4 -4
- data/lib/netzke/core_ext/symbol.rb +3 -3
- data/lib/netzke/embedding.rb +2 -2
- data/lib/netzke/ext_component.rb +4 -4
- data/lib/netzke/javascript.rb +36 -25
- data/lib/netzke/persistence.rb +16 -16
- data/lib/netzke/rails/action_view_ext.rb +20 -20
- data/lib/netzke/rails/controller_extensions.rb +1 -1
- data/lib/netzke/rails/routes.rb +1 -1
- data/lib/netzke/services.rb +12 -12
- data/lib/netzke/session.rb +4 -4
- data/lib/netzke/stylesheets.rb +8 -8
- data/lib/netzke-core.rb +2 -2
- data/netzke-core.gemspec +4 -5
- data/spec/component/actions_spec.rb +18 -18
- data/spec/component/base_spec.rb +6 -6
- data/spec/component/composition_spec.rb +12 -12
- data/spec/component/javascript_spec.rb +2 -2
- data/spec/core_ext_spec.rb +3 -3
- data/templates/core/create_netzke_preferences.rb +1 -1
- data/test/rails_app/app/components/component_loader.rb +8 -8
- data/test/rails_app/app/components/component_with_actions.rb +9 -9
- data/test/rails_app/app/components/component_with_custom_css.rb +2 -2
- data/test/rails_app/app/components/component_with_included_js.rb +5 -5
- data/test/rails_app/app/components/component_with_session_persistence.rb +3 -3
- data/test/rails_app/app/components/deprecated/server_caller.rb +2 -2
- data/test/rails_app/app/components/extended_component_with_actions.rb +1 -1
- data/test/rails_app/app/components/extended_server_caller.rb +3 -3
- data/test/rails_app/app/components/kinda_complex_component/basic_stuff.rb +8 -8
- data/test/rails_app/app/components/kinda_complex_component/extra_stuff.rb +2 -2
- data/test/rails_app/app/components/loader_of_component_with_custom_css.rb +2 -2
- data/test/rails_app/app/components/server_caller.rb +3 -3
- data/test/rails_app/app/components/simple_component.rb +1 -1
- data/test/rails_app/app/components/simple_tab_panel.rb +2 -2
- data/test/rails_app/app/components/some_composite.rb +16 -16
- data/test/rails_app/config/routes.rb +2 -2
- data/test/test_helper.rb +1 -1
- data/test/unit/core_ext_test.rb +13 -13
- data/test/unit/netzke_core_test.rb +20 -20
- data/test/unit/netzke_preference_test.rb +12 -12
- metadata +6 -6
@@ -6,53 +6,53 @@ module Netzke
|
|
6
6
|
# it "should be possible to override toolbars without overriding action settings" do
|
7
7
|
# ExtendedComponentWithActions.new.actions[:another_action][:disabled].should == true
|
8
8
|
# end
|
9
|
-
|
9
|
+
|
10
10
|
class SomeComponent < Base
|
11
11
|
action :action_one
|
12
12
|
action :action_two
|
13
13
|
action :action_three do
|
14
14
|
{:text => "Action three"}
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
js_property :bbar, [:action_one.action, :action_two.action]
|
18
|
-
|
18
|
+
|
19
19
|
def config
|
20
20
|
{
|
21
21
|
:tbar => [:action_three.action]
|
22
22
|
}
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def actions
|
26
26
|
super.deep_merge({
|
27
27
|
:action_four => {:text => "Action 4"}
|
28
28
|
})
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
action :action_five, :text => "Action 5"
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
class ExtendedComponent < SomeComponent
|
35
35
|
js_property :bbar, [:action_one.action, :action_two.action, :action_three.action, :action_four.action, :action_five.action]
|
36
36
|
js_property :tbar, [:action_one.action, :action_two.action, :action_three.action, :action_four.action, :action_five.action]
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
class AnotherExtendedComponent < ExtendedComponent
|
40
40
|
action :action_one, :text => "Action 1"
|
41
41
|
action :action_five, :text => "Action Five"
|
42
|
-
|
42
|
+
|
43
43
|
action :action_two do
|
44
44
|
super().merge :disabled => true, :text => super()[:text] + ", extended"
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
action :action_three do
|
48
48
|
{:text => "Action 3"}
|
49
49
|
end
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
class YetAnotherExtendedComponent < AnotherExtendedComponent
|
53
53
|
action :action_two, :disabled => false
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
# it "should auto collect actions from both js_methods and config" do
|
57
57
|
# component = SomeComponent.new
|
58
58
|
# component.actions.keys.size.should == 5
|
@@ -62,7 +62,7 @@ module Netzke
|
|
62
62
|
# component.actions[:action_four][:text].should == "Action 4"
|
63
63
|
# component.actions[:action_five][:text].should == "Action 5"
|
64
64
|
# end
|
65
|
-
|
65
|
+
|
66
66
|
it "should not override previous actions when reconfiguring bars in child class" do
|
67
67
|
component = ExtendedComponent.new
|
68
68
|
# component.actions.keys.size.should == 5
|
@@ -72,23 +72,23 @@ module Netzke
|
|
72
72
|
component.actions[:action_four][:text].should == "Action 4"
|
73
73
|
component.actions[:action_five][:text].should == "Action 5"
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
it "should be possible to override actions in child class" do
|
77
77
|
component = AnotherExtendedComponent.new
|
78
78
|
component.actions[:action_one][:text].should == "Action 1"
|
79
79
|
component.actions[:action_five][:text].should == "Action Five"
|
80
|
-
|
80
|
+
|
81
81
|
component.actions[:action_two][:text].should == "Action two, extended"
|
82
82
|
component.actions[:action_two][:disabled].should == true
|
83
|
-
|
83
|
+
|
84
84
|
component.actions[:action_three][:text].should == "Action 3"
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
it "should only override the specified actions" do
|
88
88
|
component = YetAnotherExtendedComponent.new
|
89
89
|
component.actions[:action_two][:disabled].should == false
|
90
90
|
component.actions[:action_two][:text].should == "Action two, extended"
|
91
91
|
end
|
92
|
-
|
93
|
-
end
|
92
|
+
|
93
|
+
end
|
94
94
|
end
|
data/spec/component/base_spec.rb
CHANGED
@@ -7,19 +7,19 @@ describe Netzke::Base do
|
|
7
7
|
class_attribute :with_feature
|
8
8
|
self.with_feature = "yes"
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
class Child < Parent; end
|
12
|
-
|
12
|
+
|
13
13
|
Parent.with_feature.should == "yes"
|
14
14
|
Child.with_feature.should == "yes"
|
15
|
-
|
15
|
+
|
16
16
|
Child.with_feature = "no"
|
17
|
-
|
17
|
+
|
18
18
|
Parent.with_feature.should == "yes"
|
19
19
|
Child.with_feature.should == "no"
|
20
|
-
|
20
|
+
|
21
21
|
Parent.with_feature = "maybe"
|
22
22
|
Parent.with_feature.should == "maybe"
|
23
23
|
Child.with_feature.should == "no"
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
@@ -54,13 +54,13 @@ module Netzke
|
|
54
54
|
|
55
55
|
class VeryDeepNestedComponent < Base
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
class ComponentOne < Base
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
class ComponentTwo < Base
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
class SomeComposite < Base
|
65
65
|
component :component_one do
|
66
66
|
{
|
@@ -68,11 +68,11 @@ module Netzke
|
|
68
68
|
:title => "My Cool Component"
|
69
69
|
}
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
def config
|
73
73
|
{
|
74
74
|
:items => [
|
75
|
-
{:class_name => "ComponentTwo", :name => "my_component_two"},
|
75
|
+
{:class_name => "ComponentTwo", :name => "my_component_two"},
|
76
76
|
{:class_name => "ComponentTwo"} # name omitted, will be "component_two1"
|
77
77
|
]
|
78
78
|
}.deep_merge super
|
@@ -96,37 +96,37 @@ module Netzke
|
|
96
96
|
nested_component_two.global_id.should == 'some_component__nested_two'
|
97
97
|
deep_nested_component.global_id.should == 'some_component__nested_two__nested'
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
it "should be possible to define nested components in different ways" do
|
101
101
|
composite = SomeComposite.new
|
102
102
|
components = composite.components
|
103
|
-
|
103
|
+
|
104
104
|
components.keys.size.should == 3
|
105
105
|
components[:component_one][:class_name].should == "ComponentOne"
|
106
106
|
components[:my_component_two][:class_name].should == "ComponentTwo"
|
107
107
|
components[:component_two1][:class_name].should == "ComponentTwo"
|
108
|
-
|
108
|
+
|
109
109
|
end
|
110
110
|
|
111
111
|
# DIDN'T WORK OUT till now
|
112
112
|
# it "should be possible to override the superclass's declaration of a component" do
|
113
113
|
# composite = SomeComposite.new
|
114
114
|
# composite.components[:component_one][:title].should == "My Cool Component"
|
115
|
-
#
|
115
|
+
#
|
116
116
|
# class ExtendedComposite < SomeComposite
|
117
117
|
# component :component_one do |orig|
|
118
118
|
# orig.merge(:title => orig[:title] + ", extended")
|
119
119
|
# end
|
120
|
-
#
|
120
|
+
#
|
121
121
|
# component :component_two do
|
122
122
|
# {:title => "Another Nested Component"}
|
123
123
|
# end
|
124
124
|
# end
|
125
|
-
#
|
125
|
+
#
|
126
126
|
# extended_composite = ExtendedComposite.new
|
127
127
|
# extended_composite.components[:component_one][:title].should == "My Cool Component, extended"
|
128
128
|
# extended_composite.components[:component_one][:class_name].should == "ComponentOne"
|
129
129
|
# extended_composite.components[:component_two][:title].should == "Another Nested Component"
|
130
130
|
# end
|
131
|
-
end
|
131
|
+
end
|
132
132
|
end
|
data/spec/core_ext_spec.rb
CHANGED
@@ -4,10 +4,10 @@ describe "Core extensions" do
|
|
4
4
|
it "should properly do deep_each_pair" do
|
5
5
|
res = {}
|
6
6
|
{
|
7
|
-
:one => 1,
|
8
|
-
:two => {:three => 3},
|
7
|
+
:one => 1,
|
8
|
+
:two => {:three => 3},
|
9
9
|
:nine => [
|
10
|
-
{:four => 4, :five => {:six => 6}},
|
10
|
+
{:four => 4, :five => {:six => 6}},
|
11
11
|
{:seven => [{:eight => 8}]}
|
12
12
|
]
|
13
13
|
}.deep_each_pair{ |k,v| res[k] = v }
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class ComponentLoader < Netzke::Base
|
2
2
|
component :simple_component, :title => "Simple Component", :lazy_loading => true
|
3
|
-
|
3
|
+
|
4
4
|
component :component_loaded_in_window, {
|
5
5
|
:class_name => "SimpleComponent",
|
6
6
|
:title => "Component loaded in window",
|
7
7
|
:lazy_loading => true
|
8
8
|
}
|
9
|
-
|
9
|
+
|
10
10
|
component :window_with_simple_component, {
|
11
11
|
:class_name => "SimpleWindow",
|
12
12
|
:items => [{
|
@@ -15,7 +15,7 @@ class ComponentLoader < Netzke::Base
|
|
15
15
|
}],
|
16
16
|
:lazy_loading => true
|
17
17
|
}
|
18
|
-
|
18
|
+
|
19
19
|
js_method :on_load_with_feedback, <<-JS
|
20
20
|
function(){
|
21
21
|
this.loadComponent({name: 'simple_component', callback: function(){
|
@@ -25,7 +25,7 @@ class ComponentLoader < Netzke::Base
|
|
25
25
|
JS
|
26
26
|
|
27
27
|
action :load_with_feedback
|
28
|
-
|
28
|
+
|
29
29
|
action :load_window_with_simple_component
|
30
30
|
|
31
31
|
js_properties(
|
@@ -33,21 +33,21 @@ class ComponentLoader < Netzke::Base
|
|
33
33
|
:layout => "fit",
|
34
34
|
:bbar => [{:text => "Load component", :ref => "../button"}, {:text => "Load in window", :ref => "../loadInWindowButton"}, :load_with_feedback.action, :load_window_with_simple_component.action]
|
35
35
|
)
|
36
|
-
|
36
|
+
|
37
37
|
js_method :on_load_window_with_simple_component, <<-JS
|
38
38
|
function(params){
|
39
39
|
this.loadComponent({name: "window_with_simple_component"});
|
40
40
|
}
|
41
41
|
JS
|
42
|
-
|
42
|
+
|
43
43
|
js_method :init_component, <<-JS
|
44
44
|
function(){
|
45
45
|
#{js_full_class_name}.superclass.initComponent.call(this);
|
46
|
-
|
46
|
+
|
47
47
|
this.button.on('click', function(){
|
48
48
|
this.loadComponent({name: 'simple_component', container: this.getId()});
|
49
49
|
}, this);
|
50
|
-
|
50
|
+
|
51
51
|
this.loadInWindowButton.on('click', function(){
|
52
52
|
var w = new Ext.Window({width: 500, height: 400, modal: true, layout:'fit'});
|
53
53
|
w.show(null, function(){
|
@@ -1,21 +1,21 @@
|
|
1
1
|
class ComponentWithActions < Netzke::Base
|
2
2
|
# Define actions as a hash
|
3
3
|
action :another_action, :disabled => true, :text => "Disabled action", :icon => :accept
|
4
|
-
|
4
|
+
|
5
5
|
# ... or as a block returning hash
|
6
6
|
action :some_action do
|
7
7
|
{:text => "Some Cool Action", :icon => Netzke::Core.icons_uri + "/delete.png"}
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
# ... or directly as a method
|
11
11
|
def _my_action_action
|
12
12
|
{:text => "Not used"}
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
js_property :title, "Panel that has actions"
|
16
|
-
|
16
|
+
|
17
17
|
js_property :bbar, [:some_action.action, :another_action.action]
|
18
|
-
|
18
|
+
|
19
19
|
js_property :tbar, [{
|
20
20
|
:xtype => 'buttongroup',
|
21
21
|
:columns => 3,
|
@@ -37,22 +37,22 @@ class ComponentWithActions < Netzke::Base
|
|
37
37
|
:menu => [:some_action.action]
|
38
38
|
},{
|
39
39
|
:xtype => 'splitbutton', :text => 'Cut', :menu => [:another_action.action]
|
40
|
-
}, :another_action.action,
|
40
|
+
}, :another_action.action,
|
41
41
|
{
|
42
42
|
:menu => [:some_action.action], :text => 'Format'
|
43
43
|
}]
|
44
44
|
}]
|
45
|
-
|
45
|
+
|
46
46
|
js_method :on_some_action, <<-JS
|
47
47
|
function(){
|
48
48
|
this.update("Some action was triggered");
|
49
49
|
}
|
50
50
|
JS
|
51
|
-
|
51
|
+
|
52
52
|
js_method :on_another_action, <<-JS
|
53
53
|
function(){
|
54
54
|
this.update("Another action was triggered");
|
55
55
|
}
|
56
56
|
JS
|
57
|
-
|
57
|
+
|
58
58
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# This component has the header hidden by custom CSS
|
2
2
|
class ComponentWithCustomCss < Netzke::Base
|
3
3
|
js_property :title, "ComponentWithCustomCss"
|
4
|
-
|
4
|
+
|
5
5
|
js_property :html, "A component with the header hidden by means of custom CSS"
|
6
|
-
|
6
|
+
|
7
7
|
css_include "#{File.dirname(__FILE__)}/custom.css"
|
8
8
|
end
|
@@ -1,16 +1,16 @@
|
|
1
1
|
class ComponentWithIncludedJs < Netzke::Base
|
2
2
|
js_include "#{File.dirname(__FILE__)}/included.js"
|
3
|
-
|
3
|
+
|
4
4
|
js_base_class "Netzke.ComponentWithIncludedJs"
|
5
|
-
|
5
|
+
|
6
6
|
action :print_message
|
7
|
-
|
7
|
+
|
8
8
|
js_property :bbar, [:print_message.action]
|
9
|
-
|
9
|
+
|
10
10
|
js_method :on_print_message, <<-JS
|
11
11
|
function(){
|
12
12
|
this.updateBodyWithMessage("Some message " + "shown in the body");
|
13
13
|
}
|
14
14
|
JS
|
15
|
-
|
15
|
+
|
16
16
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class ComponentWithSessionPersistence < Netzke::Base
|
2
2
|
js_property :title, "No Title (yet!)"
|
3
3
|
js_property :bbar, [{:text => "Tell server to store new title", :ref => "../button"}]
|
4
|
-
|
4
|
+
|
5
5
|
config :default, :session_persistence => true
|
6
6
|
|
7
7
|
js_method :bug_server, <<-JS
|
@@ -16,10 +16,10 @@ class ComponentWithSessionPersistence < Netzke::Base
|
|
16
16
|
this.button.on('click', this.bugServer, this);
|
17
17
|
}
|
18
18
|
JS
|
19
|
-
|
19
|
+
|
20
20
|
endpoint :whats_up do |params|
|
21
21
|
update_session_options(:title => "New Title!")
|
22
22
|
{}
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
end
|
@@ -2,7 +2,7 @@ module Deprecated
|
|
2
2
|
class ServerCaller < Netzke::Base
|
3
3
|
js_properties :title => "Server caller",
|
4
4
|
:bbar => [:call_server.action]
|
5
|
-
|
5
|
+
|
6
6
|
js_method :on_call_server, <<-JS
|
7
7
|
function(){
|
8
8
|
this.whatsUp();
|
@@ -12,7 +12,7 @@ module Deprecated
|
|
12
12
|
ActiveSupport::Deprecation.silence do
|
13
13
|
api :whats_up
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def whats_up(params)
|
17
17
|
{:set_title => "Hello from the server!"}
|
18
18
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class ExtendedServerCaller < ServerCaller
|
2
|
-
|
2
|
+
|
3
3
|
js_properties :title => "Extended Server Caller"
|
4
|
-
|
4
|
+
|
5
5
|
js_method :on_bug_server, <<-JS
|
6
6
|
function(){
|
7
7
|
#{js_full_class_name}.superclass.onBugServer.call(this);
|
@@ -14,5 +14,5 @@ class ExtendedServerCaller < ServerCaller
|
|
14
14
|
orig = super
|
15
15
|
orig.merge(:set_title => orig[:set_title] + ", shiny weather")
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
end
|
@@ -2,34 +2,34 @@ class KindaComplexComponent < Netzke::Base
|
|
2
2
|
# Note the use of ActiveSupport::Concern module
|
3
3
|
module BasicStuff
|
4
4
|
extend ActiveSupport::Concern
|
5
|
-
|
5
|
+
|
6
6
|
included do
|
7
7
|
action :some_action
|
8
8
|
action :another_action
|
9
|
-
|
9
|
+
|
10
10
|
# Calling main class' methods is simple
|
11
11
|
js_method :on_some_action, <<-JS
|
12
12
|
function(){ this.items.last().setTitle("Action triggered"); }
|
13
13
|
JS
|
14
|
-
|
14
|
+
|
15
15
|
# Another way of defining a JS method
|
16
16
|
js_method :on_another_action do
|
17
17
|
<<-JS
|
18
18
|
function(){ this.items.first().setTitle("Another action triggered"); }
|
19
19
|
JS
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
js_properties(
|
23
23
|
:active_tab => 0, :bbar => [:some_action.action, :another_action.action]
|
24
24
|
)
|
25
|
-
|
25
|
+
|
26
26
|
# Instance method, overridden in the ExtraStuff module
|
27
|
-
# config
|
27
|
+
# config
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def final_config
|
31
31
|
super.merge(:items => [{:title => "Panel One"}, {:title => "Panel Two"}])
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
end
|
35
35
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Loads a component with custom CSS, to make sure that also dynamically loaded components get the correct CSS applied
|
2
2
|
class LoaderOfComponentWithCustomCss < Netzke::Base
|
3
3
|
component :component_with_custom_css, :class_name => "ComponentWithCustomCss", :lazy_loading => true
|
4
|
-
|
4
|
+
|
5
5
|
js_properties :title => "LoaderOfComponentWithCustomCss", :layout => 'fit', :bbar => [{:text => "Load ComponentWithCustomCss", :ref => "../button"}]
|
6
|
-
|
6
|
+
|
7
7
|
js_method :init_component, <<-JS
|
8
8
|
function(){
|
9
9
|
#{js_full_class_name}.superclass.initComponent.call(this);
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class ServerCaller < Netzke::Base
|
2
2
|
action :bug_server, :text => "Call server"
|
3
|
-
|
3
|
+
|
4
4
|
js_properties(
|
5
5
|
:title => "Server Caller",
|
6
6
|
:html => "Wow",
|
7
7
|
:bbar => [:bug_server.action]
|
8
8
|
)
|
9
|
-
|
9
|
+
|
10
10
|
js_method :on_bug_server, <<-JS
|
11
11
|
function(){
|
12
12
|
this.whatsUp();
|
@@ -17,5 +17,5 @@ class ServerCaller < Netzke::Base
|
|
17
17
|
endpoint :whats_up do |params|
|
18
18
|
{:set_title => "All quiet here on the server"}
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
end
|
@@ -1,65 +1,65 @@
|
|
1
1
|
class SomeComposite < Netzke::Base
|
2
|
-
js_properties :title => "Static Composite",
|
2
|
+
js_properties :title => "Static Composite",
|
3
3
|
:layout => 'border',
|
4
4
|
:bbar => [
|
5
|
-
:update_west_panel.action,
|
5
|
+
:update_west_panel.action,
|
6
6
|
:update_center_panel.action,
|
7
7
|
:update_west_from_server.action,
|
8
8
|
:update_east_south_from_server.action
|
9
9
|
]
|
10
|
-
|
10
|
+
|
11
11
|
action :update_center_panel
|
12
12
|
action :update_west_panel
|
13
13
|
action :update_west_from_server
|
14
14
|
action :update_east_south_from_server
|
15
|
-
|
15
|
+
|
16
16
|
config :items => [
|
17
17
|
:center_panel.component(:region => 'center'),
|
18
18
|
:west_panel.component(:region => 'west', :width => 300, :split => true),
|
19
19
|
{:layout => 'border', :region => :east, :width => 500, :split => true, :items => [
|
20
|
-
:east_center_panel.component(:region => :center),
|
20
|
+
:east_center_panel.component(:region => :center),
|
21
21
|
:east_south_panel.component(:region => :south, :height => 200, :split => true)
|
22
22
|
]},
|
23
23
|
]
|
24
|
-
|
24
|
+
|
25
25
|
component :west_panel, :class_name => "ExtendedServerCaller"
|
26
|
-
|
26
|
+
|
27
27
|
component :center_panel, :class_name => "ServerCaller"
|
28
|
-
|
28
|
+
|
29
29
|
component :east_center_panel, :class_name => "SimpleComponent", :title => "A panel"
|
30
|
-
|
30
|
+
|
31
31
|
component :east_south_panel, :class_name => "SimpleComponent", :title => "Another panel"
|
32
|
-
|
32
|
+
|
33
33
|
endpoint :update_east_south do |params|
|
34
34
|
{:east_south_panel => {:set_title => "Here's an update for south panel in east panel"}}
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
endpoint :update_west do |params|
|
38
38
|
{:west_panel => {:set_title => "Here's an update for west panel"}}
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
js_method :on_update_west_panel, <<-JS
|
42
42
|
function(){
|
43
43
|
this.items.filter('name', 'west_panel').first().body.update('West Panel Body Updated');
|
44
44
|
}
|
45
45
|
JS
|
46
|
-
|
46
|
+
|
47
47
|
js_method :on_update_center_panel, <<-JS
|
48
48
|
function(){
|
49
49
|
this.items.filter('name', 'center_panel').first().body.update('Center Panel Body Updated');
|
50
50
|
}
|
51
51
|
JS
|
52
|
-
|
52
|
+
|
53
53
|
js_method :on_update_east_south_from_server, <<-JS
|
54
54
|
function(){
|
55
55
|
this.updateEastSouth();
|
56
56
|
}
|
57
57
|
JS
|
58
|
-
|
58
|
+
|
59
59
|
js_method :on_update_west_from_server, <<-JS
|
60
60
|
function(){
|
61
61
|
this.updateWest();
|
62
62
|
}
|
63
63
|
JS
|
64
|
-
|
64
|
+
|
65
65
|
end
|