netzke-core 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/lib/netzke/base.rb +23 -6
- data/netzke-core.gemspec +1 -1
- metadata +1 -1
data/CHANGELOG
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
+
v0.3.1
|
2
|
+
Fix: persistent_config_manager can now be set to nil, and it will work fine
|
3
|
+
|
1
4
|
v0.3.0
|
5
|
+
2009-05-07
|
2
6
|
Refactor: got rid of NetzkeLayout model, now all layouts are stored in netzke_preferences
|
3
7
|
New: persistent_config now has a method for_widget that accepts a block
|
4
8
|
autotest compatibility
|
data/lib/netzke/base.rb
CHANGED
@@ -89,12 +89,29 @@ module Netzke
|
|
89
89
|
|
90
90
|
# persistent_config and layout manager classes
|
91
91
|
def persistent_config_manager_class
|
92
|
-
Netzke::Base.config[:persistent_config_manager].constantize
|
92
|
+
Netzke::Base.config[:persistent_config_manager].try(:constantize)
|
93
93
|
rescue NameError
|
94
94
|
nil
|
95
95
|
end
|
96
96
|
|
97
|
-
|
97
|
+
# Return persistent config class
|
98
|
+
def persistent_config
|
99
|
+
# if the class is not present, fake it (it will not store anything, and always return nil)
|
100
|
+
if persistent_config_manager_class.nil?
|
101
|
+
fake_config = {}
|
102
|
+
class << fake_config
|
103
|
+
def for_widget(*params, &block)
|
104
|
+
yield({})
|
105
|
+
end
|
106
|
+
def widget_name=(*params)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
fake_config
|
110
|
+
else
|
111
|
+
persistent_config_manager_class
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
98
115
|
private
|
99
116
|
def set_default_config(default_config)
|
100
117
|
@@config ||= {}
|
@@ -167,10 +184,10 @@ module Netzke
|
|
167
184
|
# persistent_config["window.size"] => 100
|
168
185
|
# This method is user-aware
|
169
186
|
def persistent_config
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
187
|
+
if config[:persistent_config]
|
188
|
+
config_class = self.class.persistent_config
|
189
|
+
config_class.widget_name = id_name # pass to the config class our unique name
|
190
|
+
config_class
|
174
191
|
else
|
175
192
|
# if we can't use presistent config, all the calls to it will always return nil, and the "="-operation will be ignored
|
176
193
|
{}
|
data/netzke-core.gemspec
CHANGED