netzke-core 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +7 -2
- data/{TODO → TODO.md} +17 -4
- data/lib/netzke/base.rb +5 -5
- data/lib/netzke/config_to_dsl_delegator.rb +41 -0
- data/lib/netzke/configuration.rb +3 -1
- data/lib/netzke/core/version.rb +1 -1
- data/netzke-core.gemspec +5 -5
- data/test/core_test_app/app/components/component_with_actions.rb +3 -2
- data/test/core_test_app/app/components/component_with_custom_css.rb +1 -1
- data/test/core_test_app/app/components/component_with_js_mixin.rb +2 -1
- data/test/core_test_app/app/components/component_with_session_persistence.rb +2 -1
- data/test/core_test_app/app/components/extended_server_caller.rb +2 -1
- data/test/core_test_app/app/components/hello_world_component.rb +1 -1
- data/test/core_test_app/app/components/server_caller.rb +3 -1
- data/test/core_test_app/features/persistence.feature +1 -0
- metadata +6 -6
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
= v0.7.4 - 2011-10-20
|
2
|
+
* enhancements
|
3
|
+
* Less aggressive rescuing at constantizing a string, to let more descriptive exceptions get through.
|
4
|
+
* New +delegates_to_dsl+ class method to degelate default config options to class level. See the +ConfigToDslDelegator+ module.
|
5
|
+
|
1
6
|
= v0.7.3 - 2011-09-04
|
2
7
|
* Rails 3.1 compatibility. Really. Hopefully.
|
3
8
|
|
@@ -49,7 +54,7 @@
|
|
49
54
|
= v0.6.7 - 2011-08-16
|
50
55
|
* enhancements
|
51
56
|
* No more using +method_missing+ for invoking endpoints.
|
52
|
-
* New "cache" option for
|
57
|
+
* New "cache" option for +netzke_init+ which gets passed to +javascript_include_tag+ (no support for css caching of this type yet)
|
53
58
|
* 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.
|
54
59
|
* Moved features and specs to test/core_test_app (tests should be run from that folder from now on)
|
55
60
|
* Introduced plugin functionality. We can create Netzke components that are pluggable into other components as Ext JS plugins.
|
@@ -59,7 +64,7 @@
|
|
59
64
|
* Client-server communication is updated to use Ext.Direct (many thanks to @pschyska)
|
60
65
|
* Introduced +js_translate+ class method that allows specifying i18n properties used in the JavaScript class
|
61
66
|
* Better handling of actions i18n
|
62
|
-
* New
|
67
|
+
* 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`.
|
63
68
|
|
64
69
|
= v0.6.5 - 2011-01-14
|
65
70
|
* enhancements
|
data/{TODO → TODO.md}
RENAMED
@@ -1,14 +1,27 @@
|
|
1
|
-
|
1
|
+
# ToDo
|
2
2
|
Make it possible to pass a constant (not a string) to the `class_name` option
|
3
|
+
|
3
4
|
Make :lazy_loading "true" by default when defining a child component
|
5
|
+
|
4
6
|
Make :items option also accept a hash.
|
7
|
+
|
5
8
|
Caching for netzke_controller-provided JS and CSS.
|
9
|
+
|
6
10
|
Caching - investigate reusing (fragment?) caching of Rails.
|
7
11
|
|
8
12
|
|
9
|
-
|
13
|
+
## Roadmap
|
14
|
+
|
15
|
+
### 0.8
|
10
16
|
|
11
|
-
|
17
|
+
Get rid of Symbol#action and Symbol#component
|
18
|
+
|
19
|
+
Get rid of String#l
|
20
|
+
|
21
|
+
|
22
|
+
## Ideas that didn't work out
|
23
|
+
|
24
|
+
### Making value from super-class accessible in the block parameters in endpoints
|
12
25
|
|
13
26
|
endpoint :call_server do |params, orig|
|
14
27
|
orig.merge(:set_title => orig[:set_title] + " extended")
|
@@ -19,4 +32,4 @@ So, to override an endpoint, simply define a method with endpoint's name, e.g.:
|
|
19
32
|
|
20
33
|
def call_server(params)
|
21
34
|
super.merge(...)
|
22
|
-
end
|
35
|
+
end
|
data/lib/netzke/base.rb
CHANGED
@@ -12,6 +12,7 @@ require 'netzke/state'
|
|
12
12
|
require 'netzke/embedding'
|
13
13
|
require 'netzke/actions'
|
14
14
|
require 'netzke/session'
|
15
|
+
require 'netzke/config_to_dsl_delegator'
|
15
16
|
|
16
17
|
module Netzke
|
17
18
|
# The base for every Netzke component
|
@@ -41,6 +42,9 @@ module Netzke
|
|
41
42
|
include Stylesheets
|
42
43
|
include Embedding
|
43
44
|
include Actions
|
45
|
+
include ConfigToDslDelegator
|
46
|
+
|
47
|
+
delegates_to_dsl :title, :items
|
44
48
|
|
45
49
|
class_config_option :default_instance_config, {}
|
46
50
|
|
@@ -67,11 +71,7 @@ module Netzke
|
|
67
71
|
def constantize_class_name(class_name)
|
68
72
|
"#{class_name}".constantize
|
69
73
|
rescue NameError
|
70
|
-
|
71
|
-
"Netzke::#{class_name}".constantize
|
72
|
-
rescue NameError
|
73
|
-
nil
|
74
|
-
end
|
74
|
+
"Netzke::#{class_name}".constantize
|
75
75
|
end
|
76
76
|
|
77
77
|
# Instance of component by config
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Netzke
|
2
|
+
# This module allows delegating the configuration options for a component into the level of the component's class.
|
3
|
+
# As an example, let's take the :title option understood by any Ext.panel.Panel-derived component. Netzke::Base calls:
|
4
|
+
#
|
5
|
+
# delegates_to_dsl :title
|
6
|
+
#
|
7
|
+
# which provides any child class with a DSL method `title` which can be used like this:
|
8
|
+
#
|
9
|
+
# class MyComponent < Netzke::Base
|
10
|
+
# title "My cool component"
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# This will provide for :title => "My cool component" being a default option for MyComponent's instances.
|
14
|
+
#
|
15
|
+
# This is very handy when a frequently-inherited class implements some common option. Another example would be the :model option in Basepack::Grid/FormPanel. This way the child class will not need to mess up with the `default_config` method if all it needs is specify that default option.
|
16
|
+
module ConfigToDslDelegator
|
17
|
+
extend ActiveSupport::Concern
|
18
|
+
|
19
|
+
module ClassMethods
|
20
|
+
# Delegates specified configuration options to the class level. See ConfigToDslDelegator.
|
21
|
+
def delegates_to_dsl(*option_names)
|
22
|
+
delegated_options = read_inheritable_attribute(:delegated_options) || []
|
23
|
+
delegated_options += option_names
|
24
|
+
write_inheritable_attribute(:delegated_options, delegated_options)
|
25
|
+
end
|
26
|
+
|
27
|
+
def inherited(inherited_class) # :nodoc:
|
28
|
+
super
|
29
|
+
|
30
|
+
properties = read_inheritable_attribute(:delegated_options) || []
|
31
|
+
properties.size.times do |i|
|
32
|
+
inherited_class.class.send(:define_method, properties[i], lambda { |value|
|
33
|
+
default_config = read_inheritable_attribute(:default_config) || {}
|
34
|
+
default_config.merge!(properties[i].to_sym => value)
|
35
|
+
write_inheritable_attribute(:default_config, default_config)
|
36
|
+
})
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/netzke/configuration.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
module Netzke
|
2
|
+
# Handles all the intricate matters of component configuration.
|
3
|
+
# TODO: simplify!
|
2
4
|
module Configuration
|
3
5
|
extend ActiveSupport::Concern
|
4
6
|
|
@@ -91,7 +93,7 @@ module Netzke
|
|
91
93
|
module InstanceMethods
|
92
94
|
# Default config - before applying any passed configuration
|
93
95
|
def default_config
|
94
|
-
@default_config ||= {}.merge(weak_default_options).merge(self.class.default_instance_config)
|
96
|
+
@default_config ||= {}.merge(weak_default_options).merge(self.class.default_instance_config).merge(self.class.read_inheritable_attribute(:default_config) || {})
|
95
97
|
end
|
96
98
|
|
97
99
|
# Static, hardcoded config. Consists of default values merged with config that was passed during instantiation
|
data/lib/netzke/core/version.rb
CHANGED
data/netzke-core.gemspec
CHANGED
@@ -5,17 +5,16 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{netzke-core}
|
8
|
-
s.version = "0.7.
|
8
|
+
s.version = "0.7.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{NomadCoder}]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-10-20}
|
13
13
|
s.description = %q{Allows building DRY ExtJS/Rails applications by enabling modular development}
|
14
14
|
s.email = %q{nmcoder@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
"README.md"
|
18
|
-
"TODO"
|
17
|
+
"README.md"
|
19
18
|
]
|
20
19
|
s.files = [
|
21
20
|
".autotest",
|
@@ -24,7 +23,7 @@ Gem::Specification.new do |s|
|
|
24
23
|
"Manifest",
|
25
24
|
"README.md",
|
26
25
|
"Rakefile",
|
27
|
-
"TODO",
|
26
|
+
"TODO.md",
|
28
27
|
"app/controllers/netzke_controller.rb",
|
29
28
|
"init.rb",
|
30
29
|
"install.rb",
|
@@ -36,6 +35,7 @@ Gem::Specification.new do |s|
|
|
36
35
|
"lib/netzke/actions.rb",
|
37
36
|
"lib/netzke/base.rb",
|
38
37
|
"lib/netzke/composition.rb",
|
38
|
+
"lib/netzke/config_to_dsl_delegator.rb",
|
39
39
|
"lib/netzke/configuration.rb",
|
40
40
|
"lib/netzke/core.rb",
|
41
41
|
"lib/netzke/core/dynamic_assets.rb",
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class ComponentWithActions < Netzke::Base
|
2
|
+
title "Panel that has actions"
|
3
|
+
|
2
4
|
# Define actions as a hash
|
3
5
|
action :another_action, :disabled => true, :text => "Disabled action", :icon => :accept
|
4
6
|
|
@@ -12,7 +14,6 @@ class ComponentWithActions < Netzke::Base
|
|
12
14
|
{:text => "Not used"}
|
13
15
|
end
|
14
16
|
|
15
|
-
js_property :title, "Panel that has actions"
|
16
17
|
|
17
18
|
js_property :bbar, [:some_action.action, :another_action.action]
|
18
19
|
|
@@ -55,4 +56,4 @@ class ComponentWithActions < Netzke::Base
|
|
55
56
|
}
|
56
57
|
JS
|
57
58
|
|
58
|
-
end
|
59
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class ComponentWithJsMixin < Netzke::Base
|
2
|
-
|
2
|
+
title "ComponentWithJsMixin"
|
3
|
+
|
3
4
|
js_include :extra_one, :extra_two
|
4
5
|
js_mixin :method_set_one, :method_set_two
|
5
6
|
js_mixin # with no parameters, it'll assume :component_with_js_mixin
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class ExtendedServerCaller < ServerCaller
|
2
|
-
|
2
|
+
title "Extended Server Caller"
|
3
3
|
|
4
4
|
js_method :on_bug_server, <<-JS
|
5
5
|
function(){
|
@@ -9,6 +9,7 @@ class ExtendedServerCaller < ServerCaller
|
|
9
9
|
}
|
10
10
|
JS
|
11
11
|
|
12
|
+
# Overriding the :whats_up endpoint from ServerCaller
|
12
13
|
def whats_up_endpoint(params)
|
13
14
|
super.tap do |s|
|
14
15
|
s[:set_title] = s[:set_title] + ", shiny weather"
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class ServerCaller < Netzke::Base
|
2
|
+
title "Server Caller!"
|
3
|
+
|
2
4
|
action :bug_server # Actual action's text is set in en.yml
|
3
5
|
|
4
6
|
js_properties(
|
@@ -18,4 +20,4 @@ class ServerCaller < Netzke::Base
|
|
18
20
|
{:set_title => "All quiet here on the server"}
|
19
21
|
end
|
20
22
|
|
21
|
-
end
|
23
|
+
end
|
@@ -12,6 +12,7 @@ Feature: Persistence
|
|
12
12
|
And I should not see "HTML from session"
|
13
13
|
|
14
14
|
When I press "Tell server to store new title"
|
15
|
+
And I wait for response from server
|
15
16
|
And I go to the ComponentWithSessionPersistence test page
|
16
17
|
Then I should see "Title From Session"
|
17
18
|
And I should see "HTML from session"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netzke-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-20 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &70252618149160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70252618149160
|
25
25
|
description: Allows building DRY ExtJS/Rails applications by enabling modular development
|
26
26
|
email: nmcoder@gmail.com
|
27
27
|
executables: []
|
@@ -29,7 +29,6 @@ extensions: []
|
|
29
29
|
extra_rdoc_files:
|
30
30
|
- LICENSE
|
31
31
|
- README.md
|
32
|
-
- TODO
|
33
32
|
files:
|
34
33
|
- .autotest
|
35
34
|
- CHANGELOG.rdoc
|
@@ -37,7 +36,7 @@ files:
|
|
37
36
|
- Manifest
|
38
37
|
- README.md
|
39
38
|
- Rakefile
|
40
|
-
- TODO
|
39
|
+
- TODO.md
|
41
40
|
- app/controllers/netzke_controller.rb
|
42
41
|
- init.rb
|
43
42
|
- install.rb
|
@@ -49,6 +48,7 @@ files:
|
|
49
48
|
- lib/netzke/actions.rb
|
50
49
|
- lib/netzke/base.rb
|
51
50
|
- lib/netzke/composition.rb
|
51
|
+
- lib/netzke/config_to_dsl_delegator.rb
|
52
52
|
- lib/netzke/configuration.rb
|
53
53
|
- lib/netzke/core.rb
|
54
54
|
- lib/netzke/core/dynamic_assets.rb
|