netzke-core 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +16 -1
- data/Gemfile +12 -0
- data/README.md +22 -15
- data/Rakefile +19 -38
- data/app/controllers/netzke_controller.rb +1 -79
- data/javascripts/ext.js +17 -13
- data/lib/netzke/base.rb +6 -2
- data/lib/netzke/core/action_config.rb +7 -0
- data/lib/netzke/core/actions.rb +6 -32
- data/lib/netzke/core/client_class.rb +1 -1
- data/lib/netzke/core/component_config.rb +1 -1
- data/lib/netzke/core/composition.rb +17 -111
- data/lib/netzke/core/config_to_dsl_delegator.rb +0 -7
- data/lib/netzke/core/configuration.rb +48 -0
- data/lib/netzke/core/dsl_support.rb +71 -0
- data/lib/netzke/core/dynamic_assets.rb +10 -1
- data/lib/netzke/core/embedding.rb +2 -2
- data/lib/netzke/core/html.rb +29 -0
- data/lib/netzke/core/javascript.rb +32 -26
- data/lib/netzke/core/railz/action_view_ext/ext.rb +2 -2
- data/lib/netzke/core/railz/controller_extensions.rb +96 -3
- data/lib/netzke/core/railz/routes.rb +14 -3
- data/lib/netzke/core/ruby_ext/array.rb +4 -18
- data/lib/netzke/core/ruby_ext/hash.rb +19 -25
- data/lib/netzke/core/ruby_ext/time_with_zone.rb +1 -1
- data/lib/netzke/core/ruby_ext.rb +0 -2
- data/lib/netzke/core/session.rb +8 -1
- data/lib/netzke/core/state.rb +3 -3
- data/lib/netzke/core/version.rb +1 -1
- data/lib/netzke/core.rb +15 -7
- data/lib/netzke-core.rb +2 -9
- data/tasks/app_test_tasks.rake +94 -0
- data/tasks/rake_helper.rb +51 -0
- data/test/core_test_app/README +2 -2
- data/test/core_test_app/app/assets/javascripts/expect/expect.js +1253 -0
- data/test/core_test_app/app/assets/javascripts/mocha/mocha.js +5340 -0
- data/test/core_test_app/app/assets/stylesheets/mocha/mocha.css +231 -0
- data/test/core_test_app/app/components/{component_with_actions.rb → actions.rb} +7 -9
- data/test/core_test_app/app/components/{some_composite.rb → composition.rb} +16 -5
- data/test/core_test_app/app/components/{component_with_custom_css → css_inclusion}/stylesheets/custom.css +2 -2
- data/test/core_test_app/app/components/css_inclusion.rb +12 -0
- data/test/core_test_app/app/components/{component_loader/javascripts/component_loader.js → dynamic_loading/javascripts/dynamic_loading.js} +9 -1
- data/test/core_test_app/app/components/{component_loader.rb → dynamic_loading.rb} +12 -5
- data/test/core_test_app/app/components/{server_caller/javascripts/server_caller.js → endpoints/javascripts/endpoints.js} +10 -6
- data/test/core_test_app/app/components/{server_caller.rb → endpoints.rb} +12 -8
- data/test/core_test_app/app/components/{extended_server_caller.rb → endpoints_extended.rb} +6 -4
- data/test/core_test_app/app/components/ext_direct/composite.rb +5 -1
- data/test/core_test_app/app/components/feedback.rb +26 -0
- data/test/core_test_app/app/components/haml_panel/html/body.html.haml +10 -0
- data/test/core_test_app/app/components/haml_panel/html/server_response.html.haml +3 -0
- data/test/core_test_app/app/components/haml_panel.rb +32 -0
- data/test/core_test_app/app/components/hello_world.rb +1 -0
- data/test/core_test_app/app/components/js_inclusion/javascripts/extra_one.js +2 -0
- data/test/core_test_app/app/components/js_inclusion/javascripts/extra_two.js +2 -0
- data/test/core_test_app/app/components/js_inclusion/javascripts/js_inclusion.js +5 -0
- data/test/core_test_app/app/components/{component_with_js_mixin → js_inclusion}/javascripts/method_set_one.js +0 -0
- data/test/core_test_app/app/components/{component_with_js_mixin → js_inclusion}/javascripts/method_set_two.js +0 -0
- data/test/core_test_app/app/components/{component_with_js_mixin.rb → js_inclusion.rb} +3 -3
- data/test/core_test_app/app/components/js_inclusion_extended/javascripts/some_method_set.js +5 -0
- data/test/core_test_app/app/components/js_inclusion_extended.rb +6 -0
- data/test/core_test_app/app/components/loaded_css_inclusion.rb +22 -0
- data/test/core_test_app/app/components/{localized_panel.rb → localization.rb} +5 -5
- data/test/core_test_app/app/components/localization_extended.rb +2 -0
- data/test/core_test_app/app/components/persistence.rb +60 -0
- data/test/core_test_app/app/components/persistence_with_shared_state.rb +7 -0
- data/test/core_test_app/app/components/plugin_with_actions.rb +24 -0
- data/test/core_test_app/app/components/plugin_with_components.rb +3 -3
- data/test/core_test_app/app/components/plugin_with_endpoints.rb +29 -0
- data/test/core_test_app/app/components/plugins.rb +9 -0
- data/test/core_test_app/app/components/{kinda_complex_component → ruby_modules}/basic_stuff.rb +1 -1
- data/test/core_test_app/app/components/{kinda_complex_component → ruby_modules}/extra_stuff.rb +3 -3
- data/test/core_test_app/app/components/{kinda_complex_component.rb → ruby_modules.rb} +1 -1
- data/test/core_test_app/app/components/scoped/deeply_scoped/scoping.rb +10 -0
- data/test/core_test_app/app/components/scoped/scoping.rb +8 -0
- data/test/core_test_app/app/components/scoped/scoping_extended.rb +8 -0
- data/test/core_test_app/app/components/self_reloading.rb +25 -0
- data/test/core_test_app/app/components/server_counter/javascripts/server_counter.js +4 -4
- data/test/core_test_app/app/components/server_counter.rb +10 -10
- data/test/core_test_app/app/components/simple_authentication_component.rb +1 -0
- data/test/core_test_app/app/components/simple_component.rb +0 -4
- data/test/core_test_app/app/components/simple_composite.rb +1 -1
- data/test/core_test_app/app/components/simple_form_with_file_upload.rb +1 -2
- data/test/core_test_app/app/components/simple_tab_panel.rb +5 -3
- data/test/core_test_app/app/components/{panel_with_tools.rb → tools.rb} +3 -3
- data/test/core_test_app/app/components/window_with_simple_component.rb +1 -0
- data/test/core_test_app/app/controllers/alternative_controller.rb +10 -0
- data/test/core_test_app/app/controllers/specs_controller.rb +11 -0
- data/test/core_test_app/app/views/layouts/application.html.erb +19 -1
- data/test/core_test_app/app/views/simple_rails/multiple_nested.html.erb +2 -2
- data/test/core_test_app/config/boot.rb +3 -10
- data/test/core_test_app/config/environments/development.rb +1 -0
- data/test/core_test_app/config/initializers/netzke.rb +4 -1
- data/test/core_test_app/config/locales/en.yml +11 -4
- data/test/core_test_app/config/locales/es.yml +1 -4
- data/test/core_test_app/config/routes.rb +10 -1
- data/test/core_test_app/core_test_app.tmproj +254 -0
- data/test/core_test_app/db/development.sqlite3 +0 -0
- data/test/core_test_app/{lib/tasks/.gitkeep → db/test.sqlite3} +0 -0
- data/test/core_test_app/log/development.log +78046 -0
- data/test/core_test_app/log/production.log +18 -0
- data/test/core_test_app/log/test.log +120048 -0
- data/test/core_test_app/rails_app.tmproj +324 -0
- data/test/core_test_app/tmp/cache/assets/C8B/BF0/sprockets%2F54de2792b036d1dab855f88599503551 +0 -0
- data/test/core_test_app/tmp/cache/assets/C92/5A0/sprockets%2F39e75754782ee12179bf35c9a0971d80 +0 -0
- data/test/core_test_app/tmp/cache/assets/C99/720/sprockets%2F981d5a1b957a012e380b22011a6d176d +0 -0
- data/test/core_test_app/tmp/cache/assets/C9F/750/sprockets%2F20ce3d64040a5d3a0a8883bd60754356 +0 -0
- data/test/core_test_app/tmp/cache/assets/CC4/C00/sprockets%2Fc615df52887d8c2e67e8413576a419c5 +0 -0
- data/test/core_test_app/tmp/cache/assets/CF1/3F0/sprockets%2Fc69ee42924fab565a3533d56473ce878 +0 -0
- data/test/core_test_app/tmp/cache/assets/D0E/870/sprockets%2Fa593bf4fac106add88c9434141a49663 +0 -0
- data/test/core_test_app/tmp/cache/assets/D14/8E0/sprockets%2F20748e8d1d7d090d122904a9fe6f18fc +0 -0
- data/test/core_test_app/tmp/cache/assets/D3E/DA0/sprockets%2Fa175f1ac5996544b908ba3ba3f64c4f3 +0 -0
- data/test/core_test_app/tmp/cache/assets/D43/C00/sprockets%2F7bc60c758776356d615ab5edff201ee2 +0 -0
- data/test/core_test_app/tmp/cache/assets/D4B/C50/sprockets%2F8483b7e322da338e8f9eb3b30a957e9a +0 -0
- data/test/core_test_app/tmp/cache/assets/D64/090/sprockets%2F5a01ff309c3f2503eb5e4f5667cca4b3 +0 -0
- data/test/core_test_app/tmp/cache/assets/D8B/FB0/sprockets%2F7a86225caaa389f1be600b4f3a2d1ef0 +0 -0
- data/test/core_test_app/tmp/cache/assets/D98/9C0/sprockets%2F18b80e8fe200aebc522e561a867ea6fb +0 -0
- data/test/core_test_app/tmp/cache/assets/DB0/6E0/sprockets%2F03e33f5a4779eeb48bcfc86ee717fb55 +0 -0
- data/test/core_test_app/tmp/cache/assets/DED/7E0/sprockets%2Feaedd52ba538f19e4ab543a3e20ce2c4 +0 -0
- data/test/core_test_app/tmp/cache/assets/E07/FF0/sprockets%2Fb3c071e0a6de36f041adbbdaa8ab060b +0 -0
- data/test/core_test_app/tmp/capybara/capybara-20101214105940.html +40 -0
- data/test/core_test_app/tmp/capybara/capybara-20101214110642.html +40 -0
- data/test/core_test_app/tmp/capybara/capybara-20101214110749.html +40 -0
- data/test/core_test_app/tmp/capybara/capybara-20101214110750.html +40 -0
- data/test/core_test_app/tmp/capybara/capybara-20101214111025.html +40 -0
- data/test/core_test_app/tmp/capybara/capybara-20101214111027.html +40 -0
- data/test/core_test_app/tmp/capybara/capybara-20101214111213.html +40 -0
- data/test/core_test_app/tmp/capybara/capybara-20101214111214.html +40 -0
- data/test/core_test_app/tmp/capybara/capybara-20101214111332.html +40 -0
- data/test/core_test_app/tmp/capybara/capybara-20101214111333.html +40 -0
- data/test/core_test_app/{spec/component → tmp/pids/passenger.3000.pid.lock} +0 -0
- metadata +370 -133
- data/.autotest +0 -1
- data/.travis.yml +0 -18
- data/Manifest +0 -50
- data/config/ci/before-travis.sh +0 -10
- data/install.rb +0 -1
- data/lib/netzke/core/options_hash.rb +0 -27
- data/lib/netzke/core/ruby_ext/string.rb +0 -26
- data/lib/netzke/core/ruby_ext/symbol.rb +0 -13
- data/netzke-core.gemspec +0 -253
- data/test/core_test_app/.gitignore +0 -4
- data/test/core_test_app/.powrc +0 -4
- data/test/core_test_app/.rvmrc +0 -1
- data/test/core_test_app/Gemfile +0 -19
- data/test/core_test_app/Gemfile.lock +0 -147
- data/test/core_test_app/app/components/border_layout_panel.rb +0 -4
- data/test/core_test_app/app/components/card_component_loader.rb +0 -25
- data/test/core_test_app/app/components/component_with_custom_css.rb +0 -11
- data/test/core_test_app/app/components/component_with_js_mixin/javascripts/component_with_js_mixin.js +0 -5
- data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_one.js +0 -2
- data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_two.js +0 -2
- data/test/core_test_app/app/components/component_with_nested_through.rb +0 -28
- data/test/core_test_app/app/components/component_with_required_js.rb +0 -24
- data/test/core_test_app/app/components/dsl_delegated_properties.rb +0 -4
- data/test/core_test_app/app/components/dsl_delegated_properties_base.rb +0 -5
- data/test/core_test_app/app/components/extended_component_with_actions.rb +0 -9
- data/test/core_test_app/app/components/extended_component_with_js_mixin/javascripts/some_method_set.js +0 -5
- data/test/core_test_app/app/components/extended_component_with_js_mixin.rb +0 -10
- data/test/core_test_app/app/components/extended_localized_panel.rb +0 -2
- data/test/core_test_app/app/components/included.js +0 -5
- data/test/core_test_app/app/components/inline_composite.rb +0 -13
- data/test/core_test_app/app/components/loader_of_component_with_custom_css.rb +0 -23
- data/test/core_test_app/app/components/multipane_component_loader.rb +0 -41
- data/test/core_test_app/app/components/nested_component.rb +0 -17
- data/test/core_test_app/app/components/panel_with_plugin.rb +0 -9
- data/test/core_test_app/app/components/scoped_components/deep_scoped_components/some_deep_scoped_component.rb +0 -10
- data/test/core_test_app/app/components/scoped_components/extended_scoped_component.rb +0 -8
- data/test/core_test_app/app/components/scoped_components/some_scoped_component.rb +0 -8
- data/test/core_test_app/app/components/some_ext_component.rb +0 -8
- data/test/core_test_app/app/components/some_plugin.rb +0 -40
- data/test/core_test_app/app/components/stateful_component.rb +0 -46
- data/test/core_test_app/app/components/stateful_component_with_shared_state.rb +0 -11
- data/test/core_test_app/config/database.yml.travis +0 -11
- data/test/core_test_app/db/schema.rb +0 -29
- data/test/core_test_app/features/actions_and_tools.feature +0 -22
- data/test/core_test_app/features/basic.feature +0 -7
- data/test/core_test_app/features/client-server.feature +0 -19
- data/test/core_test_app/features/complex_component.feature +0 -18
- data/test/core_test_app/features/component.feature +0 -10
- data/test/core_test_app/features/component_loader.feature +0 -52
- data/test/core_test_app/features/composition.feature +0 -45
- data/test/core_test_app/features/config_to_dsl_delegation.feature +0 -10
- data/test/core_test_app/features/custom_css.feature +0 -17
- data/test/core_test_app/features/ext.direct.feature +0 -32
- data/test/core_test_app/features/file_inclusion.feature +0 -10
- data/test/core_test_app/features/i18n.feature +0 -35
- data/test/core_test_app/features/inheritance.feature +0 -18
- data/test/core_test_app/features/js_include.feature +0 -20
- data/test/core_test_app/features/nested_views.feature +0 -10
- data/test/core_test_app/features/persistence.feature +0 -34
- data/test/core_test_app/features/plugin.feature +0 -16
- data/test/core_test_app/features/rails_views.feature +0 -16
- data/test/core_test_app/features/scopes.feature +0 -14
- data/test/core_test_app/features/step_definitions/custom_css_steps.rb +0 -7
- data/test/core_test_app/features/step_definitions/generic_steps.rb +0 -64
- data/test/core_test_app/features/step_definitions/web_steps.rb +0 -219
- data/test/core_test_app/features/support/env.rb +0 -58
- data/test/core_test_app/features/support/paths.rb +0 -42
- data/test/core_test_app/spec/action_config_spec.rb +0 -15
- data/test/core_test_app/spec/actions_spec.rb +0 -96
- data/test/core_test_app/spec/base_spec.rb +0 -35
- data/test/core_test_app/spec/client_class_spec.rb +0 -17
- data/test/core_test_app/spec/composition_spec.rb +0 -118
- data/test/core_test_app/spec/core_ext_spec.rb +0 -27
- data/test/core_test_app/spec/endpoint_response_spec.rb +0 -17
- data/test/core_test_app/spec/javascript_spec.rb +0 -33
- data/test/core_test_app/spec/js_class_config_scope.rb +0 -37
- data/test/core_test_app/spec/panel_spec.rb +0 -11
- data/test/core_test_app/spec/services_spec.rb +0 -16
- data/test/core_test_app/spec/spec.opt +0 -2
- data/test/core_test_app/spec/spec_helper.rb +0 -27
- data/test/core_test_app/spec/state_spec.rb +0 -20
- data/test/core_test_app/vendor/plugins/.gitkeep +0 -0
- data/test/unit/core_ext_test.rb +0 -8
- data/test/unit/netzke_core_test.rb +0 -178
- data/uninstall.rb +0 -1
@@ -0,0 +1,22 @@
|
|
1
|
+
class LoadedCssInclusion < Netzke::Base
|
2
|
+
action :load do |c|
|
3
|
+
c.text = "Load CssInclusion"
|
4
|
+
end
|
5
|
+
|
6
|
+
component :css_inclusion
|
7
|
+
|
8
|
+
js_configure do |c|
|
9
|
+
c.layout = :fit
|
10
|
+
c.title = "LoadedCssInclusion component"
|
11
|
+
c.on_load = <<-JS
|
12
|
+
function(){
|
13
|
+
this.netzkeLoadComponent('css_inclusion');
|
14
|
+
}
|
15
|
+
JS
|
16
|
+
end
|
17
|
+
|
18
|
+
def configure(c)
|
19
|
+
super
|
20
|
+
c.bbar = [:load]
|
21
|
+
end
|
22
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class
|
1
|
+
class Localization < Netzke::Base
|
2
2
|
# This action will be translated per-class basis if the translation is available, falling back to the default
|
3
3
|
action :action_one
|
4
4
|
|
5
5
|
action :action_two do |a|
|
6
|
-
a.text = I18n.t('
|
6
|
+
a.text = I18n.t('localization.action_two')
|
7
7
|
end
|
8
8
|
|
9
9
|
action :action_three
|
@@ -13,9 +13,9 @@ class LocalizedPanel < Netzke::Base
|
|
13
13
|
|
14
14
|
c.on_render = <<-JS
|
15
15
|
function(ct){
|
16
|
-
|
16
|
+
this.callParent(this, ct);
|
17
17
|
|
18
|
-
this.body.update(this.i18n.propertyOne + "
|
18
|
+
this.body.update(this.i18n.propertyOne + " - " + this.i18n.propertyTwo);
|
19
19
|
}
|
20
20
|
JS
|
21
21
|
|
@@ -29,7 +29,7 @@ class LocalizedPanel < Netzke::Base
|
|
29
29
|
|
30
30
|
def configure(c)
|
31
31
|
super
|
32
|
-
c.title = I18n.t('
|
32
|
+
c.title = I18n.t('localization.title')
|
33
33
|
c.bbar = [:action_one, :action_two, :action_three]
|
34
34
|
end
|
35
35
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Shows how component session and state can be used for persistence
|
2
|
+
class Persistence < Netzke::Base
|
3
|
+
action :set_state
|
4
|
+
action :reset_state
|
5
|
+
|
6
|
+
action :set_session_variable
|
7
|
+
action :retrieve_session_variable
|
8
|
+
|
9
|
+
def configure(c)
|
10
|
+
super
|
11
|
+
c.bbar = [:set_state, :reset_state, :set_session_variable, :retrieve_session_variable]
|
12
|
+
|
13
|
+
# title will be gotten from component's state
|
14
|
+
c.title = state[:title] || "Default title"
|
15
|
+
end
|
16
|
+
|
17
|
+
js_configure do |c|
|
18
|
+
c.on_set_state = <<-JS
|
19
|
+
function(){
|
20
|
+
this.serverSetState();
|
21
|
+
}
|
22
|
+
JS
|
23
|
+
|
24
|
+
c.on_reset_state = <<-JS
|
25
|
+
function(){
|
26
|
+
this.serverResetState();
|
27
|
+
}
|
28
|
+
JS
|
29
|
+
|
30
|
+
c.on_set_session_variable = <<-JS
|
31
|
+
function(){
|
32
|
+
this.serverSetSessionVariable();
|
33
|
+
}
|
34
|
+
JS
|
35
|
+
|
36
|
+
c.on_retrieve_session_variable = <<-JS
|
37
|
+
function(){
|
38
|
+
this.serverRetrieveSessionVariable(null, function(result){
|
39
|
+
this.setTitle("Session variable: "+result);
|
40
|
+
})
|
41
|
+
}
|
42
|
+
JS
|
43
|
+
end
|
44
|
+
|
45
|
+
endpoint :server_set_state do |params, this|
|
46
|
+
state[:title] = "Title from state"
|
47
|
+
end
|
48
|
+
|
49
|
+
endpoint :server_reset_state do |params,this|
|
50
|
+
state.clear
|
51
|
+
end
|
52
|
+
|
53
|
+
endpoint :server_set_session_variable do |params,this|
|
54
|
+
component_session[:some_variable] = "set"
|
55
|
+
end
|
56
|
+
|
57
|
+
endpoint :server_retrieve_session_variable do |params,this|
|
58
|
+
this.netzke_set_result(component_session[:some_variable] || "not set")
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This component shares state with StatefulComponent by setting +persistence_key+ to that component's js_id (which is used as persestence_key by default)
|
2
|
+
class PersistenceWithSharedState < Persistence
|
3
|
+
def configure(c)
|
4
|
+
c.persistence_key = :persistence
|
5
|
+
super
|
6
|
+
end
|
7
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class PluginWithActions < Netzke::Plugin
|
2
|
+
action :update_title
|
3
|
+
|
4
|
+
js_configure do |c|
|
5
|
+
c.init = <<-JS
|
6
|
+
function(){
|
7
|
+
this.callParent(arguments);
|
8
|
+
|
9
|
+
// add a button to parent's toolbar
|
10
|
+
this.cmp.addDocked({
|
11
|
+
dock: 'bottom',
|
12
|
+
xtype: 'toolbar',
|
13
|
+
items: [this.actions.updateTitle]
|
14
|
+
});
|
15
|
+
}
|
16
|
+
JS
|
17
|
+
|
18
|
+
c.on_update_title = <<-JS
|
19
|
+
function(){
|
20
|
+
this.cmp.setTitle('Title updated by PluginWithActions');
|
21
|
+
}
|
22
|
+
JS
|
23
|
+
end
|
24
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class PluginWithComponents < Netzke::Plugin
|
2
2
|
js_configure do |c|
|
3
3
|
c.init = <<-JS
|
4
|
-
function(
|
5
|
-
this.
|
4
|
+
function(){
|
5
|
+
this.callParent(arguments);
|
6
6
|
this.cmp.tools = this.cmp.tools || [];
|
7
7
|
this.cmp.tools.push({type: 'help', handler: function(){
|
8
8
|
// we can instantiate this because it was eagerly loaded
|
@@ -16,7 +16,7 @@ class PluginWithComponents < Netzke::Plugin
|
|
16
16
|
component :simple_window do |c|
|
17
17
|
c.width = 300
|
18
18
|
c.height = 200
|
19
|
-
c.title = "Window
|
19
|
+
c.title = "Window added by PluginWithComponents"
|
20
20
|
c.eager_loading = true
|
21
21
|
end
|
22
22
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class PluginWithEndpoints < Netzke::Plugin
|
2
|
+
js_configure do |c|
|
3
|
+
c.init = <<-JS
|
4
|
+
function(){
|
5
|
+
this.callParent(arguments);
|
6
|
+
|
7
|
+
// inject a tool into parent
|
8
|
+
this.cmp.tools = this.cmp.tools || [];
|
9
|
+
this.cmp.tools = [{id: 'gear', handler: this.onGear, scope: this}];
|
10
|
+
}
|
11
|
+
JS
|
12
|
+
|
13
|
+
c.on_gear = <<-JS
|
14
|
+
function(){
|
15
|
+
this.serverOnGear();
|
16
|
+
}
|
17
|
+
JS
|
18
|
+
|
19
|
+
c.process_gear_callback = <<-JS
|
20
|
+
function(newTitle){
|
21
|
+
this.cmp.setTitle(newTitle);
|
22
|
+
}
|
23
|
+
JS
|
24
|
+
end
|
25
|
+
|
26
|
+
endpoint :server_on_gear do |params, this|
|
27
|
+
this.process_gear_callback("Response from server side of PluginWithEndpoints")
|
28
|
+
end
|
29
|
+
end
|
data/test/core_test_app/app/components/{kinda_complex_component → ruby_modules}/extra_stuff.rb
RENAMED
@@ -1,15 +1,15 @@
|
|
1
|
-
class
|
1
|
+
class RubyModules < Netzke::Base
|
2
2
|
module ExtraStuff
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
component :
|
6
|
+
component :endpoints
|
7
7
|
end
|
8
8
|
|
9
9
|
# Let's add another tab with a Netzke component in it
|
10
10
|
def configure(c)
|
11
11
|
super
|
12
|
-
c.items += [
|
12
|
+
c.items += [:endpoints]
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# For demo purposes. Not used for testing.
|
2
|
+
class SelfReloading < Netzke::Base
|
3
|
+
action :reload
|
4
|
+
|
5
|
+
def configure(c)
|
6
|
+
super
|
7
|
+
c.bbar = [:reload]
|
8
|
+
end
|
9
|
+
|
10
|
+
def js_configure(c)
|
11
|
+
super
|
12
|
+
state[:loaded_times] ||= 0
|
13
|
+
state[:loaded_times] += 1
|
14
|
+
|
15
|
+
c.title = "Loaded #{state[:loaded_times]} time(s)"
|
16
|
+
end
|
17
|
+
|
18
|
+
js_configure do |c|
|
19
|
+
c.on_reload = <<-JS
|
20
|
+
function(){
|
21
|
+
this.netzkeReload();
|
22
|
+
}
|
23
|
+
JS
|
24
|
+
end
|
25
|
+
end
|
@@ -39,13 +39,13 @@
|
|
39
39
|
this.update(html);
|
40
40
|
},
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
this.
|
45
|
-
this.body.update(this.panelText);
|
42
|
+
appendToTitle: function(html){
|
43
|
+
this.titl += " " + html;
|
44
|
+
this.setTitle(this.titl)
|
46
45
|
},
|
47
46
|
|
48
47
|
onFailTwoOutOfFive: function(){
|
48
|
+
this.titl = "0";
|
49
49
|
for(var i=1; i<=5; i++) {
|
50
50
|
this.failTwoOutOfFive(i);
|
51
51
|
}
|
@@ -13,17 +13,17 @@ class ServerCounter < Netzke::Base
|
|
13
13
|
def configure(c)
|
14
14
|
super
|
15
15
|
c.bbar = [:count_one_time, :count_seven_times, :count_eight_times_special, :fail_in_the_middle, :do_ordered, :fail_two_out_of_five]
|
16
|
-
c.title "Server Counter"
|
16
|
+
c.title = "Server Counter"
|
17
17
|
end
|
18
18
|
|
19
19
|
endpoint :count do |params, this|
|
20
20
|
component_session[:count] ||= 0
|
21
21
|
component_session[:count] += params[:how_many]
|
22
|
-
this.
|
22
|
+
this.set_title("I am at " + component_session[:count].to_s + (params[:special] ? ' and i was invoked specially' : ''))
|
23
23
|
end
|
24
24
|
|
25
25
|
endpoint :successing_endpoint do |params, this|
|
26
|
-
this.
|
26
|
+
this.set_title("Something successed ")
|
27
27
|
end
|
28
28
|
|
29
29
|
endpoint :failing_endpoint do |params, this|
|
@@ -31,15 +31,15 @@ class ServerCounter < Netzke::Base
|
|
31
31
|
end
|
32
32
|
|
33
33
|
endpoint :first_ep do |params, this|
|
34
|
-
component_session[:
|
35
|
-
component_session[:
|
36
|
-
this.
|
34
|
+
component_session[:count2]||=0
|
35
|
+
component_session[:count2]+=1
|
36
|
+
this.set_title("First. "+ component_session[:count2].to_s)
|
37
37
|
end
|
38
38
|
|
39
39
|
endpoint :second_ep do |params, this|
|
40
|
-
component_session[:
|
41
|
-
component_session[:
|
42
|
-
this.
|
40
|
+
component_session[:count2]||=0
|
41
|
+
component_session[:count2]+=1
|
42
|
+
this.set_title("Second. "+ component_session[:count2].to_s)
|
43
43
|
end
|
44
44
|
|
45
45
|
endpoint :fail_two_out_of_five do |count, this|
|
@@ -53,7 +53,7 @@ class ServerCounter < Netzke::Base
|
|
53
53
|
end
|
54
54
|
|
55
55
|
component_session[:is_retry] = false
|
56
|
-
this.
|
56
|
+
this.append_to_title(count)
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
@@ -1,11 +1,10 @@
|
|
1
|
-
# Not used in
|
1
|
+
# For demo purposes. Not used in testing.
|
2
2
|
class SimpleFormWithFileUpload < Netzke::Base
|
3
3
|
js_configure do |c|
|
4
4
|
c.extend = "Ext.form.Panel"
|
5
5
|
c.body_padding = 10
|
6
6
|
c.on_submit = <<-JS
|
7
7
|
function(){
|
8
|
-
|
9
8
|
var msg = function(title, msg) {
|
10
9
|
Ext.Msg.show({
|
11
10
|
title: title,
|
@@ -4,11 +4,13 @@ class SimpleTabPanel < Netzke::Base
|
|
4
4
|
c.active_tab = 0
|
5
5
|
end
|
6
6
|
|
7
|
-
component :
|
7
|
+
component :endpoints
|
8
|
+
|
8
9
|
component :hello_world do |c|
|
9
10
|
c.excluded = true
|
10
11
|
end
|
11
|
-
|
12
|
+
|
13
|
+
component :endpoints_extended
|
12
14
|
|
13
15
|
component :simple_panel_one do |c|
|
14
16
|
c.klass = SimplePanel
|
@@ -19,7 +21,7 @@ class SimpleTabPanel < Netzke::Base
|
|
19
21
|
end
|
20
22
|
|
21
23
|
def configure(c)
|
22
|
-
c.items = [:
|
24
|
+
c.items = [:endpoints, :hello_world, :endpoints_extended, :simple_panel_one, :simple_panel_two]
|
23
25
|
super
|
24
26
|
end
|
25
27
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Tools < Netzke::Base
|
2
2
|
def configure(c)
|
3
3
|
super
|
4
4
|
c.tools = [:refresh, :gear]
|
@@ -7,13 +7,13 @@ class PanelWithTools < Netzke::Base
|
|
7
7
|
js_configure do |c|
|
8
8
|
c.on_refresh = <<-JS
|
9
9
|
function(){
|
10
|
-
this.setTitle("Refresh
|
10
|
+
this.setTitle("Refresh tool clicked");
|
11
11
|
}
|
12
12
|
JS
|
13
13
|
|
14
14
|
c.on_gear = <<-JS
|
15
15
|
function(){
|
16
|
-
this.setTitle("Gear
|
16
|
+
this.setTitle("Gear tool clicked")
|
17
17
|
}
|
18
18
|
JS
|
19
19
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Controller that can be configured in config/routes.rb to be used as NetzkeController, i.e. for processing endpoint calls. All it does is respond to any endpoint call with the same response.
|
2
|
+
class AlternativeController < ActionController::Base
|
3
|
+
include Netzke::Railz::ControllerExtensions
|
4
|
+
|
5
|
+
before_filter :do_static_endpoint_response, only: :direct
|
6
|
+
|
7
|
+
def do_static_endpoint_response
|
8
|
+
render text: direct_response(params, {netzke_feedback: ["Hit AlternativeController's before filter"]}).to_json
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'coffee-script'
|
2
|
+
|
3
|
+
# Compiles coffeescript specs on the fly
|
4
|
+
class SpecsController < ApplicationController
|
5
|
+
def show
|
6
|
+
spec_path = params[:id].gsub("__", "/")
|
7
|
+
path = "../../../../../spec/mocha/#{spec_path}.js.coffee"
|
8
|
+
coffee = File.read(File.expand_path(path, __FILE__))
|
9
|
+
render text: CoffeeScript.compile(coffee)
|
10
|
+
end
|
11
|
+
end
|
@@ -4,10 +4,28 @@
|
|
4
4
|
<title>Netzke Core Test App</title>
|
5
5
|
<%= csrf_meta_tag %>
|
6
6
|
<%= load_netzke minified: true %>
|
7
|
+
|
8
|
+
<% if params[:spec] %>
|
9
|
+
<%= javascript_include_tag "/assets/expect/expect.js" %>
|
10
|
+
<%= javascript_include_tag "/assets/mocha/mocha.js" %>
|
11
|
+
<%= stylesheet_link_tag "/assets/mocha/mocha.css" %>
|
12
|
+
<script>
|
13
|
+
mocha.setup('bdd');
|
14
|
+
mocha.setup({ignoreLeaks: true, slow: 500});
|
15
|
+
Ext.onReady(function(){
|
16
|
+
Netzke.mochaRunner = mocha.run(function(){Netzke.mochaDone = true;});
|
17
|
+
});
|
18
|
+
</script>
|
19
|
+
<%= javascript_include_tag "/specs/support__action_helper" %>
|
20
|
+
<%= javascript_include_tag "/specs/support__query_helper" %>
|
21
|
+
<%= javascript_include_tag "/specs/support__expectation_helper" %>
|
22
|
+
<%= javascript_include_tag "/specs/#{params[:spec]}" %>
|
23
|
+
<% end %>
|
24
|
+
|
7
25
|
</head>
|
8
26
|
<body>
|
9
27
|
|
10
28
|
<%= yield %>
|
11
|
-
|
29
|
+
<div id="mocha"></div>
|
12
30
|
</body>
|
13
31
|
</html>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%= netzke :tab_panel_one, {
|
2
2
|
height: 200,
|
3
3
|
class_name: "SimpleTabPanel",
|
4
|
-
items: [:
|
4
|
+
items: [:endpoints, :endpoints_extended]
|
5
5
|
} %>
|
6
6
|
|
7
7
|
<%= netzke :tab_panel_two, {
|
8
8
|
height: 200,
|
9
9
|
class_name: "SimpleTabPanel",
|
10
|
-
items: [:
|
10
|
+
items: [:endpoints_extended, :endpoints]
|
11
11
|
} %>
|
@@ -1,13 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
3
|
# Set up gems listed in the Gemfile.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
require 'bundler'
|
8
|
-
Bundler.setup
|
9
|
-
rescue Bundler::GemNotFound => e
|
10
|
-
STDERR.puts e.message
|
11
|
-
STDERR.puts "Try running `bundle install`."
|
12
|
-
exit!
|
13
|
-
end if File.exist?(gemfile)
|
4
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
@@ -1,6 +1,9 @@
|
|
1
1
|
Netzke::Core.setup do |config|
|
2
2
|
config.js_direct_max_retries = 2
|
3
|
-
|
3
|
+
config.ext_uri = "http://cdn.sencha.com/ext-4.1.1a-gpl" if ENV['EXTJS_SRC'] == 'cdn'
|
4
|
+
|
5
|
+
# feedback delay
|
6
|
+
# config.js_feedback_delay = 2000
|
4
7
|
end
|
5
8
|
|
6
9
|
ConfigurableOnClassLevel.title = "Overridden"
|
@@ -1,7 +1,14 @@
|
|
1
|
-
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
-
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
-
|
4
1
|
en:
|
2
|
+
foo:
|
3
|
+
actions:
|
4
|
+
foo_action:
|
5
|
+
text: 'Foo'
|
6
|
+
tooltip: 'Foo!'
|
7
|
+
foo_ext:
|
8
|
+
actions:
|
9
|
+
foo_action:
|
10
|
+
text: 'Foo plus'
|
11
|
+
tooltip: 'Foo plus!'
|
5
12
|
server_caller:
|
6
13
|
actions:
|
7
14
|
bug_server:
|
@@ -13,7 +20,7 @@ en:
|
|
13
20
|
bug_server:
|
14
21
|
text: Call server extensively
|
15
22
|
tooltip: This bugs server in its own way
|
16
|
-
|
23
|
+
localization:
|
17
24
|
title: Localized Panel
|
18
25
|
property_one: First property
|
19
26
|
property_two: Second property
|
@@ -1,8 +1,5 @@
|
|
1
|
-
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
-
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
-
|
4
1
|
es:
|
5
|
-
|
2
|
+
localization:
|
6
3
|
title: Panel Localizada
|
7
4
|
property_one: Primera propriedad
|
8
5
|
property_two: Segunda propriedad
|
@@ -1,5 +1,12 @@
|
|
1
1
|
RailsApp::Application.routes.draw do
|
2
|
-
|
2
|
+
# Defaults (NetzkeController mounted at /netzke)
|
3
|
+
netzke
|
4
|
+
|
5
|
+
# Specify custom mount url
|
6
|
+
# netzke "/some/path/netzke"
|
7
|
+
|
8
|
+
# Specify custom controller (AlternativeController)
|
9
|
+
# netzke '/netzke', controller: :alternative
|
3
10
|
|
4
11
|
# The priority is based upon order of creation:
|
5
12
|
# first created -> highest priority.
|
@@ -15,6 +22,8 @@ RailsApp::Application.routes.draw do
|
|
15
22
|
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
16
23
|
# resources :products
|
17
24
|
|
25
|
+
resources :specs
|
26
|
+
|
18
27
|
# Sample resource route with options:
|
19
28
|
# resources :products do
|
20
29
|
# member do
|