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.
Files changed (216) hide show
  1. data/CHANGELOG.md +16 -1
  2. data/Gemfile +12 -0
  3. data/README.md +22 -15
  4. data/Rakefile +19 -38
  5. data/app/controllers/netzke_controller.rb +1 -79
  6. data/javascripts/ext.js +17 -13
  7. data/lib/netzke/base.rb +6 -2
  8. data/lib/netzke/core/action_config.rb +7 -0
  9. data/lib/netzke/core/actions.rb +6 -32
  10. data/lib/netzke/core/client_class.rb +1 -1
  11. data/lib/netzke/core/component_config.rb +1 -1
  12. data/lib/netzke/core/composition.rb +17 -111
  13. data/lib/netzke/core/config_to_dsl_delegator.rb +0 -7
  14. data/lib/netzke/core/configuration.rb +48 -0
  15. data/lib/netzke/core/dsl_support.rb +71 -0
  16. data/lib/netzke/core/dynamic_assets.rb +10 -1
  17. data/lib/netzke/core/embedding.rb +2 -2
  18. data/lib/netzke/core/html.rb +29 -0
  19. data/lib/netzke/core/javascript.rb +32 -26
  20. data/lib/netzke/core/railz/action_view_ext/ext.rb +2 -2
  21. data/lib/netzke/core/railz/controller_extensions.rb +96 -3
  22. data/lib/netzke/core/railz/routes.rb +14 -3
  23. data/lib/netzke/core/ruby_ext/array.rb +4 -18
  24. data/lib/netzke/core/ruby_ext/hash.rb +19 -25
  25. data/lib/netzke/core/ruby_ext/time_with_zone.rb +1 -1
  26. data/lib/netzke/core/ruby_ext.rb +0 -2
  27. data/lib/netzke/core/session.rb +8 -1
  28. data/lib/netzke/core/state.rb +3 -3
  29. data/lib/netzke/core/version.rb +1 -1
  30. data/lib/netzke/core.rb +15 -7
  31. data/lib/netzke-core.rb +2 -9
  32. data/tasks/app_test_tasks.rake +94 -0
  33. data/tasks/rake_helper.rb +51 -0
  34. data/test/core_test_app/README +2 -2
  35. data/test/core_test_app/app/assets/javascripts/expect/expect.js +1253 -0
  36. data/test/core_test_app/app/assets/javascripts/mocha/mocha.js +5340 -0
  37. data/test/core_test_app/app/assets/stylesheets/mocha/mocha.css +231 -0
  38. data/test/core_test_app/app/components/{component_with_actions.rb → actions.rb} +7 -9
  39. data/test/core_test_app/app/components/{some_composite.rb → composition.rb} +16 -5
  40. data/test/core_test_app/app/components/{component_with_custom_css → css_inclusion}/stylesheets/custom.css +2 -2
  41. data/test/core_test_app/app/components/css_inclusion.rb +12 -0
  42. data/test/core_test_app/app/components/{component_loader/javascripts/component_loader.js → dynamic_loading/javascripts/dynamic_loading.js} +9 -1
  43. data/test/core_test_app/app/components/{component_loader.rb → dynamic_loading.rb} +12 -5
  44. data/test/core_test_app/app/components/{server_caller/javascripts/server_caller.js → endpoints/javascripts/endpoints.js} +10 -6
  45. data/test/core_test_app/app/components/{server_caller.rb → endpoints.rb} +12 -8
  46. data/test/core_test_app/app/components/{extended_server_caller.rb → endpoints_extended.rb} +6 -4
  47. data/test/core_test_app/app/components/ext_direct/composite.rb +5 -1
  48. data/test/core_test_app/app/components/feedback.rb +26 -0
  49. data/test/core_test_app/app/components/haml_panel/html/body.html.haml +10 -0
  50. data/test/core_test_app/app/components/haml_panel/html/server_response.html.haml +3 -0
  51. data/test/core_test_app/app/components/haml_panel.rb +32 -0
  52. data/test/core_test_app/app/components/hello_world.rb +1 -0
  53. data/test/core_test_app/app/components/js_inclusion/javascripts/extra_one.js +2 -0
  54. data/test/core_test_app/app/components/js_inclusion/javascripts/extra_two.js +2 -0
  55. data/test/core_test_app/app/components/js_inclusion/javascripts/js_inclusion.js +5 -0
  56. data/test/core_test_app/app/components/{component_with_js_mixin → js_inclusion}/javascripts/method_set_one.js +0 -0
  57. data/test/core_test_app/app/components/{component_with_js_mixin → js_inclusion}/javascripts/method_set_two.js +0 -0
  58. data/test/core_test_app/app/components/{component_with_js_mixin.rb → js_inclusion.rb} +3 -3
  59. data/test/core_test_app/app/components/js_inclusion_extended/javascripts/some_method_set.js +5 -0
  60. data/test/core_test_app/app/components/js_inclusion_extended.rb +6 -0
  61. data/test/core_test_app/app/components/loaded_css_inclusion.rb +22 -0
  62. data/test/core_test_app/app/components/{localized_panel.rb → localization.rb} +5 -5
  63. data/test/core_test_app/app/components/localization_extended.rb +2 -0
  64. data/test/core_test_app/app/components/persistence.rb +60 -0
  65. data/test/core_test_app/app/components/persistence_with_shared_state.rb +7 -0
  66. data/test/core_test_app/app/components/plugin_with_actions.rb +24 -0
  67. data/test/core_test_app/app/components/plugin_with_components.rb +3 -3
  68. data/test/core_test_app/app/components/plugin_with_endpoints.rb +29 -0
  69. data/test/core_test_app/app/components/plugins.rb +9 -0
  70. data/test/core_test_app/app/components/{kinda_complex_component → ruby_modules}/basic_stuff.rb +1 -1
  71. data/test/core_test_app/app/components/{kinda_complex_component → ruby_modules}/extra_stuff.rb +3 -3
  72. data/test/core_test_app/app/components/{kinda_complex_component.rb → ruby_modules.rb} +1 -1
  73. data/test/core_test_app/app/components/scoped/deeply_scoped/scoping.rb +10 -0
  74. data/test/core_test_app/app/components/scoped/scoping.rb +8 -0
  75. data/test/core_test_app/app/components/scoped/scoping_extended.rb +8 -0
  76. data/test/core_test_app/app/components/self_reloading.rb +25 -0
  77. data/test/core_test_app/app/components/server_counter/javascripts/server_counter.js +4 -4
  78. data/test/core_test_app/app/components/server_counter.rb +10 -10
  79. data/test/core_test_app/app/components/simple_authentication_component.rb +1 -0
  80. data/test/core_test_app/app/components/simple_component.rb +0 -4
  81. data/test/core_test_app/app/components/simple_composite.rb +1 -1
  82. data/test/core_test_app/app/components/simple_form_with_file_upload.rb +1 -2
  83. data/test/core_test_app/app/components/simple_tab_panel.rb +5 -3
  84. data/test/core_test_app/app/components/{panel_with_tools.rb → tools.rb} +3 -3
  85. data/test/core_test_app/app/components/window_with_simple_component.rb +1 -0
  86. data/test/core_test_app/app/controllers/alternative_controller.rb +10 -0
  87. data/test/core_test_app/app/controllers/specs_controller.rb +11 -0
  88. data/test/core_test_app/app/views/layouts/application.html.erb +19 -1
  89. data/test/core_test_app/app/views/simple_rails/multiple_nested.html.erb +2 -2
  90. data/test/core_test_app/config/boot.rb +3 -10
  91. data/test/core_test_app/config/environments/development.rb +1 -0
  92. data/test/core_test_app/config/initializers/netzke.rb +4 -1
  93. data/test/core_test_app/config/locales/en.yml +11 -4
  94. data/test/core_test_app/config/locales/es.yml +1 -4
  95. data/test/core_test_app/config/routes.rb +10 -1
  96. data/test/core_test_app/core_test_app.tmproj +254 -0
  97. data/test/core_test_app/db/development.sqlite3 +0 -0
  98. data/test/core_test_app/{lib/tasks/.gitkeep → db/test.sqlite3} +0 -0
  99. data/test/core_test_app/log/development.log +78046 -0
  100. data/test/core_test_app/log/production.log +18 -0
  101. data/test/core_test_app/log/test.log +120048 -0
  102. data/test/core_test_app/rails_app.tmproj +324 -0
  103. data/test/core_test_app/tmp/cache/assets/C8B/BF0/sprockets%2F54de2792b036d1dab855f88599503551 +0 -0
  104. data/test/core_test_app/tmp/cache/assets/C92/5A0/sprockets%2F39e75754782ee12179bf35c9a0971d80 +0 -0
  105. data/test/core_test_app/tmp/cache/assets/C99/720/sprockets%2F981d5a1b957a012e380b22011a6d176d +0 -0
  106. data/test/core_test_app/tmp/cache/assets/C9F/750/sprockets%2F20ce3d64040a5d3a0a8883bd60754356 +0 -0
  107. data/test/core_test_app/tmp/cache/assets/CC4/C00/sprockets%2Fc615df52887d8c2e67e8413576a419c5 +0 -0
  108. data/test/core_test_app/tmp/cache/assets/CF1/3F0/sprockets%2Fc69ee42924fab565a3533d56473ce878 +0 -0
  109. data/test/core_test_app/tmp/cache/assets/D0E/870/sprockets%2Fa593bf4fac106add88c9434141a49663 +0 -0
  110. data/test/core_test_app/tmp/cache/assets/D14/8E0/sprockets%2F20748e8d1d7d090d122904a9fe6f18fc +0 -0
  111. data/test/core_test_app/tmp/cache/assets/D3E/DA0/sprockets%2Fa175f1ac5996544b908ba3ba3f64c4f3 +0 -0
  112. data/test/core_test_app/tmp/cache/assets/D43/C00/sprockets%2F7bc60c758776356d615ab5edff201ee2 +0 -0
  113. data/test/core_test_app/tmp/cache/assets/D4B/C50/sprockets%2F8483b7e322da338e8f9eb3b30a957e9a +0 -0
  114. data/test/core_test_app/tmp/cache/assets/D64/090/sprockets%2F5a01ff309c3f2503eb5e4f5667cca4b3 +0 -0
  115. data/test/core_test_app/tmp/cache/assets/D8B/FB0/sprockets%2F7a86225caaa389f1be600b4f3a2d1ef0 +0 -0
  116. data/test/core_test_app/tmp/cache/assets/D98/9C0/sprockets%2F18b80e8fe200aebc522e561a867ea6fb +0 -0
  117. data/test/core_test_app/tmp/cache/assets/DB0/6E0/sprockets%2F03e33f5a4779eeb48bcfc86ee717fb55 +0 -0
  118. data/test/core_test_app/tmp/cache/assets/DED/7E0/sprockets%2Feaedd52ba538f19e4ab543a3e20ce2c4 +0 -0
  119. data/test/core_test_app/tmp/cache/assets/E07/FF0/sprockets%2Fb3c071e0a6de36f041adbbdaa8ab060b +0 -0
  120. data/test/core_test_app/tmp/capybara/capybara-20101214105940.html +40 -0
  121. data/test/core_test_app/tmp/capybara/capybara-20101214110642.html +40 -0
  122. data/test/core_test_app/tmp/capybara/capybara-20101214110749.html +40 -0
  123. data/test/core_test_app/tmp/capybara/capybara-20101214110750.html +40 -0
  124. data/test/core_test_app/tmp/capybara/capybara-20101214111025.html +40 -0
  125. data/test/core_test_app/tmp/capybara/capybara-20101214111027.html +40 -0
  126. data/test/core_test_app/tmp/capybara/capybara-20101214111213.html +40 -0
  127. data/test/core_test_app/tmp/capybara/capybara-20101214111214.html +40 -0
  128. data/test/core_test_app/tmp/capybara/capybara-20101214111332.html +40 -0
  129. data/test/core_test_app/tmp/capybara/capybara-20101214111333.html +40 -0
  130. data/test/core_test_app/{spec/component → tmp/pids/passenger.3000.pid.lock} +0 -0
  131. metadata +370 -133
  132. data/.autotest +0 -1
  133. data/.travis.yml +0 -18
  134. data/Manifest +0 -50
  135. data/config/ci/before-travis.sh +0 -10
  136. data/install.rb +0 -1
  137. data/lib/netzke/core/options_hash.rb +0 -27
  138. data/lib/netzke/core/ruby_ext/string.rb +0 -26
  139. data/lib/netzke/core/ruby_ext/symbol.rb +0 -13
  140. data/netzke-core.gemspec +0 -253
  141. data/test/core_test_app/.gitignore +0 -4
  142. data/test/core_test_app/.powrc +0 -4
  143. data/test/core_test_app/.rvmrc +0 -1
  144. data/test/core_test_app/Gemfile +0 -19
  145. data/test/core_test_app/Gemfile.lock +0 -147
  146. data/test/core_test_app/app/components/border_layout_panel.rb +0 -4
  147. data/test/core_test_app/app/components/card_component_loader.rb +0 -25
  148. data/test/core_test_app/app/components/component_with_custom_css.rb +0 -11
  149. data/test/core_test_app/app/components/component_with_js_mixin/javascripts/component_with_js_mixin.js +0 -5
  150. data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_one.js +0 -2
  151. data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_two.js +0 -2
  152. data/test/core_test_app/app/components/component_with_nested_through.rb +0 -28
  153. data/test/core_test_app/app/components/component_with_required_js.rb +0 -24
  154. data/test/core_test_app/app/components/dsl_delegated_properties.rb +0 -4
  155. data/test/core_test_app/app/components/dsl_delegated_properties_base.rb +0 -5
  156. data/test/core_test_app/app/components/extended_component_with_actions.rb +0 -9
  157. data/test/core_test_app/app/components/extended_component_with_js_mixin/javascripts/some_method_set.js +0 -5
  158. data/test/core_test_app/app/components/extended_component_with_js_mixin.rb +0 -10
  159. data/test/core_test_app/app/components/extended_localized_panel.rb +0 -2
  160. data/test/core_test_app/app/components/included.js +0 -5
  161. data/test/core_test_app/app/components/inline_composite.rb +0 -13
  162. data/test/core_test_app/app/components/loader_of_component_with_custom_css.rb +0 -23
  163. data/test/core_test_app/app/components/multipane_component_loader.rb +0 -41
  164. data/test/core_test_app/app/components/nested_component.rb +0 -17
  165. data/test/core_test_app/app/components/panel_with_plugin.rb +0 -9
  166. data/test/core_test_app/app/components/scoped_components/deep_scoped_components/some_deep_scoped_component.rb +0 -10
  167. data/test/core_test_app/app/components/scoped_components/extended_scoped_component.rb +0 -8
  168. data/test/core_test_app/app/components/scoped_components/some_scoped_component.rb +0 -8
  169. data/test/core_test_app/app/components/some_ext_component.rb +0 -8
  170. data/test/core_test_app/app/components/some_plugin.rb +0 -40
  171. data/test/core_test_app/app/components/stateful_component.rb +0 -46
  172. data/test/core_test_app/app/components/stateful_component_with_shared_state.rb +0 -11
  173. data/test/core_test_app/config/database.yml.travis +0 -11
  174. data/test/core_test_app/db/schema.rb +0 -29
  175. data/test/core_test_app/features/actions_and_tools.feature +0 -22
  176. data/test/core_test_app/features/basic.feature +0 -7
  177. data/test/core_test_app/features/client-server.feature +0 -19
  178. data/test/core_test_app/features/complex_component.feature +0 -18
  179. data/test/core_test_app/features/component.feature +0 -10
  180. data/test/core_test_app/features/component_loader.feature +0 -52
  181. data/test/core_test_app/features/composition.feature +0 -45
  182. data/test/core_test_app/features/config_to_dsl_delegation.feature +0 -10
  183. data/test/core_test_app/features/custom_css.feature +0 -17
  184. data/test/core_test_app/features/ext.direct.feature +0 -32
  185. data/test/core_test_app/features/file_inclusion.feature +0 -10
  186. data/test/core_test_app/features/i18n.feature +0 -35
  187. data/test/core_test_app/features/inheritance.feature +0 -18
  188. data/test/core_test_app/features/js_include.feature +0 -20
  189. data/test/core_test_app/features/nested_views.feature +0 -10
  190. data/test/core_test_app/features/persistence.feature +0 -34
  191. data/test/core_test_app/features/plugin.feature +0 -16
  192. data/test/core_test_app/features/rails_views.feature +0 -16
  193. data/test/core_test_app/features/scopes.feature +0 -14
  194. data/test/core_test_app/features/step_definitions/custom_css_steps.rb +0 -7
  195. data/test/core_test_app/features/step_definitions/generic_steps.rb +0 -64
  196. data/test/core_test_app/features/step_definitions/web_steps.rb +0 -219
  197. data/test/core_test_app/features/support/env.rb +0 -58
  198. data/test/core_test_app/features/support/paths.rb +0 -42
  199. data/test/core_test_app/spec/action_config_spec.rb +0 -15
  200. data/test/core_test_app/spec/actions_spec.rb +0 -96
  201. data/test/core_test_app/spec/base_spec.rb +0 -35
  202. data/test/core_test_app/spec/client_class_spec.rb +0 -17
  203. data/test/core_test_app/spec/composition_spec.rb +0 -118
  204. data/test/core_test_app/spec/core_ext_spec.rb +0 -27
  205. data/test/core_test_app/spec/endpoint_response_spec.rb +0 -17
  206. data/test/core_test_app/spec/javascript_spec.rb +0 -33
  207. data/test/core_test_app/spec/js_class_config_scope.rb +0 -37
  208. data/test/core_test_app/spec/panel_spec.rb +0 -11
  209. data/test/core_test_app/spec/services_spec.rb +0 -16
  210. data/test/core_test_app/spec/spec.opt +0 -2
  211. data/test/core_test_app/spec/spec_helper.rb +0 -27
  212. data/test/core_test_app/spec/state_spec.rb +0 -20
  213. data/test/core_test_app/vendor/plugins/.gitkeep +0 -0
  214. data/test/unit/core_ext_test.rb +0 -8
  215. data/test/unit/netzke_core_test.rb +0 -178
  216. data/uninstall.rb +0 -1
@@ -0,0 +1,231 @@
1
+ @charset "utf-8";
2
+
3
+ body {
4
+ font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
5
+ padding: 60px 50px;
6
+ }
7
+
8
+ #mocha ul, #mocha li {
9
+ margin: 0;
10
+ padding: 0;
11
+ }
12
+
13
+ #mocha ul {
14
+ list-style: none;
15
+ }
16
+
17
+ #mocha h1, #mocha h2 {
18
+ margin: 0;
19
+ }
20
+
21
+ #mocha h1 {
22
+ margin-top: 15px;
23
+ font-size: 1em;
24
+ font-weight: 200;
25
+ }
26
+
27
+ #mocha h1 a {
28
+ text-decoration: none;
29
+ color: inherit;
30
+ }
31
+
32
+ #mocha h1 a:hover {
33
+ text-decoration: underline;
34
+ }
35
+
36
+ #mocha .suite .suite h1 {
37
+ margin-top: 0;
38
+ font-size: .8em;
39
+ }
40
+
41
+ .hidden {
42
+ display: none;
43
+ }
44
+
45
+ #mocha h2 {
46
+ font-size: 12px;
47
+ font-weight: normal;
48
+ cursor: pointer;
49
+ }
50
+
51
+ #mocha .suite {
52
+ margin-left: 15px;
53
+ }
54
+
55
+ #mocha .test {
56
+ margin-left: 15px;
57
+ overflow: hidden;
58
+ }
59
+
60
+ #mocha .test.pending:hover h2::after {
61
+ content: '(pending)';
62
+ font-family: arial;
63
+ }
64
+
65
+ #mocha .test.pass.medium .duration {
66
+ background: #C09853;
67
+ }
68
+
69
+ #mocha .test.pass.slow .duration {
70
+ background: #B94A48;
71
+ }
72
+
73
+ #mocha .test.pass::before {
74
+ content: '✓';
75
+ font-size: 12px;
76
+ display: block;
77
+ float: left;
78
+ margin-right: 5px;
79
+ color: #00d6b2;
80
+ }
81
+
82
+ #mocha .test.pass .duration {
83
+ font-size: 9px;
84
+ margin-left: 5px;
85
+ padding: 2px 5px;
86
+ color: white;
87
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
88
+ -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
89
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
90
+ -webkit-border-radius: 5px;
91
+ -moz-border-radius: 5px;
92
+ -ms-border-radius: 5px;
93
+ -o-border-radius: 5px;
94
+ border-radius: 5px;
95
+ }
96
+
97
+ #mocha .test.pass.fast .duration {
98
+ display: none;
99
+ }
100
+
101
+ #mocha .test.pending {
102
+ color: #0b97c4;
103
+ }
104
+
105
+ #mocha .test.pending::before {
106
+ content: '◦';
107
+ color: #0b97c4;
108
+ }
109
+
110
+ #mocha .test.fail {
111
+ color: #c00;
112
+ }
113
+
114
+ #mocha .test.fail pre {
115
+ color: black;
116
+ }
117
+
118
+ #mocha .test.fail::before {
119
+ content: '✖';
120
+ font-size: 12px;
121
+ display: block;
122
+ float: left;
123
+ margin-right: 5px;
124
+ color: #c00;
125
+ }
126
+
127
+ #mocha .test pre.error {
128
+ color: #c00;
129
+ max-height: 300px;
130
+ overflow: auto;
131
+ }
132
+
133
+ #mocha .test pre {
134
+ display: block;
135
+ float: left;
136
+ clear: left;
137
+ font: 12px/1.5 monaco, monospace;
138
+ margin: 5px;
139
+ padding: 15px;
140
+ border: 1px solid #eee;
141
+ border-bottom-color: #ddd;
142
+ -webkit-border-radius: 3px;
143
+ -webkit-box-shadow: 0 1px 3px #eee;
144
+ -moz-border-radius: 3px;
145
+ -moz-box-shadow: 0 1px 3px #eee;
146
+ }
147
+
148
+ #mocha .test h2 {
149
+ position: relative;
150
+ }
151
+
152
+ #mocha .test a.replay {
153
+ position: absolute;
154
+ top: 3px;
155
+ right: 0;
156
+ text-decoration: none;
157
+ vertical-align: middle;
158
+ display: block;
159
+ width: 15px;
160
+ height: 15px;
161
+ line-height: 15px;
162
+ text-align: center;
163
+ background: #eee;
164
+ font-size: 15px;
165
+ -moz-border-radius: 15px;
166
+ border-radius: 15px;
167
+ -webkit-transition: opacity 200ms;
168
+ -moz-transition: opacity 200ms;
169
+ transition: opacity 200ms;
170
+ opacity: 0.3;
171
+ color: #888;
172
+ }
173
+
174
+ #mocha .test:hover a.replay {
175
+ opacity: 1;
176
+ }
177
+
178
+ #mocha-report.pass .test.fail {
179
+ display: none;
180
+ }
181
+
182
+ #mocha-report.fail .test.pass {
183
+ display: none;
184
+ }
185
+
186
+ #mocha-error {
187
+ color: #c00;
188
+ font-size: 1.5 em;
189
+ font-weight: 100;
190
+ letter-spacing: 1px;
191
+ }
192
+
193
+ #mocha-stats {
194
+ position: fixed;
195
+ top: 15px;
196
+ right: 10px;
197
+ font-size: 12px;
198
+ margin: 0;
199
+ color: #888;
200
+ }
201
+
202
+ #mocha-stats .progress {
203
+ float: right;
204
+ padding-top: 0;
205
+ }
206
+
207
+ #mocha-stats em {
208
+ color: black;
209
+ }
210
+
211
+ #mocha-stats a {
212
+ text-decoration: none;
213
+ color: inherit;
214
+ }
215
+
216
+ #mocha-stats a:hover {
217
+ border-bottom: 1px solid #eee;
218
+ }
219
+
220
+ #mocha-stats li {
221
+ display: inline-block;
222
+ margin: 0 5px;
223
+ list-style: none;
224
+ padding-top: 11px;
225
+ }
226
+
227
+ code .comment { color: #ddd }
228
+ code .init { color: #2F6FAD }
229
+ code .string { color: #5890AD }
230
+ code .keyword { color: #8A6343 }
231
+ code .number { color: #2F6FAD }
@@ -1,6 +1,5 @@
1
- class ComponentWithActions < Netzke::Base
2
- action :some_action do |a|
3
- a.text = "Some Cool Action"
1
+ class Actions < Netzke::Base
2
+ action :simple_action do |a|
4
3
  a.icon = Netzke::Core.icons_uri + "/tick.png" # specify full icon uri
5
4
  end
6
5
 
@@ -22,7 +21,7 @@ class ComponentWithActions < Netzke::Base
22
21
  def configure(c)
23
22
  super
24
23
  c.title = "Panel that has actions"
25
- c.bbar = [:some_action, :another_action, :action_with_custom_handler, :excluded_action]
24
+ c.bbar = [:simple_action, :another_action, :action_with_custom_handler, :excluded_action]
26
25
  c.tbar = [{
27
26
  :xtype => 'buttongroup',
28
27
  :columns => 3,
@@ -40,21 +39,20 @@ class ComponentWithActions < Netzke::Base
40
39
  :rowspan => 3,
41
40
  icon: uri_to_icon(:anchor), # use uri_to_icon helper to get the full icon uri
42
41
  :arrowAlign => 'bottom',
43
- :menu => [:some_action]
42
+ :menu => [:simple_action]
44
43
  },{
45
44
  :xtype => 'splitbutton', :text => 'Cut', :menu => [:another_action]
46
45
  }, :another_action,
47
46
  {
48
- :menu => [:some_action], :text => 'Format'
47
+ :menu => [:simple_action], :text => 'Format'
49
48
  }]
50
49
  }]
51
50
  end
52
51
 
53
52
  js_configure do |c|
54
- c.on_some_action = <<-JS
53
+ c.on_simple_action = <<-JS
55
54
  function(){
56
- this.update("Some action was triggered");
57
- this.netzke.testik();
55
+ this.setTitle("Simple action triggered");
58
56
  }
59
57
  JS
60
58
 
@@ -1,4 +1,4 @@
1
- class SomeComposite < Netzke::Base
1
+ class Composition < Netzke::Base
2
2
  js_configure do |c|
3
3
  c.height = 400
4
4
  c.layout = :border
@@ -38,12 +38,15 @@ class SomeComposite < Netzke::Base
38
38
  action :update_west_panel
39
39
  action :update_west_from_server
40
40
  action :update_east_south_from_server
41
- action :show_hidden_window
41
+ action :show_hidden_window do |c|
42
+ c.text = "Show pre-loaded window"
43
+ end
42
44
 
43
45
  def configure(c)
44
46
  super
45
47
  c.bbar = [ :update_west_panel, :update_center_panel, :update_west_from_server, :update_east_south_from_server, :show_hidden_window ]
46
48
  c.items = [
49
+ :north_panel,
47
50
  :center_panel,
48
51
  { region: :west, width: 300, split: true, component: :west_panel },
49
52
  { layout: :border, region: :east, width: 500, split: true, items: [
@@ -54,12 +57,20 @@ class SomeComposite < Netzke::Base
54
57
  end
55
58
 
56
59
  component :center_panel do |c|
57
- c.klass = ServerCaller
60
+ c.klass = Endpoints
58
61
  c.region = :center
59
62
  end
60
63
 
61
64
  component :west_panel do |c|
62
- c.klass = ExtendedServerCaller
65
+ c.klass = EndpointsExtended
66
+ end
67
+
68
+ component :north_panel do |c|
69
+ c.klass = SimpleComponent
70
+ c.title = "Should not be seen"
71
+ c.region = :north
72
+ c.height = 80
73
+ c.excluded = true
63
74
  end
64
75
 
65
76
  component :east_center_panel do |c|
@@ -78,7 +89,7 @@ class SomeComposite < Netzke::Base
78
89
  component :hidden_window do |c|
79
90
  c.klass = SimpleWindow
80
91
  c.eager_loading = true # !
81
- c.title = "Hidden window gone visible!"
92
+ c.title = "Pre-loaded window"
82
93
  c.width = 300
83
94
  c.height = 200
84
95
  c.modal = true
@@ -1,3 +1,3 @@
1
- .x-panel-body {
1
+ .require-css {
2
2
  display: none;
3
- }
3
+ }
@@ -0,0 +1,12 @@
1
+ # This component has the header hidden by using some extra styles
2
+ class CssInclusion < Netzke::Base
3
+ js_configure do |c|
4
+ c.html = "Should not be seen"
5
+ c.title = "CssInclusion component with invisible body"
6
+ c.bodyCls = "require-css" # so we can target this in custom.css
7
+ end
8
+
9
+ css_configure do |c|
10
+ c.require :custom
11
+ end
12
+ end
@@ -19,7 +19,7 @@
19
19
  },
20
20
 
21
21
  onLoadWithParams: function(params){
22
- this.netzkeLoadComponent("simple_component", {params: {html: "Simple Component" + " with changed HTML"}, container: this});
22
+ this.netzkeLoadComponent("simple_component", {params: {title: "Simple Component with modified title"}, container: this});
23
23
  },
24
24
 
25
25
  onNonExistingComponent: function(){
@@ -45,5 +45,13 @@
45
45
  var instance = Ext.ComponentManager.create(config);
46
46
  this.add(instance);
47
47
  }, scope: this});
48
+ },
49
+
50
+ onLoadSelfReloading: function() {
51
+ this.netzkeLoadComponent('self_reloading');
52
+ },
53
+
54
+ onLoadCssInclusion: function() {
55
+ this.netzkeLoadComponent('css_inclusion');
48
56
  }
49
57
  }
@@ -1,5 +1,5 @@
1
1
  # TODO: some functionality (one that is calling doNothing) does not belong here, as it loads no componens, but rather to ServerCaller. Move it there.
2
- class ComponentLoader < Netzke::Base
2
+ class DynamicLoading < Netzke::Base
3
3
  js_configure do |c|
4
4
  c.mixin
5
5
  end
@@ -16,13 +16,16 @@ class ComponentLoader < Netzke::Base
16
16
  c.height = 300
17
17
  end
18
18
 
19
- component :some_composite
19
+ component :composition
20
20
 
21
21
  component :inaccessible do |c|
22
22
  c.klass = Netzke::Core::Panel
23
23
  c.excluded = true
24
24
  end
25
25
 
26
+ component :self_reloading
27
+
28
+ component :css_inclusion
26
29
 
27
30
  # this action is using netzkeLoadComponent "special" callback
28
31
  action :load_with_feedback
@@ -45,14 +48,18 @@ class ComponentLoader < Netzke::Base
45
48
 
46
49
  action :inaccessible
47
50
 
51
+ action :load_self_reloading
52
+
53
+ action :load_require_css
54
+
48
55
  def configure(c)
49
56
  super
50
- c.bbar = [:load_component, :load_in_window, :load_with_feedback, :load_window_with_simple_component, :load_composite, :load_with_params, :non_existing_component, :inaccessible, :config_only]
57
+ c.bbar = [:load_component, :load_in_window, :load_with_feedback, :load_window_with_simple_component, :load_composite, :load_with_params, :non_existing_component, :inaccessible, :config_only, :load_self_reloading, :load_require_css]
51
58
  end
52
59
 
53
60
  endpoint :deliver_component do |params, this|
54
- if params[:name] == "simple_component" && params[:html]
55
- components[:simple_component].merge!(:html => params[:html])
61
+ if params[:name] == "simple_component" && params[:title]
62
+ components[:simple_component].merge!(:title => params[:title])
56
63
  end
57
64
  super(params, this)
58
65
  end
@@ -1,12 +1,11 @@
1
1
  {
2
- onBugServer: function(){
2
+ onWithResponse: function(){
3
3
  this.whatsUp();
4
- this.update('You should see the response from the server in the title bar the very next moment');
5
4
  },
6
5
 
7
6
  onNoResponse: function(){
8
7
  this.noResponse({}, function(){
9
- this.update('Successfully called endpoint with no response (this is a callback)');
8
+ this.setTitle('Successfully called endpoint with no response (this is a callback)');
10
9
  }, this);
11
10
  },
12
11
 
@@ -15,7 +14,7 @@
15
14
  },
16
15
 
17
16
  takeTwoArguments: function(first, second){
18
- this.update("Called a function with two arguments: " + first + ", " + second);
17
+ this.setTitle("Called a function with two arguments: " + first + ", " + second);
19
18
  },
20
19
 
21
20
  onArrayAsArgument: function() {
@@ -24,10 +23,10 @@
24
23
 
25
24
  takeArrayAsArgument: function(arry) {
26
25
  var arryAsString = "['"+ arry.join("', '") + "']";
27
- this.update("Called a function with array as arguments: " + arryAsString);
26
+ this.setTitle("Called a function with array as arguments: " + arryAsString);
28
27
  },
29
28
 
30
- onCallWithGenericCallbackAndScope: function(){
29
+ onCallbackAndScope: function(){
31
30
  var that=this;
32
31
  var fancyScope={
33
32
  setFancyTitle: function () {
@@ -39,4 +38,9 @@
39
38
  }, fancyScope);
40
39
  },
41
40
 
41
+ onReturnValue: function() {
42
+ this.getAnswer(null, function(answer) {
43
+ this.setTitle("Returned value: " + answer);
44
+ }, this);
45
+ }
42
46
  }
@@ -1,32 +1,32 @@
1
- class ServerCaller < Netzke::Base
2
- action :bug_server # Actual action's text is set in en.yml
1
+ class Endpoints < Netzke::Base
2
+ action :with_response
3
3
  action :no_response
4
4
  action :multiple_arguments
5
5
  action :array_as_argument
6
+ action :return_value
6
7
 
7
8
  # this action is using generic endpoint callback with scope
8
- action :call_with_generic_callback_and_scope
9
+ action :callback_and_scope
9
10
 
10
11
  js_configure do |c|
11
- c.title = "Server Caller"
12
- c.html = "Wow"
12
+ c.title = "Endpoints"
13
13
  c.mixin
14
14
  end
15
15
 
16
16
  def configure(c)
17
17
  super
18
- c.bbar = [:bug_server, :no_response, :multiple_arguments, :array_as_argument, :call_with_generic_callback_and_scope]
18
+ c.bbar = [:with_response, :no_response, :multiple_arguments, :array_as_argument, :callback_and_scope, :return_value]
19
19
 
20
20
  # Alternative way of defining bbar:
21
21
  # c.docked_items = [{
22
22
  # xtype: :toolbar,
23
23
  # dock: :right,
24
- # items: [:bug_server, :no_response, :multiple_arguments, :array_as_argument]
24
+ # items: [:with_response, :no_response, :multiple_arguments, :array_as_argument]
25
25
  # }]
26
26
  end
27
27
 
28
28
  endpoint :whats_up do |params, this|
29
- this.set_title("All quiet here on the server")
29
+ this.set_title("Response from server")
30
30
  end
31
31
 
32
32
  endpoint :no_response do |params, this|
@@ -42,4 +42,8 @@ class ServerCaller < Netzke::Base
42
42
 
43
43
  endpoint :do_nothing do |params,this|
44
44
  end
45
+
46
+ endpoint :get_answer do |params,this|
47
+ this.netzke_set_result(42) # special method that passes a value as argument to callback function
48
+ end
45
49
  end
@@ -1,10 +1,12 @@
1
- class ExtendedServerCaller < ServerCaller
1
+ class EndpointsExtended < Endpoints
2
2
  def configure(c)
3
3
  super
4
- c.title = "Extended Server Caller"
4
+ c.title = "Endpoints Extended"
5
5
  end
6
6
 
7
-
7
+ action :with_response do |c|
8
+ c.text = "With extended response"
9
+ end
8
10
 
9
11
  js_configure do |c|
10
12
  c.on_bug_server = <<-JS
@@ -20,6 +22,6 @@ class ExtendedServerCaller < ServerCaller
20
22
  endpoint :whats_up do |params, this|
21
23
  super(params, this)
22
24
 
23
- this.set_title(this.set_title[0] + ", shiny weather")
25
+ this.set_title(this.set_title[0] + " plus")
24
26
  end
25
27
  end
@@ -7,6 +7,11 @@ module ExtDirect
7
7
  function(){
8
8
  this.callParent();
9
9
 
10
+ Ext.Ajax.on('beforerequest',function (conn, options ) {
11
+ Netzke.connectionCount = Netzke.connectionCount || 0;
12
+ Netzke.connectionCount++;
13
+ });
14
+
10
15
  this.netzkeGetComponent('selector').on('userupdate', function(user){
11
16
  this.setUser(user);
12
17
  this.netzkeGetComponent('details').update();
@@ -42,6 +47,5 @@ module ExtDirect
42
47
  endpoint :set_user do |params, this|
43
48
  component_session[:user] = params
44
49
  end
45
-
46
50
  end
47
51
  end
@@ -0,0 +1,26 @@
1
+ class Feedback < Netzke::Base
2
+ action :feedback
3
+ action :server_feedback
4
+
5
+ def configure(c)
6
+ super
7
+ c.bbar = [:feedback, :server_feedback]
8
+ end
9
+
10
+ js_configure do |c|
11
+ c.on_feedback = <<-JS
12
+ function(){
13
+ this.netzkeFeedback('Local feedback'); // uses global delay config
14
+ }
15
+ JS
16
+ c.on_server_feedback = <<-JS
17
+ function(){
18
+ this.serverFeedback();
19
+ }
20
+ JS
21
+ end
22
+
23
+ endpoint :server_feedback do |params,this|
24
+ this.netzke_feedback("Server feedback", delay: 3000)
25
+ end
26
+ end
@@ -0,0 +1,10 @@
1
+ %h1
2
+ Hello
3
+ = @who
4
+ \!
5
+ %ul
6
+ %li
7
+ * Implement simple HAML rendering
8
+ %img{src: Netzke::Base.uri_to_icon(:tick)}
9
+ %li * Get feedback
10
+ %li * Push to master
@@ -0,0 +1,3 @@
1
+ %h1
2
+ Current time:
3
+ = @time
@@ -0,0 +1,32 @@
1
+ class HamlPanel < Netzke::Base
2
+ action :ping_server
3
+
4
+ def js_configure(c)
5
+ super
6
+
7
+ c.title = "Haml panel"
8
+ c.body_padding = 5
9
+
10
+ @who = 'World'
11
+ c.html = render(:body)
12
+
13
+ c.bbar = [:ping_server]
14
+ end
15
+
16
+ js_configure do |c|
17
+ c.on_ping_server = <<-JS
18
+ function(){
19
+ this.whatsUp();
20
+ }
21
+ JS
22
+
23
+ c.update_body = <<-JS
24
+ function(html){ this.update(html);}
25
+ JS
26
+ end
27
+
28
+ endpoint :whats_up do |params,this|
29
+ @time = Time.now
30
+ this.update_body(render(:server_response))
31
+ end
32
+ end
@@ -1,3 +1,4 @@
1
+ # For demo purposes. Not used for testing.
1
2
  class HelloWorld < Netzke::Base
2
3
  # Configure clint class
3
4
  js_configure do |c|
@@ -0,0 +1,2 @@
1
+ // Some included JS code
2
+ actionOneMessage = "Action one triggered";
@@ -0,0 +1,2 @@
1
+ // Some included JS code
2
+ actionTwoMessage = "Action two triggered";
@@ -0,0 +1,5 @@
1
+ {
2
+ onActionThree: function() {
3
+ this.setTitle("Action three triggered");
4
+ }
5
+ }
@@ -1,8 +1,8 @@
1
- class ComponentWithJsMixin < Netzke::Base
1
+ class JsInclusion < Netzke::Base
2
2
  js_configure do |c|
3
3
  c.require :extra_one, :extra_two
4
4
  c.mixin :method_set_one, :method_set_two
5
- c.mixin # with no parameters, it'll assume :component_with_js_mixin
5
+ c.mixin # by default it assumes :js_inclusion
6
6
  end
7
7
 
8
8
  action :action_one
@@ -12,6 +12,6 @@ class ComponentWithJsMixin < Netzke::Base
12
12
  def configure(c)
13
13
  super
14
14
  c.bbar = [:action_one, :action_two, :action_three]
15
- c.title = "ComponentWithJsMixin"
15
+ c.title = "JsInclusion component"
16
16
  end
17
17
  end
@@ -0,0 +1,5 @@
1
+ {
2
+ onActionThree: function() {
3
+ this.setTitle("Modified action three triggered");
4
+ }
5
+ }