netzke-core 0.7.7 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -2
- data/CHANGELOG.md +572 -0
- data/LICENSE +7 -1
- data/README.md +345 -29
- data/Rakefile +3 -3
- data/app/controllers/netzke_controller.rb +37 -48
- data/config/ci/before-travis.sh +3 -4
- data/javascripts/base.js +86 -150
- data/javascripts/ext.js +180 -210
- data/javascripts/{core_extensions.js → js_extensions.js} +0 -0
- data/lib/netzke-core.rb +16 -6
- data/lib/netzke/base.rb +84 -107
- data/lib/netzke/core.rb +7 -41
- data/lib/netzke/core/action_config.rb +37 -0
- data/lib/netzke/core/actions.rb +123 -0
- data/lib/netzke/core/client_class.rb +252 -0
- data/lib/netzke/core/component_config.rb +12 -0
- data/lib/netzke/core/composition.rb +274 -0
- data/lib/netzke/core/config_to_dsl_delegator.rb +69 -0
- data/lib/netzke/core/configuration.rb +63 -0
- data/lib/netzke/core/css_config.rb +51 -0
- data/lib/netzke/core/dynamic_assets.rb +19 -49
- data/lib/netzke/{embedding.rb → core/embedding.rb} +4 -6
- data/lib/netzke/core/endpoint_response.rb +15 -0
- data/lib/netzke/core/javascript.rb +111 -0
- data/lib/netzke/core/panel.rb +11 -0
- data/lib/netzke/{plugins.rb → core/plugins.rb} +10 -5
- data/lib/netzke/core/railz.rb +4 -0
- data/lib/netzke/{railz → core/railz}/action_view_ext.rb +22 -18
- data/lib/netzke/core/railz/action_view_ext/ext.rb +49 -0
- data/lib/netzke/core/railz/controller_extensions.rb +17 -0
- data/lib/netzke/core/railz/engine.rb +16 -0
- data/lib/netzke/core/railz/routes.rb +10 -0
- data/lib/netzke/core/ruby_ext.rb +5 -0
- data/lib/netzke/core/ruby_ext/array.rb +23 -0
- data/lib/netzke/core/ruby_ext/hash.rb +47 -0
- data/lib/netzke/{core_ext → core/ruby_ext}/string.rb +2 -7
- data/lib/netzke/core/ruby_ext/symbol.rb +13 -0
- data/lib/netzke/{core_ext → core/ruby_ext}/time_with_zone.rb +0 -0
- data/lib/netzke/core/services.rb +130 -0
- data/lib/netzke/core/session.rb +15 -19
- data/lib/netzke/core/state.rb +40 -0
- data/lib/netzke/core/stylesheets.rb +48 -0
- data/lib/netzke/core/version.rb +2 -2
- data/lib/netzke/plugin.rb +8 -11
- data/netzke-core.gemspec +69 -59
- data/test/core_test_app/Gemfile +2 -20
- data/test/core_test_app/Gemfile.lock +65 -74
- data/test/core_test_app/app/components/card_component_loader.rb +4 -4
- data/test/core_test_app/app/components/component_loader.rb +40 -120
- data/test/core_test_app/app/components/component_loader/javascripts/component_loader.js +49 -0
- data/test/core_test_app/app/components/component_with_actions.rb +61 -47
- data/test/core_test_app/app/components/component_with_custom_css.rb +8 -5
- data/test/core_test_app/app/components/component_with_js_mixin.rb +11 -5
- data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_one.js +1 -1
- data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_two.js +1 -1
- data/test/core_test_app/app/components/component_with_js_mixin/javascripts/method_set_one.js +1 -1
- data/test/core_test_app/app/components/component_with_nested_through.rb +2 -2
- data/test/core_test_app/app/components/component_with_prebuilt_toolbar_control.rb +12 -0
- data/test/core_test_app/app/components/component_with_prebuilt_toolbar_control/javascripts/component_with_prebuilt_toolbar_control.js +12 -0
- data/test/core_test_app/app/components/component_with_required_js.rb +24 -0
- data/test/core_test_app/app/components/configurable_on_class_level.rb +8 -0
- data/test/core_test_app/app/components/dsl_delegated_properties.rb +4 -0
- data/test/core_test_app/app/components/dsl_delegated_properties_base.rb +5 -0
- data/test/core_test_app/app/components/dynamic_tab_panel/javascripts/dynamic_tab_panel.js +2 -2
- data/test/core_test_app/app/components/ext_direct/composite.rb +32 -33
- data/test/core_test_app/app/components/ext_direct/details.rb +2 -4
- data/test/core_test_app/app/components/ext_direct/selector.rb +20 -22
- data/test/core_test_app/app/components/ext_direct/statistics.rb +2 -4
- data/test/core_test_app/app/components/extended_component_with_actions.rb +7 -3
- data/test/core_test_app/app/components/extended_component_with_js_mixin.rb +7 -4
- data/test/core_test_app/app/components/extended_component_with_js_mixin/javascripts/some_method_set.js +1 -1
- data/test/core_test_app/app/components/extended_server_caller.rb +20 -14
- data/test/core_test_app/app/components/hello_world.rb +23 -0
- data/test/core_test_app/app/components/hello_world/javascripts/hello_world.js +12 -0
- data/test/core_test_app/app/components/included.js +2 -2
- data/test/core_test_app/app/components/kinda_complex_component.rb +1 -3
- data/test/core_test_app/app/components/kinda_complex_component/basic_stuff.rb +15 -17
- data/test/core_test_app/app/components/kinda_complex_component/extra_stuff.rb +4 -5
- data/test/core_test_app/app/components/loader_of_component_with_custom_css.rb +14 -5
- data/test/core_test_app/app/components/localized_panel.rb +23 -25
- data/test/core_test_app/app/components/multipane_component_loader.rb +19 -20
- data/test/core_test_app/app/components/nested_component.rb +4 -5
- data/test/core_test_app/app/components/panel_with_plugin.rb +8 -3
- data/test/core_test_app/app/components/panel_with_tools.rb +15 -14
- data/test/core_test_app/app/components/plugin_with_components.rb +20 -12
- data/test/core_test_app/app/components/scoped_components/deep_scoped_components/some_deep_scoped_component.rb +5 -2
- data/test/core_test_app/app/components/scoped_components/extended_scoped_component.rb +5 -2
- data/test/core_test_app/app/components/scoped_components/some_scoped_component.rb +5 -2
- data/test/core_test_app/app/components/server_caller.rb +39 -17
- data/test/core_test_app/app/components/server_caller/javascripts/server_caller.js +42 -0
- data/test/core_test_app/app/components/server_counter.rb +18 -82
- data/test/core_test_app/app/components/server_counter/javascripts/server_counter.js +53 -0
- data/test/core_test_app/app/components/simple_authentication_component.rb +46 -0
- data/test/core_test_app/app/components/simple_component.rb +8 -3
- data/test/core_test_app/app/components/simple_composite.rb +12 -0
- data/test/core_test_app/app/components/simple_form_with_file_upload.rb +49 -0
- data/test/core_test_app/app/components/simple_panel.rb +2 -2
- data/test/core_test_app/app/components/simple_tab_panel.rb +24 -3
- data/test/core_test_app/app/components/simple_window.rb +4 -2
- data/test/core_test_app/app/components/some_composite.rb +77 -48
- data/test/core_test_app/app/components/some_plugin.rb +31 -30
- data/test/core_test_app/app/components/stateful_component.rb +46 -0
- data/test/core_test_app/app/components/stateful_component_with_shared_state.rb +11 -0
- data/test/core_test_app/app/components/window_with_simple_component.rb +14 -0
- data/test/core_test_app/app/views/layouts/application.html.erb +1 -1
- data/test/core_test_app/app/views/simple_rails/multiple_nested.html.erb +7 -19
- data/test/core_test_app/app/views/simple_rails/panel.html.erb +1 -0
- data/test/core_test_app/config/database.yml.travis +3 -5
- data/test/core_test_app/config/environments/production.rb +1 -1
- data/test/core_test_app/config/initializers/netzke.rb +3 -1
- data/test/core_test_app/config/locales/en.yml +9 -4
- data/test/core_test_app/config/locales/es.yml +4 -2
- data/test/core_test_app/config/routes.rb +2 -8
- data/test/core_test_app/db/schema.rb +3 -11
- data/test/core_test_app/features/actions_and_tools.feature +1 -0
- data/test/core_test_app/features/client-server.feature +7 -0
- data/test/core_test_app/features/component_loader.feature +13 -13
- data/test/core_test_app/features/composition.feature +14 -0
- data/test/core_test_app/features/config_to_dsl_delegation.feature +10 -0
- data/test/core_test_app/features/file_inclusion.feature +1 -1
- data/test/core_test_app/features/i18n.feature +4 -4
- data/test/core_test_app/features/js_include.feature +1 -1
- data/test/core_test_app/features/persistence.feature +21 -5
- data/test/core_test_app/features/step_definitions/generic_steps.rb +14 -0
- data/test/core_test_app/features/support/paths.rb +0 -3
- data/test/core_test_app/public/images/icons/accept.png +0 -0
- data/test/core_test_app/public/images/icons/anchor.png +0 -0
- data/test/core_test_app/public/images/icons/tick.png +0 -0
- data/test/core_test_app/spec/action_config_spec.rb +15 -0
- data/test/core_test_app/spec/{component/actions_spec.rb → actions_spec.rb} +38 -36
- data/test/core_test_app/spec/base_spec.rb +35 -0
- data/test/core_test_app/spec/client_class_spec.rb +17 -0
- data/test/core_test_app/spec/component +0 -0
- data/test/core_test_app/spec/composition_spec.rb +118 -0
- data/test/core_test_app/spec/core_ext_spec.rb +3 -14
- data/test/core_test_app/spec/endpoint_response_spec.rb +17 -0
- data/test/core_test_app/spec/javascript_spec.rb +33 -0
- data/test/core_test_app/spec/js_class_config_scope.rb +37 -0
- data/test/core_test_app/spec/panel_spec.rb +11 -0
- data/test/core_test_app/spec/services_spec.rb +16 -0
- data/test/core_test_app/spec/state_spec.rb +20 -0
- data/test/unit/core_ext_test.rb +0 -53
- data/test/unit/netzke_core_test.rb +11 -11
- metadata +76 -62
- data/CHANGELOG.rdoc +0 -325
- data/javascripts/touch.js +0 -58
- data/lib/netzke/actions.rb +0 -107
- data/lib/netzke/composition.rb +0 -224
- data/lib/netzke/config_to_dsl_delegator.rb +0 -43
- data/lib/netzke/configuration.rb +0 -195
- data/lib/netzke/core/masquerading.rb +0 -34
- data/lib/netzke/core_ext.rb +0 -6
- data/lib/netzke/core_ext/array.rb +0 -30
- data/lib/netzke/core_ext/hash.rb +0 -86
- data/lib/netzke/core_ext/symbol.rb +0 -21
- data/lib/netzke/ext_component.rb +0 -25
- data/lib/netzke/inheritance.rb +0 -31
- data/lib/netzke/javascript.rb +0 -382
- data/lib/netzke/javascript/scopes.rb +0 -39
- data/lib/netzke/railz.rb +0 -4
- data/lib/netzke/railz/action_view_ext/ext.rb +0 -64
- data/lib/netzke/railz/action_view_ext/touch.rb +0 -52
- data/lib/netzke/railz/controller_extensions.rb +0 -33
- data/lib/netzke/railz/engine.rb +0 -48
- data/lib/netzke/railz/routes.rb +0 -7
- data/lib/netzke/services.rb +0 -101
- data/lib/netzke/session.rb +0 -54
- data/lib/netzke/state.rb +0 -91
- data/lib/netzke/stylesheets.rb +0 -65
- data/test/core_test_app/app/components/component_with_included_js.rb +0 -16
- data/test/core_test_app/app/components/component_with_session_persistence.rb +0 -35
- data/test/core_test_app/app/components/deprecated/server_caller.rb +0 -20
- data/test/core_test_app/app/components/dynamic_tab_panel.rb +0 -19
- data/test/core_test_app/app/components/hello_world_component.rb +0 -31
- data/test/core_test_app/app/components/touch/hello_world_component.rb +0 -25
- data/test/core_test_app/app/components/touch/server_caller.rb +0 -28
- data/test/core_test_app/app/components/touch/simple_carousel.rb +0 -17
- data/test/core_test_app/app/controllers/touch_controller.rb +0 -6
- data/test/core_test_app/app/helpers/touch_helper.rb +0 -2
- data/test/core_test_app/app/views/layouts/touch.html.erb +0 -13
- data/test/core_test_app/db/migrate/20110110132720_create_netzke_component_states.rb +0 -20
- data/test/core_test_app/features/step_definitions/touch_steps.rb +0 -3
- data/test/core_test_app/features/touch.feature +0 -10
- data/test/core_test_app/gemfiles/rails3_1.gemfile +0 -16
- data/test/core_test_app/gemfiles/rails3_2.gemfile +0 -16
- data/test/core_test_app/spec/component/base_spec.rb +0 -36
- data/test/core_test_app/spec/component/component_spec.rb +0 -20
- data/test/core_test_app/spec/component/composition_spec.rb +0 -132
- data/test/core_test_app/spec/component/configuration_spec.rb +0 -61
- data/test/core_test_app/spec/component/javascript_spec.rb +0 -16
- data/test/core_test_app/spec/component/state_spec.rb +0 -18
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,572 @@
|
|
1
|
+
# v0.8.0 - WIP
|
2
|
+
## Misc
|
3
|
+
* many backward-incompatible API changes, see below
|
4
|
+
* major code clean-up and refactor
|
5
|
+
* introduce `Netzke::Core::Panel` - a simple panel with defaults, that can be immediately rendered
|
6
|
+
* Netzke child components can now be referred anywhere (e.g. dockedItems), not only in items
|
7
|
+
* drop support for Ruby 1.8.7
|
8
|
+
* rename `netzke_init` view helper method to `load_netzke`
|
9
|
+
* `before_load` is gone; if necessary, do preload stuff in the overridden `Base#js_configure`
|
10
|
+
* rename `global_id` to `js_id`
|
11
|
+
* `load_nezke` (previously `netzke_init`) now understands the `minified` option
|
12
|
+
* implement referring to config methods declared in JavaScript from Ruby by using :symbols (see `Netzke::Base`)
|
13
|
+
* i18n of actions takes into account ancestor classes
|
14
|
+
* child component and action config now understand `excluded` option (handy for authorization)
|
15
|
+
* `Base#update_state` and `#clear_state` are gone. Use `state` directly.
|
16
|
+
|
17
|
+
## Component self-configuration
|
18
|
+
|
19
|
+
Often when extending an existing component (e.g. from `Netzke::Basepack`), there's a need to tune its behaviour by modifying its configuration. There are 2 methods that can be overridden in order to achieve that: `Base#configure` and `Base#js_configure`. The former is used to configure a component as whole. The latter - exclusively the component's JavaScript class instance. `js_configure` is being called only when the component is being rendered in the browser, and not when a component is instantiated, for example, for invoking its endpoint.
|
20
|
+
|
21
|
+
Both methods receive as the only argument a `ActiveSupport::OrderedOptions`, which allows for syntax like this:
|
22
|
+
|
23
|
+
def configure(c)
|
24
|
+
c.some_config_option = 42
|
25
|
+
c.merge!(option_one: 1, option_two: 2)
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
Calling `super` is essential for the super-component to do its own configuration (for example, `Netzke::Base#configure` would mix in the passed config options).
|
30
|
+
|
31
|
+
The `Base#default_config` method and any other `Base#*_config` methods are gone and should be replaced with `Base#configure` or `Base#js_configure` - depending on the goal.
|
32
|
+
|
33
|
+
### Base#configure
|
34
|
+
|
35
|
+
The `configure` method must be used to override the configuration of a component as whole (influencing component's both Ruby and JavaScript behaviour). For example, if the super component implements the `persistence` option, we may want to enable it in our component like this:
|
36
|
+
|
37
|
+
def configure(c)
|
38
|
+
c.persistence = true
|
39
|
+
super
|
40
|
+
end
|
41
|
+
|
42
|
+
The place to call `super` is important. In the provided example, the `persistence` option can be overridden by this component's user. However, if we put it after `super`, it will override the user's setting. Another example of overriding a user's setting might be, for example, extending a component bottom bar depending on the `mode` config:
|
43
|
+
|
44
|
+
def configure(c)
|
45
|
+
super
|
46
|
+
c.bbar = [*c.bbar, '-', :admin] if c.mode == :admin
|
47
|
+
end
|
48
|
+
|
49
|
+
The `configure` method is useful for (dynamically) defining toolbars, titles, and other properties of a component's instance.
|
50
|
+
|
51
|
+
### Access to component's config
|
52
|
+
|
53
|
+
The result of `Base#configure` can be accessed through `Base#config` method from anywhere in the class.
|
54
|
+
|
55
|
+
### Base#js_configure
|
56
|
+
|
57
|
+
The `js_configure' method should be used to override the JS-side component configuration. It is called by the framework when the configuration for the JS instantiating of the component should be retrieved. Thus, it's *not* being called when a component is being instantiated to process an endpoint call. Override it when you need to extend/modify the config for the JS component intance.
|
58
|
+
|
59
|
+
The execution of `js_configure` does not influence the content of the `Base#config` method.
|
60
|
+
|
61
|
+
## JavaScript class configuration
|
62
|
+
|
63
|
+
The following DSL methods are gone: `js_include`, `js_mixin`, `js_base_class`, `js_method`, `js_property`, `js_properties`. Instead, use the `js_configure` class method (not to be confused with the previously mentioned *intstance* method `Base#js_configure`):
|
64
|
+
|
65
|
+
class MyComponent < Netzke::Base
|
66
|
+
js_configure do |c|
|
67
|
+
c.mixin # replaces js_mixin preserving the signature
|
68
|
+
c.require # replaces js_include preserving the signature
|
69
|
+
c.extend = "Ext.tab.Panel" # replaces js_base_class
|
70
|
+
|
71
|
+
c.title = "My Component" # use instead of js_property :title, "My Component"
|
72
|
+
|
73
|
+
c.on_my_action = <<-JS # use instead of js_method :on_my_action, ...
|
74
|
+
function(){
|
75
|
+
// ...
|
76
|
+
}
|
77
|
+
JS
|
78
|
+
end
|
79
|
+
|
80
|
+
# ...
|
81
|
+
end
|
82
|
+
|
83
|
+
As you see, assignement must be used to define the JS class's properties, including functions.
|
84
|
+
|
85
|
+
## Actions
|
86
|
+
|
87
|
+
The `action` DSL method does not accept a hash as an optional second parameter any longer, but rather a block, which receives a configuration object:
|
88
|
+
|
89
|
+
action :destroy do |c|
|
90
|
+
c.text = "Destroy!"
|
91
|
+
c.tooltip = "Destroying it all"
|
92
|
+
c.icon = :delete
|
93
|
+
end
|
94
|
+
|
95
|
+
The following is still valid:
|
96
|
+
|
97
|
+
action :my_action # it will use default (eventually localized) values for text and tooltip
|
98
|
+
|
99
|
+
### Overriding actions in inherited classes
|
100
|
+
|
101
|
+
Overriding an action while extending a component is possible by using the same `acton` method. To receive the action config from the superclass, use the `super` method, passing to it the block parameter:
|
102
|
+
|
103
|
+
action :destroy do |c|
|
104
|
+
super(c) # do the config from the superclass
|
105
|
+
c.text = "Destroy if you dare" # overriding the text
|
106
|
+
end
|
107
|
+
|
108
|
+
### Referring to actions in toolbars/menus
|
109
|
+
|
110
|
+
`Symbol#action` is no longer defined. Refer to actions in toolbars/menus by simply using symbols:
|
111
|
+
|
112
|
+
def configure(c)
|
113
|
+
super
|
114
|
+
c.bbar = [:my_action, :destroy]
|
115
|
+
end
|
116
|
+
|
117
|
+
Another way (useful when re-configuring the toolbars of a child component) is by using hashes that have the `netzke_action` key:
|
118
|
+
|
119
|
+
def configure(c)
|
120
|
+
super
|
121
|
+
|
122
|
+
c.bbar = [
|
123
|
+
{ netzke_action: :my_action, title: "My cool action" },
|
124
|
+
{ netzke_action: :destroy, title: "Destroy!" }
|
125
|
+
]
|
126
|
+
end
|
127
|
+
|
128
|
+
Referring to actions on the class level (e.g. with `js_property :bbar`) will no longer work. Define the toolbars inside the `configure` method.
|
129
|
+
|
130
|
+
### I18n of actions
|
131
|
+
|
132
|
+
+text+, +tooltip+ and +icon+ for an action will be picked up from a locale file (if located there) whenever they are not specified in the config.
|
133
|
+
E.g., an action `some_action` defined in the component +MyComponents::CoolComponent+, will look for its text in:
|
134
|
+
|
135
|
+
I18n.t('my_components.cool_component.actions.some_action.text')
|
136
|
+
|
137
|
+
for its tooltip in:
|
138
|
+
|
139
|
+
I18n.t('my_components.cool_component.actions.some_action.tooltip')
|
140
|
+
|
141
|
+
and for its icon in:
|
142
|
+
|
143
|
+
I18n.t('my_components.cool_component.actions.some_action.icon')
|
144
|
+
|
145
|
+
## Child components
|
146
|
+
|
147
|
+
### Defining child components
|
148
|
+
|
149
|
+
A child component gets defined with the `component` method receiving a block:
|
150
|
+
|
151
|
+
component :east_center_panel do |c|
|
152
|
+
c.klass = SimpleComponent
|
153
|
+
c.title = "A panel"
|
154
|
+
c.border = false
|
155
|
+
end
|
156
|
+
|
157
|
+
Child component's class is now specified as the `klass` option and is actually a Class, not a String. When no `klass` or no block is given, the component's class will be derived from its name, e.g.:
|
158
|
+
|
159
|
+
component :simple_component
|
160
|
+
|
161
|
+
is equivalent to:
|
162
|
+
|
163
|
+
component :simple_component do |c|
|
164
|
+
c.klass = SimpleComponent
|
165
|
+
end
|
166
|
+
|
167
|
+
Defining a component in a block gives an advantage of accessing the `config` method of the parent component, e.g.:
|
168
|
+
|
169
|
+
component :east_center_panel do |c|
|
170
|
+
c.klass = SimpleComponent
|
171
|
+
c.title = config.east_center_panel_title # something that could be passed as a config option to the parent component
|
172
|
+
end
|
173
|
+
|
174
|
+
If no `klass` is specified, `Netzke::Core::Panel` is assumed.
|
175
|
+
|
176
|
+
### Overriding child components
|
177
|
+
|
178
|
+
Overriding a child component while extending a component is possible by using the same `component` method. To receive the child component config from the superclass, use the `super` method, passing to it the block parameter:
|
179
|
+
|
180
|
+
component :simple_component do |c|
|
181
|
+
super(c) # do the config from the superclass
|
182
|
+
c.klass = LessSimpleComponent # use a different class
|
183
|
+
end
|
184
|
+
|
185
|
+
### Lazy vs eager component loading
|
186
|
+
|
187
|
+
All child components now by default are being lazily loaded on request from the parent, unless they are referred in the layout (see the **Layout** section). You can override this behavior by setting `eager_loading` to `true`, so that the child component's config and class are instantly available at the parent.
|
188
|
+
|
189
|
+
## Layout
|
190
|
+
|
191
|
+
### Referring to Netzke components
|
192
|
+
|
193
|
+
The `Symbol#component` method is no longer defined. The preferred way of referring to child components in (docked) items is by using symbols:
|
194
|
+
|
195
|
+
# provided child_one and child_two components are defined in the class
|
196
|
+
def configure(c)
|
197
|
+
super
|
198
|
+
|
199
|
+
c.items = [:child_one, :child_two]
|
200
|
+
end
|
201
|
+
|
202
|
+
Another way (useful when re-configuring the layout of a child component) is by using hashes that have the `component` key:
|
203
|
+
|
204
|
+
def configure(c)
|
205
|
+
super
|
206
|
+
|
207
|
+
c.items = [
|
208
|
+
{ xtype: :panel, title: "Simple Ext panel" },
|
209
|
+
{ component: :child_one, title: "First child" },
|
210
|
+
{ component: :child_two, title: "Second child" }
|
211
|
+
]
|
212
|
+
end
|
213
|
+
|
214
|
+
### Implicitly defined components in items
|
215
|
+
|
216
|
+
Previously there was a way to specify a component class directly in items (by using the `class_name` option), which would implicitly define a child component. This is no longer possible. The layout can now only refer to explicitly defined components.
|
217
|
+
|
218
|
+
### Specifying items in config
|
219
|
+
|
220
|
+
It is possible to specify the items in the config in the same format as it is done in the `items` method. If `config.items` is provided, it takes precedence over the `items` method. This can be useful for modifying the default layout of a child component by means of configuring it.
|
221
|
+
|
222
|
+
It's advised to override the `items` method when a component needs to define it's layout, and not use the `configure` method for that (see the **Self-configuration** section).
|
223
|
+
|
224
|
+
### DSL-delegated methods are gone
|
225
|
+
|
226
|
+
No more `title` and `items` are defined as DSL methods. Include `Netzke::ConfigToDslDelegator` and use `delegate_to_dsl` method if you need that functionality in a component.
|
227
|
+
Thus, `Netzke::ConfigToDslDelegator` is not included in Netzke::Base anymore.
|
228
|
+
|
229
|
+
## Defining client class
|
230
|
+
|
231
|
+
Client class (JavaScript part of the component) has been refactored.
|
232
|
+
|
233
|
+
### Methods renamed
|
234
|
+
|
235
|
+
The following public method name changes took place for the sake of consistence:
|
236
|
+
|
237
|
+
* localId => netzkeLocalId
|
238
|
+
* setResult => netzkeSetResult
|
239
|
+
* endpointUrl => netzkeEndpointUrl
|
240
|
+
* loadNetzkeComponent => netzkeLoadComponent (signature changed, see "javascripts/ext.js")
|
241
|
+
* componentDelivered => netzkeComponentDelivered
|
242
|
+
* componentDeliveryFailed => netzkeComponentDeliveryFailed
|
243
|
+
* getParentNetzkeComponent => netzkeGetParentComponent
|
244
|
+
* reload => netzkeReload
|
245
|
+
* instantiateChildNetzkeComponent => netzkeInstantiateComponent
|
246
|
+
* getChildNetzkeComponent => netzkeGetComponent
|
247
|
+
|
248
|
+
# v0.7.7 - 2012-10-21
|
249
|
+
* Ext JS required version bump (4.1.x)
|
250
|
+
|
251
|
+
# v0.7.6 - 2012-07-27
|
252
|
+
* Rails 3.2
|
253
|
+
|
254
|
+
# v0.7.5 - 2012-03-05
|
255
|
+
* API changes
|
256
|
+
* The `:class_name` option must *always* include the full class name now. So, `Basepack::GridPanel` won't work, instead do `Netzke::Basepack::GridPanel`
|
257
|
+
|
258
|
+
* enhancements
|
259
|
+
* Set default Ext.Direct retry attempts to 0, as more than 0 may only be needed in special cases.
|
260
|
+
|
261
|
+
# v0.7.4 - 2011-10-20
|
262
|
+
* enhancements
|
263
|
+
* Less aggressive rescuing at constantizing a string, to let more descriptive exceptions get through.
|
264
|
+
* New `delegates_to_dsl` class method to degelate default config options to class level. See the `ConfigToDslDelegator` module.
|
265
|
+
|
266
|
+
# v0.7.3 - 2011-09-04
|
267
|
+
* Rails 3.1 compatibility. Really. Hopefully.
|
268
|
+
|
269
|
+
# v0.7.2 - 2011-08-31
|
270
|
+
* Rails 3.1
|
271
|
+
* bug fix
|
272
|
+
* When a component is dynamically loaded in a container, the load mask is now limited to that container
|
273
|
+
* enhancements
|
274
|
+
* New u config option for loadNetzkeComponent, which prevents emptying the container when inserting the newly loaded component; can be used for loading components into layouts different from 'fit'
|
275
|
+
|
276
|
+
# v0.7.1 - 2011-08-17
|
277
|
+
* bug fix
|
278
|
+
* Multiple compound Netzke components in the same Rails view were causing JS errors
|
279
|
+
|
280
|
+
# v0.7.0 - 2011-08-09
|
281
|
+
* Ext JS 4 compatibility
|
282
|
+
|
283
|
+
* API changes
|
284
|
+
* New `ext_uri` config option (defaults to "extjs") - relative URI to the Ext JS library on the server.
|
285
|
+
* New `ext3_compat_uri` config option (defaults to `nil`) - relative URI to the Ext 3 compatibility layer. When nil, no compatibility layer is loaded.
|
286
|
+
* New `current_user_method` config option (defaults to :current_user) to let Netzke::Core know which method to call on Rails controller to retrieve the current user.
|
287
|
+
* New `Netzke::Core.current_user` method to retrieve the current user.
|
288
|
+
* Passing instructions from server back to the client now is only meant for single-argument methods on client; arrays are not expanded into arguments any longer.
|
289
|
+
* New `instantiateChildNetzkeComponent` method to instantiate a Netzke component by name.
|
290
|
+
* Default component height (400) and border (false) are no longer set.
|
291
|
+
|
292
|
+
* broken API
|
293
|
+
* The `ext_location` config option renamed to `ext_path`
|
294
|
+
* loadNetzkeComponent (ex loadComponent) won't automatically show a component with xtype 'window' any longer; use the callback to do that manually
|
295
|
+
|
296
|
+
* enhancements
|
297
|
+
* `js_mixin` without parameters will assume :component_class_name_underscored
|
298
|
+
* Ext locale file is automatically included when I18n.locale is not :en
|
299
|
+
* Child components now have `itemId` set to component's name, so that `getComponent(component_name)` can be used to retrieve immediate child components
|
300
|
+
* `loadNetzkeComponent` that should be used instead of loadComponent won't render the loaded component unless the container is specified (which can be an id or an instance)
|
301
|
+
* JS: `componentDeliveryFailed` method added that is called by the `deliver_component` endpoint
|
302
|
+
|
303
|
+
* bug fix
|
304
|
+
* Tolerate relative_url_root when calculating the URI to icons in actions
|
305
|
+
|
306
|
+
* deprecations
|
307
|
+
* instantiateAndRenderComponent
|
308
|
+
* getParent in favor of getParentNetzkeComponent
|
309
|
+
* getChildComponent in favor of getChildNetzkeComponent
|
310
|
+
* loadComponent in favor of loadNetzkeComponent
|
311
|
+
* feedback in favor of netzkeFeedback
|
312
|
+
* Ext.container.Container#instantiateChild should not be used
|
313
|
+
|
314
|
+
# v0.6.7 - 2011-08-16
|
315
|
+
* enhancements
|
316
|
+
* No more using `method_missing` for invoking endpoints.
|
317
|
+
* New "cache" option for `netzke_init` which gets passed to `javascript_include_tag` (no support for css caching of this type yet)
|
318
|
+
* Netzke dynamic js and css-files such as ext.js, touch.css, now get generated at the application start, and put into "public/netzke". Solves a long standing problem with serving those files by HTTP servers in some cases. Enables caching naturally.
|
319
|
+
* Moved features and specs to test/core_test_app (tests should be run from that folder from now on)
|
320
|
+
* Introduced plugin functionality. We can create Netzke components that are pluggable into other components as Ext JS plugins.
|
321
|
+
|
322
|
+
# v0.6.6 - 2011-02-26
|
323
|
+
* enhancements
|
324
|
+
* Client-server communication is updated to use Ext.Direct (many thanks to @pschyska)
|
325
|
+
* Introduced `js_translate` class method that allows specifying i18n properties used in the JavaScript class
|
326
|
+
* Better handling of actions i18n
|
327
|
+
* New `Netzke::Base.class_config_option` method to specify a class-level configuration options for a component, e.g. (in GridPanel): `class_config_option :column_filters_available, true`. This option then can be set in Rails application configuration, e.g.: `config.netzke.basepack.grid_panel.column_filters_available = false`, or directly on `Netzke::Core.config`, e.g.: `Netzke::Core.config.netzke.basepack.grid_panel.column_filters_available = false`.
|
328
|
+
|
329
|
+
# v0.6.5 - 2011-01-14
|
330
|
+
* enhancements
|
331
|
+
* Various fixes for IE
|
332
|
+
* Support for Sencha Touch
|
333
|
+
* An endpoint can now "call" JavaScript functions that accept multiple parameters, by specifying an array, e.g.:
|
334
|
+
{:some_js_function => [arg1, arg2]}
|
335
|
+
* New API: `js_mixin` method to "mixin" JavaScript objects from external files (see RDocs).
|
336
|
+
* New JS class `componentLoadMask` property to configure a mask when a component gets dynamically loaded with `loadComponent`. Accepts the same configuration as Ext.LoadMask.
|
337
|
+
* `js_include` and `css_include` accept both symbols and strings, where strings would contain full paths to the included file, whereas symbols get expanded to full paths following simple conventions (see RDocs for details).
|
338
|
+
* Make some of `Netzke::Core` setup happen earlier in the loading process, so that we can safely use it while defining components.
|
339
|
+
* Performance improvements by memoizing `Base.constantize_class_name`.
|
340
|
+
* I18n for actions, see `Netzke::Actions`.
|
341
|
+
|
342
|
+
* bug fix
|
343
|
+
* The "componentload" event now gets fired after a component is dynamically loaded. The handler receives the instance of the loaded component.
|
344
|
+
* Feedback does not insert a new div every time being called
|
345
|
+
* JS class caching was broken for name-scoped classes
|
346
|
+
* When a component was dynamically loaded into a hidden container, it wasn't shown when the container got shown next time
|
347
|
+
|
348
|
+
# v0.6.4 - 2010-11-05
|
349
|
+
* enhancements
|
350
|
+
* Implemented Netzke.isLoading(), useful for testing
|
351
|
+
* Persistence support
|
352
|
+
|
353
|
+
* API change
|
354
|
+
* `endpoint` DSL call now results in a method called <endpoint_name>_endpoint, _not_ just <endpoint_name> (beware when overriding endpoint definitions, or calling endpoint methods on child components)
|
355
|
+
* Using `api` for endpoint declaration is gone
|
356
|
+
|
357
|
+
# v0.6.3 - 2010-11-02
|
358
|
+
* The `ext_config` option is back, deprecated.
|
359
|
+
|
360
|
+
# v0.6.2 - 2010-10-27
|
361
|
+
* Introduced the Symbol#component method to declare components in the config (instead of now deprecated js_component).
|
362
|
+
|
363
|
+
# v0.6.1 - 2010-10-26
|
364
|
+
* Disabled buggy implementation of rendering on-page JS classes in netzke.js instead of main page.
|
365
|
+
|
366
|
+
# v0.6.0 - 2010-10-24
|
367
|
+
* Rails3 compatibility, thorough rewrite
|
368
|
+
* Much more thorough testing
|
369
|
+
|
370
|
+
* API backward incompatibility
|
371
|
+
* `ext_config` config level is removed; put all that configuration in the top level
|
372
|
+
* mentioning actions in the `bbar`, `tbar`, etc, should be explicit, e.g.:
|
373
|
+
|
374
|
+
:bbar => [:apply.action, :delete.action]
|
375
|
+
|
376
|
+
* `late_aggregatee` is now `lazy_loading`
|
377
|
+
* `aggregatees` are now `components`
|
378
|
+
* `widgets` are now `components`, too
|
379
|
+
* `api` is now `endpoint`
|
380
|
+
* `persistent_config_enabled?` is now `persistence_enabled?`
|
381
|
+
* Using the `js_extend_properties` class method in your components in deprecated (and maybe even broken). Use `js_property` (or `js_properties`) and `js_method` instead (see multiple examples in test/core_test_app)
|
382
|
+
* the `load_component_with_cache` endpoint renamed to `deliver_component`
|
383
|
+
|
384
|
+
* New
|
385
|
+
* `ext` helper in the views to embed any (pure) Ext component into a view
|
386
|
+
* `component` DSL method to declare child components
|
387
|
+
* `config` DSL method to set the configuration of an instance
|
388
|
+
* `action` DSL method to configure actions
|
389
|
+
* `js_method` DSL method to define (public) methods in JS class
|
390
|
+
* `js_property` DSL method to define (public) properties in JS class
|
391
|
+
* `endpoint` DSL method to define server endpoints
|
392
|
+
|
393
|
+
* Different deprecations throughout the code
|
394
|
+
|
395
|
+
# v0.5.3 - 2010-06-14
|
396
|
+
* Fix: Getting rid of deprecation warnings about tasks not sitting in lib.
|
397
|
+
|
398
|
+
# v0.5.2 - 2010-06-11
|
399
|
+
* Ext 3.2.1
|
400
|
+
* Fix: Netzke::Base.before_load is now also called for the widgets embedded directly into a view.
|
401
|
+
* New: support for external stylesheets.
|
402
|
+
* Fix: the "value" column type has been changed to text to prevent migration problems is some cases
|
403
|
+
* New: global_persistent_config method allows accessing persistent storage with no owner (widget) assigned
|
404
|
+
* New: any widget can now implement <tt>before_api_call</tt> interceptor. If it returns anything but empty hash, it'll be used as the result of *any* API call to this widget. The interceptor receives as parameter the name of the API call issued and the arguments. Use it to implement authorization.
|
405
|
+
* Fix: got the Ext's state provider out of the way (thank you for all the confusion)
|
406
|
+
|
407
|
+
# v0.5.1 - 2010-02-26
|
408
|
+
* Compatibility with Ext 3.1.1
|
409
|
+
* New: <tt>Netzke.page</tt> object now contains all the widgets declared on the page
|
410
|
+
* Code: replaced (references to) deprecated function names
|
411
|
+
|
412
|
+
# v0.5.0 - 2010-01-10
|
413
|
+
* Compatibility with Ext 3.1.0
|
414
|
+
* API change: Netzke widget's now should be declared directly in the views instead of controllers.
|
415
|
+
* API change: all ExtJS and Netzke JavaScript and styles are now loaded with the help of <tt>netzke_init</tt> helper.
|
416
|
+
* API change: <tt>persistence_key</tt> option replaces <tt>persistent_config_id</tt> option.
|
417
|
+
* Impr: headers in panels in the "config" mode now show the widget's global ID.
|
418
|
+
* New: required ExtJS version check introduced at initial Netzke load.
|
419
|
+
* Depr: :widget_class_name option is deprecated, use :class_name.
|
420
|
+
* DRY: now there's no need to always define "actions" method, use it to override the defaults, which are automatically calculated based on configuration for toolbars/menu.
|
421
|
+
* Impr: each generated JS class now has its unique xtype, e.g. "netzkegridpanel".
|
422
|
+
* Fix: FeedbackGhost moved over from netzke-basepack.
|
423
|
+
|
424
|
+
# v0.4.5.2 - 2009-11-09
|
425
|
+
* Fix: Hash#convert_keys and Array#convert_keys in core extensions are now renamed into deep_convert_keys, and now always plainly do what they're expected to do: recursively convert keys according to given block.
|
426
|
+
|
427
|
+
# v0.4.5.1 - 2009-11-09
|
428
|
+
* Regression: fixing inheritance and caching.
|
429
|
+
* FeedbackGhost is too simple to be a Netzke widget (having no server part), so, moved to static JavaScript.
|
430
|
+
|
431
|
+
# v0.4.5 - 2009-11-08
|
432
|
+
* API change: Netzke::Base: <tt>id_name</tt> accessor renamed to <tt>global_id</tt>
|
433
|
+
* Code: several internal code changes
|
434
|
+
* Code: lightly better test coverage
|
435
|
+
* New: <tt>Netzke::Base#global_id_by_reference</tt> method
|
436
|
+
* Compatibility: resolving conflicts with the <tt>api</tt> property in some Ext v3.0 components
|
437
|
+
* Fix: <tt>deliver_component</tt> was throwing exception when the requested component wasn't defined
|
438
|
+
* New: <tt>persistent_config_id</tt> configuration option allows specifying an id by which persistent configuration is identified for the widget. Handy if different homogeneous widgets need to share the same persistent configuration.
|
439
|
+
* New: <tt>Netzke::Base#persistent_config</tt> method now accepts an optional boolean parameter signalizing that the configuration is global (not bound to a widget)
|
440
|
+
* Impr: cleaner handling of actions and toolbars; fbar configuration introduced.
|
441
|
+
* Impr: calling an API method now provides for the result value (if return by the server) in the callback.
|
442
|
+
* Impr: allows name spaced creation of Netzke widgets, e.g. widgets can now be defined under any module under Netzke, not only *directly* under Netzke.
|
443
|
+
* New: support for Ext.Window-based widgets (it'll call show() on them when the "*_widget_render" helper is used).
|
444
|
+
|
445
|
+
# v0.4.4 - 2009-10-12
|
446
|
+
* API change: default handlers for actions and tools are now supposed to be prefixed with "on". E.g.: if you declare an action named <tt>clear_table</tt>, the handler must be called (in Ruby) <tt>on_clear_table</tt> (mapped to <tt>onClearTable</tt> in JavaScript).
|
447
|
+
* Internal: the JavaScript instance now knows if persistent config is enabled (by checking this.persistentConfig).
|
448
|
+
* Fix: solving the "Node cannot be inserted at the specified point in the hierarchy" problem by being more strict with duplicated IDs for elements on the same page.
|
449
|
+
* Fix: Ext 3.0 compatibility.
|
450
|
+
* Impr: <tt>getChildComponent</tt> now allows referring to a widget like this: "parent__parent__some_widget__some_nested_widget"
|
451
|
+
|
452
|
+
# v0.4.3
|
453
|
+
* Fix: reworking loadComponent()-related code, closing a security flaw when a malicious browser could send any configuration options to instantiate the widget being loaded.
|
454
|
+
|
455
|
+
# v0.4.2 - 2009-09-11
|
456
|
+
* Fix: the API call (at the JavaScript side) was ignoring the callback parameter.
|
457
|
+
* Impr: if the array of API points is empty, it's not added into js_config anymore.
|
458
|
+
* New: new testing widgets in netzke_controller.
|
459
|
+
* Fix: extra CSS includes now take effect.
|
460
|
+
* New: Support for masquerading as "World". In this mode all the "touched" persistent preferences will be overwritten for all roles and users.
|
461
|
+
|
462
|
+
# v0.4.1 - 2009-09-06
|
463
|
+
* Version bumb to force github rebuild the gem (Manifest is now included)
|
464
|
+
|
465
|
+
# v0.4.0 - 2009-09-05
|
466
|
+
* Major refactoring.
|
467
|
+
|
468
|
+
# v0.3.2 - 2009-06-05
|
469
|
+
* Netzke doesn't overwrite session[:user] anymore to not cause authentication-related problems.
|
470
|
+
|
471
|
+
# v0.3.1 - 2009-05-07
|
472
|
+
* Fix: persistent_config_manager can now be set to nil, and it will work fine
|
473
|
+
|
474
|
+
# v0.3.0 - 2009-05-07
|
475
|
+
* Refactor: got rid of NetzkeLayout model, now all layouts are stored in netzke_preferences
|
476
|
+
* New: persistent_config now has a method for_widget that accepts a block
|
477
|
+
* autotest compatibility
|
478
|
+
* New: String#to_b converts a string to true/false
|
479
|
+
* New: Netzke::Base.session introduced for session data
|
480
|
+
* New: weak_children_config and strong_children_config can now be declared by a widget, which specifies weak and strong configuration that every child of this widget will receive (e.g. display/hide configuration tool)
|
481
|
+
* Fix: (degradation) flash message is now shown again in case of erroneous attempt to load a widge
|
482
|
+
* New: widgets now can check session[:netzke_just_logged_in] and session[:netzke_just_logged_out] automatically set by Netzke after login/logout
|
483
|
+
|
484
|
+
# v0.2.11
|
485
|
+
* Introduction of getOwnerComponent()-method to Ext.Component. It provides the Netzke widget this Component belongs to.
|
486
|
+
|
487
|
+
# v0.2.10
|
488
|
+
* Removed dependency on 'json' gem.
|
489
|
+
* Rails v2.3.2 compatibility.
|
490
|
+
|
491
|
+
# v0.2.9
|
492
|
+
* Actions, toolbars and tools reworked for easier configuration.
|
493
|
+
* Menus introduced (based on actions).
|
494
|
+
* Significant code clean-up.
|
495
|
+
* Bug fix (nasty one): Ext.widgetMixIn was getting messed up along with dynamic widget loading.
|
496
|
+
* Must work in IE now.
|
497
|
+
|
498
|
+
# v0.2.8
|
499
|
+
* Support for extra javascripts and stylesheets per widget.
|
500
|
+
|
501
|
+
# v0.2.7
|
502
|
+
* QuickTips get initialized now, as otherwise Ext 2.2.1 doesn't properly destroy() BoxComponents for me.
|
503
|
+
|
504
|
+
# v0.2.6
|
505
|
+
* FeedackGhost is now capable of displaying multiple flash messages.
|
506
|
+
* Dependencies slightly refactored.
|
507
|
+
* An informative exception added to Base#component_instance.
|
508
|
+
* JS-level inheritance enabled.
|
509
|
+
* Work-around for the problem with Ext 2.2.1 in loadComponent.
|
510
|
+
* Events "<action_id>click" added to the widgets along with the actions.
|
511
|
+
* component_missing method added to Netzke::Base - called when a non-existing aggregate of a widget is tried to be invoked
|
512
|
+
* Code readability improvements.
|
513
|
+
|
514
|
+
# v0.2.5
|
515
|
+
* Minor code restructuring.
|
516
|
+
|
517
|
+
# v0.2.4
|
518
|
+
* Some minor improvements.
|
519
|
+
|
520
|
+
# v0.2.3
|
521
|
+
* FeedbackGhost will show the feedback on the top of the screen independent of the page scrolling.
|
522
|
+
* Ext.Panel#loadComponent will accept null as url to delete the currently loaded widget
|
523
|
+
* Bug fix: persistent_config works again
|
524
|
+
|
525
|
+
# v0.2.2
|
526
|
+
* js_ext_config instance method added for overwriting
|
527
|
+
* Multiuser support
|
528
|
+
* Using Rails.logger for logging
|
529
|
+
* "config"-class method for every class inheriting Netzke::Base - for class-level configurations
|
530
|
+
|
531
|
+
# v0.2.1
|
532
|
+
* Fixed the path to ext-base-min.js for production mode.
|
533
|
+
* Also works in Safari now.
|
534
|
+
|
535
|
+
# v0.2.0
|
536
|
+
* Some re-factoring and redesign. Now simple compound widgets can be created on the fly in the controller
|
537
|
+
* Added ext_widget[:quiet] configuration option to suppress widget's feedback
|
538
|
+
* Support for extra CSS sources, similar to JS
|
539
|
+
* NETZKE_BOOT_CONFIG introduced to specify which Netzke functionality should be disabled to reduce the size of /netzke/netzke.[js|css]
|
540
|
+
* FeedbackGhost widget added - invisible widget providing feedback to the user
|
541
|
+
* netzke_widget controller class-method renamed into netzke
|
542
|
+
* JS-comments now get stripped also from the extra files that get included in the netzke-* gems.
|
543
|
+
* Permissions joined js_config
|
544
|
+
* Bug fixes
|
545
|
+
|
546
|
+
# v0.1.4
|
547
|
+
* Helpers added to facilitate ExtJS/netzke.js inclusion
|
548
|
+
* The route defined for netzke_controller
|
549
|
+
* netzke.html.erb-layout is not needed anymore, so not produced by the generator
|
550
|
+
* Now compliant with Rails' forgery protection
|
551
|
+
|
552
|
+
# v0.1.3
|
553
|
+
* Generators fixed
|
554
|
+
|
555
|
+
# v0.1.2
|
556
|
+
* Fixed the bug with <widget>_class_definition returning empty string on sequential loading.
|
557
|
+
|
558
|
+
# v0.1.1.1
|
559
|
+
* Meta: moving from GitHub to RubyForge
|
560
|
+
|
561
|
+
# v0.1.1
|
562
|
+
* Inter-widget dependencies code reworked
|
563
|
+
* JS-class code generation code slightly reworked
|
564
|
+
|
565
|
+
# v0.1.0.2
|
566
|
+
* Meta: fix outdated Manifest
|
567
|
+
|
568
|
+
# v0.1.0.1
|
569
|
+
* Meta work: replacing underscore with dash in the name
|
570
|
+
|
571
|
+
# v0.1.0 - 2008-12-11
|
572
|
+
* Initial release
|