netzke-core 0.5.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +1 -1
- data/.gitignore +4 -2
- data/CHANGELOG.rdoc +37 -15
- data/README.rdoc +93 -28
- data/Rakefile +5 -7
- data/TODO +24 -3
- data/app/controllers/netzke_controller.rb +70 -0
- data/app/models/netzke_preference.rb +170 -0
- data/autotest/discover.rb +2 -3
- data/features/actions.feature +13 -0
- data/features/basic.feature +7 -0
- data/features/client-server.feature +15 -0
- data/features/complex_component.feature +18 -0
- data/features/component.feature +13 -0
- data/features/component_loader.feature +31 -0
- data/features/composition.feature +32 -0
- data/features/custom_css.feature +17 -0
- data/features/file_inclusion.feature +13 -0
- data/features/inheritance.feature +19 -0
- data/features/persistence.feature +16 -0
- data/features/scopes.feature +17 -0
- data/features/step_definitions/custom_css_steps.rb +7 -0
- data/features/step_definitions/generic_steps.rb +15 -0
- data/features/step_definitions/web_steps.rb +219 -0
- data/features/support/env.rb +62 -0
- data/features/support/paths.rb +45 -0
- data/generators/netzke_core/USAGE +3 -3
- data/generators/netzke_core/netzke_core_generator.rb +8 -0
- data/install.rb +1 -1
- data/javascripts/core.js +542 -499
- data/lib/generators/migration_helper.rb +32 -0
- data/lib/generators/netzke/USAGE +9 -0
- data/lib/generators/netzke/core_generator.rb +24 -0
- data/lib/netzke/actions.rb +102 -0
- data/lib/netzke/base.rb +77 -529
- data/lib/netzke/composition.rb +251 -0
- data/lib/netzke/configuration.rb +134 -0
- data/lib/netzke/core/masquerading.rb +34 -0
- data/lib/netzke/core/session.rb +30 -0
- data/lib/netzke/core/version.rb +11 -0
- data/lib/netzke/core.rb +53 -0
- data/lib/netzke/core_ext/array.rb +30 -0
- data/lib/netzke/core_ext/hash.rb +84 -0
- data/lib/netzke/core_ext/string.rb +26 -0
- data/lib/netzke/core_ext/symbol.rb +13 -0
- data/lib/netzke/core_ext/time_with_zone.rb +7 -0
- data/lib/netzke/core_ext.rb +5 -141
- data/lib/netzke/embedding.rb +21 -0
- data/lib/netzke/ext_component.rb +25 -0
- data/lib/netzke/javascript.rb +248 -0
- data/lib/netzke/persistence.rb +118 -0
- data/lib/netzke/rails/action_view_ext.rb +103 -0
- data/lib/netzke/{controller_extensions.rb → rails/controller_extensions.rb} +7 -2
- data/lib/netzke/rails/routes.rb +7 -0
- data/lib/netzke/services.rb +68 -0
- data/lib/netzke/session.rb +35 -0
- data/lib/netzke/stylesheets.rb +52 -0
- data/lib/netzke-core.rb +28 -29
- data/netzke-core.gemspec +253 -0
- data/spec/component/actions_spec.rb +94 -0
- data/spec/component/base_spec.rb +25 -0
- data/spec/component/composition_spec.rb +132 -0
- data/spec/component/javascript_spec.rb +15 -0
- data/spec/core_ext_spec.rb +16 -0
- data/spec/spec.opt +2 -0
- data/spec/spec_helper.rb +35 -0
- data/{test/app_root/db/migrate/20081222035855_create_netzke_preferences.rb → templates/core/create_netzke_preferences.rb} +4 -4
- data/test/rails_app/.gitignore +4 -0
- data/test/rails_app/Gemfile +36 -0
- data/test/rails_app/Gemfile.lock +137 -0
- data/test/rails_app/README +15 -0
- data/test/rails_app/Rakefile +7 -0
- data/test/rails_app/app/components/border_layout_panel.rb +4 -0
- data/test/rails_app/app/components/component_loader.rb +59 -0
- data/test/rails_app/app/components/component_with_actions.rb +58 -0
- data/test/rails_app/app/components/component_with_custom_css.rb +8 -0
- data/test/rails_app/app/components/component_with_included_js.rb +16 -0
- data/test/rails_app/app/components/component_with_session_persistence.rb +25 -0
- data/test/rails_app/app/components/custom.css +3 -0
- data/test/rails_app/app/components/deprecated/server_caller.rb +20 -0
- data/test/rails_app/app/components/extended_component_with_actions.rb +5 -0
- data/test/rails_app/app/components/extended_server_caller.rb +18 -0
- data/test/rails_app/app/components/included.js +5 -0
- data/test/rails_app/app/components/kinda_complex_component/basic_stuff.rb +35 -0
- data/test/rails_app/app/components/kinda_complex_component/extra_stuff.rb +16 -0
- data/test/rails_app/app/components/kinda_complex_component.rb +7 -0
- data/test/rails_app/app/components/loader_of_component_with_custom_css.rb +15 -0
- data/test/rails_app/app/components/scoped_components/deep_scoped_components/some_deep_scoped_component.rb +7 -0
- data/test/rails_app/app/components/scoped_components/extended_scoped_component.rb +5 -0
- data/test/rails_app/app/components/scoped_components/some_scoped_component.rb +5 -0
- data/test/rails_app/app/components/server_caller.rb +21 -0
- data/test/rails_app/app/components/simple_component.rb +5 -0
- data/test/rails_app/app/components/simple_tab_panel.rb +27 -0
- data/test/rails_app/app/components/simple_window.rb +3 -0
- data/test/rails_app/app/components/some_composite.rb +65 -0
- data/test/rails_app/app/components/some_ext_component.rb +8 -0
- data/test/{app_root → rails_app}/app/controllers/application_controller.rb +1 -0
- data/test/rails_app/app/controllers/components_controller.rb +12 -0
- data/test/rails_app/app/controllers/multiple_components_controller.rb +2 -0
- data/test/rails_app/app/controllers/welcome_controller.rb +5 -0
- data/test/rails_app/app/helpers/application_helper.rb +2 -0
- data/test/rails_app/app/views/layouts/application.html.erb +13 -0
- data/test/rails_app/app/views/multiple_components/set_one.html.erb +3 -0
- data/test/rails_app/config/application.rb +45 -0
- data/test/rails_app/config/boot.rb +13 -0
- data/test/rails_app/config/database.yml +22 -0
- data/test/rails_app/config/environment.rb +6 -0
- data/test/rails_app/config/environments/development.rb +22 -0
- data/test/rails_app/config/environments/production.rb +49 -0
- data/test/rails_app/config/environments/test.rb +35 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/inflections.rb +10 -0
- data/test/rails_app/config/initializers/mime_types.rb +5 -0
- data/test/rails_app/config/initializers/netzke.rb +3 -0
- data/test/rails_app/config/initializers/secret_token.rb +7 -0
- data/test/rails_app/config/initializers/session_store.rb +8 -0
- data/test/rails_app/config/locales/en.yml +5 -0
- data/test/rails_app/config/routes.rb +64 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/db/development_structure.sql +4 -0
- data/{generators/netzke_core/templates/create_netzke_preferences.rb → test/rails_app/db/migrate/20100905214933_create_netzke_preferences.rb} +1 -3
- data/test/rails_app/db/schema.rb +24 -0
- data/test/rails_app/db/seeds.rb +7 -0
- data/test/{app_root/config/environments/in_memory.rb → rails_app/lib/tasks/.gitkeep} +0 -0
- data/test/rails_app/public/404.html +26 -0
- data/test/rails_app/public/422.html +26 -0
- data/test/rails_app/public/500.html +26 -0
- data/test/{app_root/config/environments/mysql.rb → rails_app/public/favicon.ico} +0 -0
- data/test/rails_app/public/images/rails.png +0 -0
- data/test/rails_app/public/robots.txt +5 -0
- data/test/rails_app/script/rails +6 -0
- data/test/{app_root/config/environments/postgresql.rb → rails_app/vendor/plugins/.gitkeep} +0 -0
- data/test/unit/netzke_core_test.rb +74 -75
- data/test/unit/netzke_preference_test.rb +2 -2
- metadata +176 -48
- data/lib/app/controllers/netzke_controller.rb +0 -46
- data/lib/app/models/netzke_preference.rb +0 -171
- data/lib/netzke/action_view_ext.rb +0 -81
- data/lib/netzke/base_js.rb +0 -339
- data/lib/netzke/routing.rb +0 -9
- data/test/app_root/app/models/role.rb +0 -3
- data/test/app_root/app/models/user.rb +0 -3
- data/test/app_root/config/boot.rb +0 -115
- data/test/app_root/config/database.yml +0 -31
- data/test/app_root/config/environment.rb +0 -14
- data/test/app_root/config/environments/sqlite.rb +0 -0
- data/test/app_root/config/environments/sqlite3.rb +0 -0
- data/test/app_root/config/routes.rb +0 -4
- data/test/app_root/db/migrate/20090423214303_create_roles.rb +0 -11
- data/test/app_root/db/migrate/20090423222114_create_users.rb +0 -12
- data/test/app_root/lib/console_with_fixtures.rb +0 -4
- data/test/app_root/script/console +0 -7
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 6
|
8
|
+
- 0
|
9
|
+
version: 0.6.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Sergei Kozlov
|
@@ -14,11 +14,11 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-10-24 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
21
|
+
name: activesupport
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
@@ -26,10 +26,10 @@ dependencies:
|
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
segments:
|
29
|
-
-
|
29
|
+
- 3
|
30
30
|
- 0
|
31
31
|
- 1
|
32
|
-
version:
|
32
|
+
version: 3.0.1
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
description: Allows building ExtJS/Rails reusable code in a DRY way
|
@@ -51,43 +51,137 @@ files:
|
|
51
51
|
- README.rdoc
|
52
52
|
- Rakefile
|
53
53
|
- TODO
|
54
|
+
- app/controllers/netzke_controller.rb
|
55
|
+
- app/models/netzke_preference.rb
|
54
56
|
- autotest/discover.rb
|
57
|
+
- features/actions.feature
|
58
|
+
- features/basic.feature
|
59
|
+
- features/client-server.feature
|
60
|
+
- features/complex_component.feature
|
61
|
+
- features/component.feature
|
62
|
+
- features/component_loader.feature
|
63
|
+
- features/composition.feature
|
64
|
+
- features/custom_css.feature
|
65
|
+
- features/file_inclusion.feature
|
66
|
+
- features/inheritance.feature
|
67
|
+
- features/persistence.feature
|
68
|
+
- features/scopes.feature
|
69
|
+
- features/step_definitions/custom_css_steps.rb
|
70
|
+
- features/step_definitions/generic_steps.rb
|
71
|
+
- features/step_definitions/web_steps.rb
|
72
|
+
- features/support/env.rb
|
73
|
+
- features/support/paths.rb
|
55
74
|
- generators/netzke_core/USAGE
|
56
75
|
- generators/netzke_core/netzke_core_generator.rb
|
57
|
-
- generators/netzke_core/templates/create_netzke_preferences.rb
|
58
76
|
- init.rb
|
59
77
|
- install.rb
|
60
78
|
- javascripts/core.js
|
61
|
-
- lib/
|
62
|
-
- lib/
|
79
|
+
- lib/generators/migration_helper.rb
|
80
|
+
- lib/generators/netzke/USAGE
|
81
|
+
- lib/generators/netzke/core_generator.rb
|
63
82
|
- lib/netzke-core.rb
|
64
|
-
- lib/netzke/
|
83
|
+
- lib/netzke/actions.rb
|
65
84
|
- lib/netzke/base.rb
|
66
|
-
- lib/netzke/
|
67
|
-
- lib/netzke/
|
85
|
+
- lib/netzke/composition.rb
|
86
|
+
- lib/netzke/configuration.rb
|
87
|
+
- lib/netzke/core.rb
|
88
|
+
- lib/netzke/core/masquerading.rb
|
89
|
+
- lib/netzke/core/session.rb
|
90
|
+
- lib/netzke/core/version.rb
|
68
91
|
- lib/netzke/core_ext.rb
|
69
|
-
- lib/netzke/
|
92
|
+
- lib/netzke/core_ext/array.rb
|
93
|
+
- lib/netzke/core_ext/hash.rb
|
94
|
+
- lib/netzke/core_ext/string.rb
|
95
|
+
- lib/netzke/core_ext/symbol.rb
|
96
|
+
- lib/netzke/core_ext/time_with_zone.rb
|
97
|
+
- lib/netzke/embedding.rb
|
98
|
+
- lib/netzke/ext_component.rb
|
99
|
+
- lib/netzke/javascript.rb
|
100
|
+
- lib/netzke/persistence.rb
|
101
|
+
- lib/netzke/rails/action_view_ext.rb
|
102
|
+
- lib/netzke/rails/controller_extensions.rb
|
103
|
+
- lib/netzke/rails/routes.rb
|
104
|
+
- lib/netzke/services.rb
|
105
|
+
- lib/netzke/session.rb
|
106
|
+
- lib/netzke/stylesheets.rb
|
70
107
|
- lib/tasks/netzke_core_tasks.rake
|
108
|
+
- netzke-core.gemspec
|
109
|
+
- spec/component/actions_spec.rb
|
110
|
+
- spec/component/base_spec.rb
|
111
|
+
- spec/component/composition_spec.rb
|
112
|
+
- spec/component/javascript_spec.rb
|
113
|
+
- spec/core_ext_spec.rb
|
114
|
+
- spec/spec.opt
|
115
|
+
- spec/spec_helper.rb
|
71
116
|
- stylesheets/core.css
|
72
|
-
-
|
73
|
-
- test/app_root/app/models/role.rb
|
74
|
-
- test/app_root/app/models/user.rb
|
75
|
-
- test/app_root/config/boot.rb
|
76
|
-
- test/app_root/config/database.yml
|
77
|
-
- test/app_root/config/environment.rb
|
78
|
-
- test/app_root/config/environments/in_memory.rb
|
79
|
-
- test/app_root/config/environments/mysql.rb
|
80
|
-
- test/app_root/config/environments/postgresql.rb
|
81
|
-
- test/app_root/config/environments/sqlite.rb
|
82
|
-
- test/app_root/config/environments/sqlite3.rb
|
83
|
-
- test/app_root/config/routes.rb
|
84
|
-
- test/app_root/db/migrate/20081222035855_create_netzke_preferences.rb
|
85
|
-
- test/app_root/db/migrate/20090423214303_create_roles.rb
|
86
|
-
- test/app_root/db/migrate/20090423222114_create_users.rb
|
87
|
-
- test/app_root/lib/console_with_fixtures.rb
|
88
|
-
- test/app_root/script/console
|
117
|
+
- templates/core/create_netzke_preferences.rb
|
89
118
|
- test/fixtures/roles.yml
|
90
119
|
- test/fixtures/users.yml
|
120
|
+
- test/rails_app/.gitignore
|
121
|
+
- test/rails_app/Gemfile
|
122
|
+
- test/rails_app/Gemfile.lock
|
123
|
+
- test/rails_app/README
|
124
|
+
- test/rails_app/Rakefile
|
125
|
+
- test/rails_app/app/components/border_layout_panel.rb
|
126
|
+
- test/rails_app/app/components/component_loader.rb
|
127
|
+
- test/rails_app/app/components/component_with_actions.rb
|
128
|
+
- test/rails_app/app/components/component_with_custom_css.rb
|
129
|
+
- test/rails_app/app/components/component_with_included_js.rb
|
130
|
+
- test/rails_app/app/components/component_with_session_persistence.rb
|
131
|
+
- test/rails_app/app/components/custom.css
|
132
|
+
- test/rails_app/app/components/deprecated/server_caller.rb
|
133
|
+
- test/rails_app/app/components/extended_component_with_actions.rb
|
134
|
+
- test/rails_app/app/components/extended_server_caller.rb
|
135
|
+
- test/rails_app/app/components/included.js
|
136
|
+
- test/rails_app/app/components/kinda_complex_component.rb
|
137
|
+
- test/rails_app/app/components/kinda_complex_component/basic_stuff.rb
|
138
|
+
- test/rails_app/app/components/kinda_complex_component/extra_stuff.rb
|
139
|
+
- test/rails_app/app/components/loader_of_component_with_custom_css.rb
|
140
|
+
- test/rails_app/app/components/scoped_components/deep_scoped_components/some_deep_scoped_component.rb
|
141
|
+
- test/rails_app/app/components/scoped_components/extended_scoped_component.rb
|
142
|
+
- test/rails_app/app/components/scoped_components/some_scoped_component.rb
|
143
|
+
- test/rails_app/app/components/server_caller.rb
|
144
|
+
- test/rails_app/app/components/simple_component.rb
|
145
|
+
- test/rails_app/app/components/simple_tab_panel.rb
|
146
|
+
- test/rails_app/app/components/simple_window.rb
|
147
|
+
- test/rails_app/app/components/some_composite.rb
|
148
|
+
- test/rails_app/app/components/some_ext_component.rb
|
149
|
+
- test/rails_app/app/controllers/application_controller.rb
|
150
|
+
- test/rails_app/app/controllers/components_controller.rb
|
151
|
+
- test/rails_app/app/controllers/multiple_components_controller.rb
|
152
|
+
- test/rails_app/app/controllers/welcome_controller.rb
|
153
|
+
- test/rails_app/app/helpers/application_helper.rb
|
154
|
+
- test/rails_app/app/views/layouts/application.html.erb
|
155
|
+
- test/rails_app/app/views/multiple_components/set_one.html.erb
|
156
|
+
- test/rails_app/config.ru
|
157
|
+
- test/rails_app/config/application.rb
|
158
|
+
- test/rails_app/config/boot.rb
|
159
|
+
- test/rails_app/config/database.yml
|
160
|
+
- test/rails_app/config/environment.rb
|
161
|
+
- test/rails_app/config/environments/development.rb
|
162
|
+
- test/rails_app/config/environments/production.rb
|
163
|
+
- test/rails_app/config/environments/test.rb
|
164
|
+
- test/rails_app/config/initializers/backtrace_silencers.rb
|
165
|
+
- test/rails_app/config/initializers/inflections.rb
|
166
|
+
- test/rails_app/config/initializers/mime_types.rb
|
167
|
+
- test/rails_app/config/initializers/netzke.rb
|
168
|
+
- test/rails_app/config/initializers/secret_token.rb
|
169
|
+
- test/rails_app/config/initializers/session_store.rb
|
170
|
+
- test/rails_app/config/locales/en.yml
|
171
|
+
- test/rails_app/config/routes.rb
|
172
|
+
- test/rails_app/db/development_structure.sql
|
173
|
+
- test/rails_app/db/migrate/20100905214933_create_netzke_preferences.rb
|
174
|
+
- test/rails_app/db/schema.rb
|
175
|
+
- test/rails_app/db/seeds.rb
|
176
|
+
- test/rails_app/lib/tasks/.gitkeep
|
177
|
+
- test/rails_app/public/404.html
|
178
|
+
- test/rails_app/public/422.html
|
179
|
+
- test/rails_app/public/500.html
|
180
|
+
- test/rails_app/public/favicon.ico
|
181
|
+
- test/rails_app/public/images/rails.png
|
182
|
+
- test/rails_app/public/robots.txt
|
183
|
+
- test/rails_app/script/rails
|
184
|
+
- test/rails_app/vendor/plugins/.gitkeep
|
91
185
|
- test/test_helper.rb
|
92
186
|
- test/unit/core_ext_test.rb
|
93
187
|
- test/unit/netzke_core_test.rb
|
@@ -98,7 +192,7 @@ homepage: http://github.com/skozlov/netzke-core
|
|
98
192
|
licenses: []
|
99
193
|
|
100
194
|
post_install_message: "\n\
|
101
|
-
========================================================================\n\n Thanks for installing Netzke Core!\n \n
|
195
|
+
========================================================================\n\n Thanks for installing Netzke Core!\n \n Netzke home page: http://netzke.org\n Netzke Google Groups: http://groups.google.com/group/netzke\n Netzke tutorials: http://blog.writelesscode.com\n\n\
|
102
196
|
========================================================================\n\n"
|
103
197
|
rdoc_options:
|
104
198
|
- --charset=UTF-8
|
@@ -126,23 +220,57 @@ rubyforge_project: netzke-core
|
|
126
220
|
rubygems_version: 1.3.7
|
127
221
|
signing_key:
|
128
222
|
specification_version: 3
|
129
|
-
summary: Build ExtJS/Rails
|
223
|
+
summary: Build ExtJS/Rails components with minimum effort
|
130
224
|
test_files:
|
131
|
-
-
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
136
|
-
-
|
137
|
-
- test/
|
138
|
-
- test/
|
139
|
-
- test/
|
140
|
-
- test/
|
141
|
-
- test/
|
142
|
-
- test/
|
143
|
-
- test/
|
144
|
-
- test/
|
145
|
-
- test/
|
225
|
+
- spec/component/actions_spec.rb
|
226
|
+
- spec/component/base_spec.rb
|
227
|
+
- spec/component/composition_spec.rb
|
228
|
+
- spec/component/javascript_spec.rb
|
229
|
+
- spec/core_ext_spec.rb
|
230
|
+
- spec/spec_helper.rb
|
231
|
+
- test/rails_app/app/components/border_layout_panel.rb
|
232
|
+
- test/rails_app/app/components/component_loader.rb
|
233
|
+
- test/rails_app/app/components/component_with_actions.rb
|
234
|
+
- test/rails_app/app/components/component_with_custom_css.rb
|
235
|
+
- test/rails_app/app/components/component_with_included_js.rb
|
236
|
+
- test/rails_app/app/components/component_with_session_persistence.rb
|
237
|
+
- test/rails_app/app/components/deprecated/server_caller.rb
|
238
|
+
- test/rails_app/app/components/extended_component_with_actions.rb
|
239
|
+
- test/rails_app/app/components/extended_server_caller.rb
|
240
|
+
- test/rails_app/app/components/kinda_complex_component/basic_stuff.rb
|
241
|
+
- test/rails_app/app/components/kinda_complex_component/extra_stuff.rb
|
242
|
+
- test/rails_app/app/components/kinda_complex_component.rb
|
243
|
+
- test/rails_app/app/components/loader_of_component_with_custom_css.rb
|
244
|
+
- test/rails_app/app/components/scoped_components/deep_scoped_components/some_deep_scoped_component.rb
|
245
|
+
- test/rails_app/app/components/scoped_components/extended_scoped_component.rb
|
246
|
+
- test/rails_app/app/components/scoped_components/some_scoped_component.rb
|
247
|
+
- test/rails_app/app/components/server_caller.rb
|
248
|
+
- test/rails_app/app/components/simple_component.rb
|
249
|
+
- test/rails_app/app/components/simple_tab_panel.rb
|
250
|
+
- test/rails_app/app/components/simple_window.rb
|
251
|
+
- test/rails_app/app/components/some_composite.rb
|
252
|
+
- test/rails_app/app/components/some_ext_component.rb
|
253
|
+
- test/rails_app/app/controllers/application_controller.rb
|
254
|
+
- test/rails_app/app/controllers/components_controller.rb
|
255
|
+
- test/rails_app/app/controllers/multiple_components_controller.rb
|
256
|
+
- test/rails_app/app/controllers/welcome_controller.rb
|
257
|
+
- test/rails_app/app/helpers/application_helper.rb
|
258
|
+
- test/rails_app/config/application.rb
|
259
|
+
- test/rails_app/config/boot.rb
|
260
|
+
- test/rails_app/config/environment.rb
|
261
|
+
- test/rails_app/config/environments/development.rb
|
262
|
+
- test/rails_app/config/environments/production.rb
|
263
|
+
- test/rails_app/config/environments/test.rb
|
264
|
+
- test/rails_app/config/initializers/backtrace_silencers.rb
|
265
|
+
- test/rails_app/config/initializers/inflections.rb
|
266
|
+
- test/rails_app/config/initializers/mime_types.rb
|
267
|
+
- test/rails_app/config/initializers/netzke.rb
|
268
|
+
- test/rails_app/config/initializers/secret_token.rb
|
269
|
+
- test/rails_app/config/initializers/session_store.rb
|
270
|
+
- test/rails_app/config/routes.rb
|
271
|
+
- test/rails_app/db/migrate/20100905214933_create_netzke_preferences.rb
|
272
|
+
- test/rails_app/db/schema.rb
|
273
|
+
- test/rails_app/db/seeds.rb
|
146
274
|
- test/test_helper.rb
|
147
275
|
- test/unit/core_ext_test.rb
|
148
276
|
- test/unit/netzke_core_test.rb
|
@@ -1,46 +0,0 @@
|
|
1
|
-
class NetzkeController < ApplicationController
|
2
|
-
|
3
|
-
# Collect javascripts from all plugins that registered it in Netzke::Base.config[:javascripts]
|
4
|
-
# TODO: caching
|
5
|
-
# caches_action :netzke
|
6
|
-
def netzke
|
7
|
-
respond_to do |format|
|
8
|
-
format.js {
|
9
|
-
res = ""
|
10
|
-
Netzke::Base.config[:javascripts].each do |path|
|
11
|
-
f = File.new(path)
|
12
|
-
res << f.read
|
13
|
-
end
|
14
|
-
render :text => res.strip_js_comments
|
15
|
-
}
|
16
|
-
|
17
|
-
format.css {
|
18
|
-
res = ""
|
19
|
-
Netzke::Base.config[:stylesheets].each do |path|
|
20
|
-
f = File.new(path)
|
21
|
-
res << f.read
|
22
|
-
end
|
23
|
-
render :text => res
|
24
|
-
}
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# Main dispatcher of the HTTP requests. The URL contains the name of the widget,
|
29
|
-
# as well as the method of this widget to be called, according to the double underscore notation.
|
30
|
-
# E.g.: some_grid__post_grid_data.
|
31
|
-
def method_missing(method_name)
|
32
|
-
widget_name, *action = method_name.to_s.split('__')
|
33
|
-
widget_name = widget_name.to_sym
|
34
|
-
action = !action.empty? && action.join("__").to_sym
|
35
|
-
|
36
|
-
if action
|
37
|
-
w_instance = Netzke::Base.instance_by_config(Netzke::Base.session[:netzke_widgets][widget_name])
|
38
|
-
# only widget's actions starting with "api_" are accessible from outside (security)
|
39
|
-
api_action = action.to_s.index('__') ? action : "api_#{action}"
|
40
|
-
render :text => w_instance.send(api_action, params), :layout => false
|
41
|
-
else
|
42
|
-
super
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
@@ -1,171 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# TODO: would be great to support something like this:
|
3
|
-
# NetzkePreference["name"].merge!({:a => 1, :b => 2}) # if NetzkePreference["name"] returns a hash
|
4
|
-
# or
|
5
|
-
# NetzkePreference["name"] << 2 # if NetzkePreference["name"] returns an array
|
6
|
-
# etc
|
7
|
-
#
|
8
|
-
class NetzkePreference < ActiveRecord::Base
|
9
|
-
belongs_to :user
|
10
|
-
belongs_to :role
|
11
|
-
|
12
|
-
ELEMENTARY_CONVERTION_METHODS= {'Fixnum' => 'to_i', 'String' => 'to_s', 'Float' => 'to_f', 'Symbol' => 'to_sym'}
|
13
|
-
|
14
|
-
def self.widget_name=(value)
|
15
|
-
@@widget_name = value
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.widget_name
|
19
|
-
@@widget_name ||= nil
|
20
|
-
end
|
21
|
-
|
22
|
-
def normalized_value
|
23
|
-
klass = read_attribute(:pref_type)
|
24
|
-
norm_value = read_attribute(:value)
|
25
|
-
|
26
|
-
case klass
|
27
|
-
when nil then r = norm_value # do not cast
|
28
|
-
when 'Boolean' then r = norm_value == 'false' ? false : (norm_value == 'true' || norm_value)
|
29
|
-
when 'NilClass' then r = nil
|
30
|
-
when 'Array', 'Hash' then r = ActiveSupport::JSON.decode(norm_value)
|
31
|
-
else
|
32
|
-
r = norm_value.send(ELEMENTARY_CONVERTION_METHODS[klass])
|
33
|
-
end
|
34
|
-
r
|
35
|
-
end
|
36
|
-
|
37
|
-
def normalized_value=(new_value)
|
38
|
-
case new_value.class.name
|
39
|
-
when "Array" then write_attribute(:value, new_value.to_json)
|
40
|
-
when "Hash" then write_attribute(:value, new_value.to_json)
|
41
|
-
else write_attribute(:value, new_value.to_s)
|
42
|
-
end
|
43
|
-
write_attribute(:pref_type, [TrueClass, FalseClass].include?(new_value.class) ? 'Boolean' : new_value.class.to_s)
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.[](pref_name)
|
47
|
-
pref_name = normalize_preference_name(pref_name)
|
48
|
-
pref = self.pref_to_read(pref_name)
|
49
|
-
pref && pref.normalized_value
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.[]=(pref_name, new_value)
|
53
|
-
pref_name = normalize_preference_name(pref_name)
|
54
|
-
pref = self.pref_to_write(pref_name)
|
55
|
-
|
56
|
-
# if assigning nil, simply delete the eventually found preference
|
57
|
-
if new_value.nil?
|
58
|
-
pref && pref.destroy
|
59
|
-
else
|
60
|
-
# pref ||= self.new(conditions(pref_name))
|
61
|
-
pref.normalized_value = new_value
|
62
|
-
pref.save!
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# Overwrite pref_to_read, pref_to_write methods, and find_all_for_widget if you want a different way of
|
67
|
-
# identifying the proper preference based on your own authorization strategy.
|
68
|
-
#
|
69
|
-
# The default strategy is:
|
70
|
-
# 1) if no masq_user or masq_role defined
|
71
|
-
# pref_to_read will search for the preference for user first, then for user's role
|
72
|
-
# pref_to_write will always find or create a preference for the current user (never for its role)
|
73
|
-
# 2) if masq_user or masq_role is defined
|
74
|
-
# pref_to_read and pref_to_write will always take the masquerade into account, e.g. reads/writes will go to
|
75
|
-
# the user/role specified
|
76
|
-
#
|
77
|
-
def self.pref_to_read(name)
|
78
|
-
name = name.to_s
|
79
|
-
session = Netzke::Base.session
|
80
|
-
cond = {:name => name, :widget_name => self.widget_name}
|
81
|
-
|
82
|
-
if session[:masq_user]
|
83
|
-
# first, get the prefs for this user it they exist
|
84
|
-
res = self.find(:first, :conditions => cond.merge({:user_id => session[:masq_user]}))
|
85
|
-
# if it doesn't exist, get them for the user's role
|
86
|
-
user = User.find(session[:masq_user])
|
87
|
-
res ||= self.find(:first, :conditions => cond.merge({:role_id => user.role.id}))
|
88
|
-
# if it doesn't exist either, get them for the World (role_id = 0)
|
89
|
-
res ||= self.find(:first, :conditions => cond.merge({:role_id => 0}))
|
90
|
-
elsif session[:masq_role]
|
91
|
-
# first, get the prefs for this role
|
92
|
-
res = self.find(:first, :conditions => cond.merge({:role_id => session[:masq_role]}))
|
93
|
-
# if it doesn't exist, get them for the World (role_id = 0)
|
94
|
-
res ||= self.find(:first, :conditions => cond.merge({:role_id => 0}))
|
95
|
-
elsif session[:netzke_user_id]
|
96
|
-
user = User.find(session[:netzke_user_id])
|
97
|
-
# first, get the prefs for this user
|
98
|
-
res = self.find(:first, :conditions => cond.merge({:user_id => user.id}))
|
99
|
-
# if it doesn't exist, get them for the user's role
|
100
|
-
res ||= self.find(:first, :conditions => cond.merge({:role_id => user.role.id}))
|
101
|
-
# if it doesn't exist either, get them for the World (role_id = 0)
|
102
|
-
res ||= self.find(:first, :conditions => cond.merge({:role_id => 0}))
|
103
|
-
else
|
104
|
-
res = self.find(:first, :conditions => cond)
|
105
|
-
end
|
106
|
-
|
107
|
-
res
|
108
|
-
end
|
109
|
-
|
110
|
-
def self.pref_to_write(name)
|
111
|
-
name = name.to_s
|
112
|
-
session = Netzke::Base.session
|
113
|
-
cond = {:name => name, :widget_name => self.widget_name}
|
114
|
-
|
115
|
-
if session[:masq_user]
|
116
|
-
cond.merge!({:user_id => session[:masq_user]})
|
117
|
-
# first, try to find the preference for masq_user
|
118
|
-
res = self.find(:first, :conditions => cond)
|
119
|
-
# if it doesn't exist, create it
|
120
|
-
res ||= self.new(cond)
|
121
|
-
elsif session[:masq_role]
|
122
|
-
# first, delete all the corresponding preferences for the users that have this role
|
123
|
-
Role.find(session[:masq_role]).users.each do |u|
|
124
|
-
self.delete_all(cond.merge({:user_id => u.id}))
|
125
|
-
end
|
126
|
-
cond.merge!({:role_id => session[:masq_role]})
|
127
|
-
res = self.find(:first, :conditions => cond)
|
128
|
-
res ||= self.new(cond)
|
129
|
-
elsif session[:masq_world]
|
130
|
-
# first, delete all the corresponding preferences for all users and roles
|
131
|
-
self.delete_all(cond)
|
132
|
-
# then, create the new preference for the World (role_id = 0)
|
133
|
-
res = self.new(cond.merge(:role_id => 0))
|
134
|
-
elsif session[:netzke_user_id]
|
135
|
-
res = self.find(:first, :conditions => cond.merge({:user_id => session[:netzke_user_id]}))
|
136
|
-
res ||= self.new(cond.merge({:user_id => session[:netzke_user_id]}))
|
137
|
-
else
|
138
|
-
res = self.find(:first, :conditions => cond)
|
139
|
-
res ||= self.new(cond)
|
140
|
-
end
|
141
|
-
res
|
142
|
-
end
|
143
|
-
|
144
|
-
def self.find_all_for_widget(name)
|
145
|
-
session = Netzke::Base.session
|
146
|
-
cond = {:widget_name => name}
|
147
|
-
|
148
|
-
if session[:masq_user] || session[:masq_role]
|
149
|
-
cond.merge!({:user_id => session[:masq_user], :role_id => session[:masq_role]})
|
150
|
-
res = self.find(:all, :conditions => cond)
|
151
|
-
elsif session[:netzke_user_id]
|
152
|
-
user = User.find(session[:netzke_user_id])
|
153
|
-
res = self.find(:all, :conditions => cond.merge({:user_id => session[:netzke_user_id]}))
|
154
|
-
res += self.find(:all, :conditions => cond.merge({:role_id => user.role.try(:id)}))
|
155
|
-
else
|
156
|
-
res = self.find(:all, :conditions => cond)
|
157
|
-
end
|
158
|
-
|
159
|
-
res
|
160
|
-
end
|
161
|
-
|
162
|
-
def self.delete_all_for_widget(name)
|
163
|
-
self.destroy(find_all_for_widget(name))
|
164
|
-
end
|
165
|
-
|
166
|
-
private
|
167
|
-
def self.normalize_preference_name(name)
|
168
|
-
name.to_s.gsub(".", "__").gsub("/", "__")
|
169
|
-
end
|
170
|
-
|
171
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
module Netzke
|
2
|
-
module ActionViewExt
|
3
|
-
# Include JavaScript
|
4
|
-
def netzke_js_include
|
5
|
-
# ExtJS
|
6
|
-
res = ENV['RAILS_ENV'] == 'development' ? javascript_include_tag("/extjs/adapter/ext/ext-base", "/extjs/ext-all-debug") : javascript_include_tag("/extjs/adapter/ext/ext-base", "/extjs/ext-all")
|
7
|
-
# Netzke (dynamically generated)
|
8
|
-
res << javascript_include_tag("/netzke/netzke")
|
9
|
-
end
|
10
|
-
|
11
|
-
# Include CSS
|
12
|
-
def netzke_css_include(theme_name = :default)
|
13
|
-
# ExtJS base
|
14
|
-
res = stylesheet_link_tag("/extjs/resources/css/ext-all")
|
15
|
-
# ExtJS theming
|
16
|
-
res << stylesheet_link_tag("/extjs/resources/css/xtheme-#{theme_name}") unless theme_name == :default
|
17
|
-
# Netzke (dynamically generated)
|
18
|
-
res << stylesheet_link_tag("/netzke/netzke")
|
19
|
-
|
20
|
-
# External stylesheets (which cannot be loaded dynamically along with the rest of the widget, e.g. due to that
|
21
|
-
# relative paths are used in them)
|
22
|
-
res << stylesheet_link_tag(Netzke::Base.config[:external_css])
|
23
|
-
|
24
|
-
res
|
25
|
-
end
|
26
|
-
|
27
|
-
# JavaScript for all Netzke classes in this view, and Ext.onReady which renders all Netzke widgets in this view
|
28
|
-
def netzke_js
|
29
|
-
js="Ext.Ajax.extraParams = {authenticity_token: '#{form_authenticity_token}'}; // Rails' forgery protection\n"
|
30
|
-
|
31
|
-
|
32
|
-
js << <<-END_OF_JAVASCRIPT if(!ActionController::Base.relative_url_root.blank?)
|
33
|
-
// apply relative URL root, if set
|
34
|
-
Ext.widgetMixIn.buildApiUrl= function(apip){
|
35
|
-
return "#{ActionController::Base.relative_url_root}/netzke/" + this.id + "__" + apip;
|
36
|
-
};
|
37
|
-
Ext.BLANK_IMAGE_URL = "#{ActionController::Base.relative_url_root}/extjs/resources/images/default/s.gif";
|
38
|
-
END_OF_JAVASCRIPT
|
39
|
-
|
40
|
-
js << <<-END_OF_JAVASCRIPT
|
41
|
-
#{@content_for_netzke_js_classes}
|
42
|
-
Ext.onReady(function(){
|
43
|
-
#{@content_for_netzke_on_ready}
|
44
|
-
});
|
45
|
-
END_OF_JAVASCRIPT
|
46
|
-
|
47
|
-
javascript_tag js
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
# Wrapper for all the above. Use it in your layout.
|
52
|
-
# Params: <tt>:ext_theme</tt> - the name of ExtJS theme to apply (optional)
|
53
|
-
# E.g.:
|
54
|
-
# <%= netzke_init :ext_theme => "grey" %>
|
55
|
-
def netzke_init(params = {})
|
56
|
-
theme = params[:ext_theme] || :default
|
57
|
-
[netzke_css_include(theme), netzke_js_include, netzke_js].join("\n")
|
58
|
-
end
|
59
|
-
|
60
|
-
# Use this helper in your views to embed Netzke widgets. E.g.:
|
61
|
-
# netzke :my_grid, :class_name => "GridPanel", :columns => [:id, :name, :created_at]
|
62
|
-
# On how to configure a widget, see documentation for Netzke::Base or/and specific widget
|
63
|
-
def netzke(name, config = {})
|
64
|
-
::ActiveSupport::Deprecation.warn("widget_class_name option is deprecated. Use class_name instead", caller) if config[:widget_class_name]
|
65
|
-
class_name = config[:class_name] ||= config[:widget_class_name] || name.to_s.camelcase
|
66
|
-
config[:name] = name
|
67
|
-
Netzke::Base.reg_widget(config)
|
68
|
-
w = Netzke::Base.instance_by_config(config)
|
69
|
-
w.before_load # inform the widget about initial load
|
70
|
-
content_for :netzke_js_classes, w.js_missing_code(@rendered_classes ||= [])
|
71
|
-
content_for :netzke_on_ready, "#{w.js_widget_instance}\n\n#{w.js_widget_render}"
|
72
|
-
|
73
|
-
# Now mark this widget's class as rendered, so that we only generate it once per view
|
74
|
-
@rendered_classes << class_name unless @rendered_classes.include?(class_name)
|
75
|
-
|
76
|
-
# Return the html for this widget
|
77
|
-
w.js_widget_html
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|