netzke-core 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +9 -6
- data/README.rdoc +14 -15
- data/Rakefile +20 -15
- data/TODO +1 -1
- data/app/controllers/netzke_controller.rb +9 -9
- data/app/models/netzke_preference.rb +27 -27
- data/features/actions.feature +1 -1
- data/features/basic.feature +1 -1
- data/features/client-server.feature +1 -1
- data/features/component_loader.feature +6 -7
- data/features/composition.feature +5 -6
- data/features/custom_css.feature +1 -1
- data/features/inheritance.feature +0 -1
- data/features/persistence.feature +3 -3
- data/features/scopes.feature +3 -3
- data/features/step_definitions/web_steps.rb +5 -5
- data/features/support/env.rb +6 -6
- data/generators/netzke_core/netzke_core_generator.rb +2 -2
- data/javascripts/core.js +43 -43
- data/lib/generators/migration_helper.rb +6 -6
- data/lib/generators/netzke/USAGE +2 -3
- data/lib/generators/netzke/core_generator.rb +7 -7
- data/lib/netzke/actions.rb +18 -18
- data/lib/netzke/base.rb +72 -85
- data/lib/netzke/composition.rb +30 -30
- data/lib/netzke/configuration.rb +15 -15
- data/lib/netzke/core/masquerading.rb +3 -3
- data/lib/netzke/core/session.rb +1 -1
- data/lib/netzke/core/version.rb +1 -1
- data/lib/netzke/core.rb +9 -9
- data/lib/netzke/core_ext/array.rb +5 -5
- data/lib/netzke/core_ext/hash.rb +7 -7
- data/lib/netzke/core_ext/string.rb +4 -4
- data/lib/netzke/core_ext/symbol.rb +3 -3
- data/lib/netzke/embedding.rb +2 -2
- data/lib/netzke/ext_component.rb +4 -4
- data/lib/netzke/javascript.rb +36 -25
- data/lib/netzke/persistence.rb +16 -16
- data/lib/netzke/rails/action_view_ext.rb +20 -20
- data/lib/netzke/rails/controller_extensions.rb +1 -1
- data/lib/netzke/rails/routes.rb +1 -1
- data/lib/netzke/services.rb +12 -12
- data/lib/netzke/session.rb +4 -4
- data/lib/netzke/stylesheets.rb +8 -8
- data/lib/netzke-core.rb +2 -2
- data/netzke-core.gemspec +4 -5
- data/spec/component/actions_spec.rb +18 -18
- data/spec/component/base_spec.rb +6 -6
- data/spec/component/composition_spec.rb +12 -12
- data/spec/component/javascript_spec.rb +2 -2
- data/spec/core_ext_spec.rb +3 -3
- data/templates/core/create_netzke_preferences.rb +1 -1
- data/test/rails_app/app/components/component_loader.rb +8 -8
- data/test/rails_app/app/components/component_with_actions.rb +9 -9
- data/test/rails_app/app/components/component_with_custom_css.rb +2 -2
- data/test/rails_app/app/components/component_with_included_js.rb +5 -5
- data/test/rails_app/app/components/component_with_session_persistence.rb +3 -3
- data/test/rails_app/app/components/deprecated/server_caller.rb +2 -2
- data/test/rails_app/app/components/extended_component_with_actions.rb +1 -1
- data/test/rails_app/app/components/extended_server_caller.rb +3 -3
- data/test/rails_app/app/components/kinda_complex_component/basic_stuff.rb +8 -8
- data/test/rails_app/app/components/kinda_complex_component/extra_stuff.rb +2 -2
- data/test/rails_app/app/components/loader_of_component_with_custom_css.rb +2 -2
- data/test/rails_app/app/components/server_caller.rb +3 -3
- data/test/rails_app/app/components/simple_component.rb +1 -1
- data/test/rails_app/app/components/simple_tab_panel.rb +2 -2
- data/test/rails_app/app/components/some_composite.rb +16 -16
- data/test/rails_app/config/routes.rb +2 -2
- data/test/test_helper.rb +1 -1
- data/test/unit/core_ext_test.rb +13 -13
- data/test/unit/netzke_core_test.rb +20 -20
- data/test/unit/netzke_preference_test.rb +12 -12
- metadata +6 -6
data/CHANGELOG.rdoc
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
= v0.6.
|
1
|
+
= v0.6.3 - EDGE
|
2
|
+
* The +ext_config+ option is back, deprecated.
|
3
|
+
|
4
|
+
= v0.6.2 - 2010-10-27
|
2
5
|
* Introduced the Symbol#component method to declare components in the config (instead of now deprecated js_component).
|
3
6
|
|
4
7
|
= v0.6.1 - 2010-10-26
|
@@ -11,9 +14,9 @@
|
|
11
14
|
* API backward incompatibility
|
12
15
|
* +ext_config+ config level is removed; put all that configuration in the top level
|
13
16
|
* mentioning actions in the +bbar+, +tbar+, etc, should be explicit, e.g.:
|
14
|
-
|
17
|
+
|
15
18
|
:bbar => [:apply.action, :delete.action]
|
16
|
-
|
19
|
+
|
17
20
|
* +late_aggregatee+ is now +lazy_loading+
|
18
21
|
* +aggregatees+ are now +components+
|
19
22
|
* +widgets+ are now +components+, too
|
@@ -30,9 +33,9 @@
|
|
30
33
|
* +js_method+ DSL method to define (public) methods in JS class
|
31
34
|
* +js_property+ DSL method to define (public) properties in JS class
|
32
35
|
* +endpoint+ DSL method to define server endpoints
|
33
|
-
|
36
|
+
|
34
37
|
* Different deprecations throughout the code
|
35
|
-
|
38
|
+
|
36
39
|
= v0.5.3 - 2010-06-14
|
37
40
|
* Fix: Getting rid of deprecation warnings about tasks not sitting in lib.
|
38
41
|
|
@@ -206,7 +209,7 @@
|
|
206
209
|
= v0.1.0.2
|
207
210
|
* Meta: fix outdated Manifest
|
208
211
|
|
209
|
-
= v0.1.0.1
|
212
|
+
= v0.1.0.1
|
210
213
|
* Meta work: replacing underscore with dash in the name
|
211
214
|
|
212
215
|
= v0.1.0 - 2008-12-11
|
data/README.rdoc
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Create Ext JS + Rails components with minimum effort.
|
4
4
|
|
5
|
-
This is the bare bones of the Netzke framework. Use it to build your own components from scratch. For pre-built components (like panels, grids, forms, trees, applications), see the
|
5
|
+
This is the bare bones of the Netzke framework. Use it to build your own components from scratch. For pre-built components (like panels, grids, forms, trees, applications), see the http://github.com/skozlov/netzke-basepack.
|
6
6
|
|
7
7
|
The idea behind the Netzke framework is that it allows you write reusable client/server code. Create a component, and then embed it straight to your Rails' view, load it dynamically into your Ext-based applications, or use it as a building block for other (composite) components. For more info, see the links below.
|
8
8
|
|
9
9
|
== Requirements
|
10
10
|
|
11
|
+
* Ruby >= 1.9.2 (1.8.7 may work, too)
|
11
12
|
* Rails >= 3.0.0
|
12
|
-
* Ruby >= 1.9.2 (1.8.7 should work, but may not be supported as diligently)
|
13
13
|
* Ext >= 3.3.0
|
14
14
|
|
15
15
|
== Installation
|
@@ -18,16 +18,14 @@ For the latest ("edge") stuff, tell bundler to get the gem straight from github:
|
|
18
18
|
|
19
19
|
gem 'netzke-core', :git => "git://github.com/skozlov/netzke-core.git"
|
20
20
|
|
21
|
-
Or install as plugin:
|
22
|
-
|
23
|
-
rails plugin install git://github.com/skozlov/netzke-core.git
|
24
|
-
|
25
21
|
Netzke assumes that your ExtJS library is in public/extjs (which may be a symbolic link):
|
26
22
|
|
27
23
|
ln -s ~/code/sencha/ext-3.3.0 public/extjs
|
28
24
|
|
29
25
|
== Usage
|
30
26
|
|
27
|
+
=== Creating a simple component
|
28
|
+
|
31
29
|
Let's create a simple "Hello world!" component and embed it into a Rails' view. It'll be an Ext.Panel-based component with a button that triggers a client-server communication.
|
32
30
|
|
33
31
|
Create YOUR_APP/app/components/hello_world_component.rb, and put in the following content:
|
@@ -38,10 +36,10 @@ Create YOUR_APP/app/components/hello_world_component.rb, and put in the followin
|
|
38
36
|
|
39
37
|
# Bottom bar with an automatically created action
|
40
38
|
js_property :bbar, [:bug_server.action]
|
41
|
-
|
39
|
+
|
42
40
|
# Action to be placed on the bottom bar
|
43
41
|
action :bug_server, :text => 'Ask server', :icon => :accept
|
44
|
-
|
42
|
+
|
45
43
|
# Method in the JS class that (by default) processes the action's "click" event
|
46
44
|
js_method :on_bug_server, <<-JS
|
47
45
|
function(){
|
@@ -64,10 +62,11 @@ Create YOUR_APP/app/components/hello_world_component.rb, and put in the followin
|
|
64
62
|
JS
|
65
63
|
end
|
66
64
|
|
65
|
+
=== Embedding components into Rails views
|
67
66
|
|
68
67
|
To embed a Netzke component into your Rails view do the following:
|
69
68
|
|
70
|
-
|
69
|
+
* Add <tt>netzke</tt> routes:
|
71
70
|
|
72
71
|
# in routes.rb
|
73
72
|
RailsApp::Application.routes.draw do
|
@@ -75,15 +74,15 @@ To embed a Netzke component into your Rails view do the following:
|
|
75
74
|
...
|
76
75
|
end
|
77
76
|
|
78
|
-
|
77
|
+
* In your layout, within the "head" tag, use the <tt>netzke_init</tt> helper to include all the necessary JavaScript and styles.
|
79
78
|
|
80
79
|
<%= netzke_init %>
|
81
80
|
|
82
81
|
# You can optionally specify an Ext theme:
|
83
82
|
|
84
83
|
<%= netzke_init :ext_theme => 'grey' %>
|
85
|
-
|
86
|
-
|
84
|
+
|
85
|
+
* In your view use the <tt>netzke</tt> helper to embed the component:
|
87
86
|
|
88
87
|
<%= netzke :hello_world_component %>
|
89
88
|
|
@@ -98,11 +97,11 @@ netzke-core is bundled with cucumber and RSpec tests. Before you can run them, y
|
|
98
97
|
For cucumber tests:
|
99
98
|
|
100
99
|
cucumber features
|
101
|
-
|
100
|
+
|
102
101
|
RSpec tests:
|
103
102
|
|
104
103
|
rspec spec
|
105
|
-
|
104
|
+
|
106
105
|
== Testing playground
|
107
106
|
|
108
107
|
The bundled test/rails_app application is also a convenient playground to learn more about the framework, as it may be run as a stand-alone Rails app. It's also a pretty good source of examples. After starting it, access any of the app/components/netzke test components by using the following url:
|
@@ -110,7 +109,7 @@ The bundled test/rails_app application is also a convenient playground to learn
|
|
110
109
|
http://localhost:3000/components/<name of the component's class>
|
111
110
|
|
112
111
|
e.g.:
|
113
|
-
|
112
|
+
|
114
113
|
http://localhost:3000/components/ServerCaller
|
115
114
|
|
116
115
|
or, for scoped components:
|
data/Rakefile
CHANGED
@@ -7,8 +7,7 @@ begin
|
|
7
7
|
gemspec.summary = "Build ExtJS/Rails components with minimum effort"
|
8
8
|
gemspec.description = "Allows building ExtJS/Rails reusable code in a DRY way"
|
9
9
|
gemspec.email = "sergei@playcode.nl"
|
10
|
-
gemspec.homepage = "http://
|
11
|
-
gemspec.rubyforge_project = "netzke-core"
|
10
|
+
gemspec.homepage = "http://netzke.org"
|
12
11
|
gemspec.authors = ["Sergei Kozlov"]
|
13
12
|
gemspec.add_dependency("activesupport", ">=3.0.1")
|
14
13
|
gemspec.post_install_message = <<-MESSAGE
|
@@ -16,7 +15,7 @@ begin
|
|
16
15
|
========================================================================
|
17
16
|
|
18
17
|
Thanks for installing Netzke Core!
|
19
|
-
|
18
|
+
|
20
19
|
Netzke home page: http://netzke.org
|
21
20
|
Netzke Google Groups: http://groups.google.com/group/netzke
|
22
21
|
Netzke tutorials: http://blog.writelesscode.com
|
@@ -24,30 +23,36 @@ begin
|
|
24
23
|
========================================================================
|
25
24
|
|
26
25
|
MESSAGE
|
27
|
-
|
26
|
+
|
28
27
|
end
|
29
28
|
Jeweler::GemcutterTasks.new
|
30
29
|
rescue LoadError
|
31
30
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
32
31
|
end
|
33
32
|
|
33
|
+
|
34
|
+
require 'rake/testtask'
|
35
|
+
Rake::TestTask.new(:test) do |test|
|
36
|
+
test.libs << 'lib' << 'test'
|
37
|
+
test.pattern = 'test/**/*_test.rb'
|
38
|
+
test.verbose = true
|
39
|
+
end
|
40
|
+
|
34
41
|
require 'rake/rdoctask'
|
35
42
|
Rake::RDocTask.new do |rdoc|
|
36
|
-
|
37
|
-
|
38
|
-
else
|
39
|
-
version = ""
|
40
|
-
end
|
43
|
+
require './lib/netzke/core/version'
|
44
|
+
version = Netzke::Core::Version::STRING
|
41
45
|
|
42
46
|
rdoc.rdoc_dir = 'rdoc'
|
43
47
|
rdoc.title = "netzke-core #{version}"
|
44
48
|
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('CHANGELOG*')
|
45
50
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
51
|
end
|
47
52
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
53
|
+
namespace :rdoc do
|
54
|
+
desc "Publish rdocs"
|
55
|
+
task :publish => :rdoc do
|
56
|
+
`scp -r rdoc/* fl:www/api.netzke.org/core`
|
57
|
+
end
|
58
|
+
end
|
data/TODO
CHANGED
@@ -15,7 +15,7 @@ Some day
|
|
15
15
|
endpoint :call_server do |params, orig|
|
16
16
|
orig.merge(:set_title => orig[:set_title] + " extended")
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
Bad idea because calling the super method is often required AFTER doing something in the override, not BEFORE. For example, deliver_component in GridPanel in Basepack is overridden to reconfigure the components on the fly before actually delivering the component (i.e. calling super).
|
20
20
|
So, to override an endpoint, simply define a method with endpoint's name, e.g.:
|
21
21
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class NetzkeController < ApplicationController
|
2
|
-
|
2
|
+
|
3
3
|
# Collect javascripts and stylesheets from all plugins that registered it in Netzke::Core.javascripts
|
4
4
|
# TODO: caching
|
5
5
|
# caches_action :netzke
|
@@ -11,7 +11,7 @@ class NetzkeController < ApplicationController
|
|
11
11
|
f = File.new(path)
|
12
12
|
res << f.read
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
# If JS classes are not inserted into the main page, we need to render all the classes needed to load the page that includes us
|
16
16
|
# (i.e. netzke/netzke.js) here
|
17
17
|
if !Netzke::Core.javascript_on_main_page
|
@@ -26,7 +26,7 @@ class NetzkeController < ApplicationController
|
|
26
26
|
|
27
27
|
render :text => defined?(::Rails) && ::Rails.env.production? ? res.strip_js_comments : res
|
28
28
|
}
|
29
|
-
|
29
|
+
|
30
30
|
format.css {
|
31
31
|
res = ""
|
32
32
|
Netzke::Core.stylesheets.each do |path|
|
@@ -37,15 +37,15 @@ class NetzkeController < ApplicationController
|
|
37
37
|
}
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
41
|
-
# Main dispatcher of the HTTP requests. The URL contains the name of the component,
|
42
|
-
# as well as the method of this component to be called, according to the double underscore notation.
|
40
|
+
|
41
|
+
# Main dispatcher of the HTTP requests. The URL contains the name of the component,
|
42
|
+
# as well as the method of this component to be called, according to the double underscore notation.
|
43
43
|
# E.g.: some_grid__post_grid_data.
|
44
44
|
def method_missing(method_name)
|
45
45
|
component_name, *action = method_name.to_s.split('__')
|
46
46
|
component_name = component_name.to_sym
|
47
47
|
action = !action.empty? && action.join("__").to_sym
|
48
|
-
|
48
|
+
|
49
49
|
if action
|
50
50
|
w_instance = Netzke::Base.instance_by_config(Netzke::Core.session[:netzke_components][component_name])
|
51
51
|
# only component's actions starting with "endpoint_" are accessible from outside (security)
|
@@ -55,7 +55,7 @@ class NetzkeController < ApplicationController
|
|
55
55
|
super
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
private
|
60
60
|
# Generates initial javascript code that is dependent on Rails environement
|
61
61
|
def initial_dynamic_javascript
|
@@ -66,5 +66,5 @@ class NetzkeController < ApplicationController
|
|
66
66
|
res << %{Netzke.RelativeExtUrl = '#{ActionController::Base.config.relative_url_root}/extjs';}
|
67
67
|
res.join("\n")
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
end
|
@@ -1,23 +1,23 @@
|
|
1
1
|
class NetzkePreference < ActiveRecord::Base
|
2
2
|
serialize :value
|
3
|
-
|
3
|
+
|
4
4
|
# belongs_to :user
|
5
5
|
# belongs_to :role
|
6
|
-
|
6
|
+
|
7
7
|
# ELEMENTARY_CONVERTION_METHODS= {'Fixnum' => 'to_i', 'String' => 'to_s', 'Float' => 'to_f', 'Symbol' => 'to_sym'}
|
8
|
-
|
8
|
+
|
9
9
|
# def self.component_name=(value)
|
10
10
|
# @@component_name = value
|
11
11
|
# end
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# def self.component_name
|
14
14
|
# @@component_name ||= nil
|
15
15
|
# end
|
16
|
-
|
16
|
+
|
17
17
|
# def normalized_value
|
18
18
|
# klass = read_attribute(:pref_type)
|
19
19
|
# norm_value = read_attribute(:value)
|
20
|
-
#
|
20
|
+
#
|
21
21
|
# case klass
|
22
22
|
# when nil then r = norm_value # do not cast
|
23
23
|
# when 'Boolean' then r = norm_value == 'false' ? false : (norm_value == 'true' || norm_value)
|
@@ -28,7 +28,7 @@ class NetzkePreference < ActiveRecord::Base
|
|
28
28
|
# end
|
29
29
|
# r
|
30
30
|
# end
|
31
|
-
#
|
31
|
+
#
|
32
32
|
# def normalized_value=(new_value)
|
33
33
|
# case new_value.class.name
|
34
34
|
# when "Array" then write_attribute(:value, new_value.to_json)
|
@@ -37,17 +37,17 @@ class NetzkePreference < ActiveRecord::Base
|
|
37
37
|
# end
|
38
38
|
# write_attribute(:pref_type, [TrueClass, FalseClass].include?(new_value.class) ? 'Boolean' : new_value.class.to_s)
|
39
39
|
# end
|
40
|
-
#
|
40
|
+
#
|
41
41
|
# def self.[](pref_name)
|
42
42
|
# pref_name = normalize_preference_name(pref_name)
|
43
43
|
# pref = self.pref_to_read(pref_name)
|
44
44
|
# pref && pref.normalized_value
|
45
45
|
# end
|
46
|
-
#
|
46
|
+
#
|
47
47
|
# def self.[]=(pref_name, new_value)
|
48
48
|
# pref_name = normalize_preference_name(pref_name)
|
49
49
|
# pref = self.pref_to_write(pref_name)
|
50
|
-
#
|
50
|
+
#
|
51
51
|
# # if assigning nil, simply delete the eventually found preference
|
52
52
|
# if new_value.nil?
|
53
53
|
# pref && pref.destroy
|
@@ -58,9 +58,9 @@ class NetzkePreference < ActiveRecord::Base
|
|
58
58
|
# end
|
59
59
|
# end
|
60
60
|
|
61
|
-
|
62
61
|
|
63
|
-
|
62
|
+
|
63
|
+
# Overwrite pref_to_read, pref_to_write methods, and find_all_for_component if you want a different way of
|
64
64
|
# identifying the proper preference based on your own authorization strategy.
|
65
65
|
#
|
66
66
|
# The default strategy is:
|
@@ -70,12 +70,12 @@ class NetzkePreference < ActiveRecord::Base
|
|
70
70
|
# 2) if masq_user or masq_role is defined
|
71
71
|
# pref_to_read and pref_to_write will always take the masquerade into account, e.g. reads/writes will go to
|
72
72
|
# the user/role specified
|
73
|
-
#
|
73
|
+
#
|
74
74
|
def self.pref_to_read(name)
|
75
75
|
name = name.to_s
|
76
76
|
session = Netzke::Core.session
|
77
77
|
cond = {:key => name}
|
78
|
-
|
78
|
+
|
79
79
|
if session[:masq_user]
|
80
80
|
# first, get the prefs for this user it they exist
|
81
81
|
res = self.where(cond.merge({:user_id => session[:masq_user]})).first
|
@@ -83,9 +83,9 @@ class NetzkePreference < ActiveRecord::Base
|
|
83
83
|
# if it doesn't exist, get them for the user's role
|
84
84
|
user = User.where(session[:masq_user])
|
85
85
|
res ||= self.where(cond.merge({:role_id => user.role.id})).first
|
86
|
-
|
86
|
+
|
87
87
|
# if it doesn't exist either, get them for the World (role_id = 0)
|
88
|
-
res ||= self.where(cond.merge({:role_id => 0})).first
|
88
|
+
res ||= self.where(cond.merge({:role_id => 0})).first
|
89
89
|
elsif session[:masq_role]
|
90
90
|
# first, get the prefs for this role
|
91
91
|
res = self.where(cond.merge({:role_id => session[:masq_role]})).first
|
@@ -102,15 +102,15 @@ class NetzkePreference < ActiveRecord::Base
|
|
102
102
|
else
|
103
103
|
res = self.where(cond).first
|
104
104
|
end
|
105
|
-
|
106
|
-
res
|
105
|
+
|
106
|
+
res
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
109
|
def self.pref_to_write(name)
|
110
110
|
name = name.to_s
|
111
111
|
session = Netzke::Core.session
|
112
112
|
cond = {:key => name}
|
113
|
-
|
113
|
+
|
114
114
|
if session[:masq_user]
|
115
115
|
cond.merge!({:user_id => session[:masq_user]})
|
116
116
|
# first, try to find the preference for masq_user
|
@@ -139,11 +139,11 @@ class NetzkePreference < ActiveRecord::Base
|
|
139
139
|
end
|
140
140
|
res
|
141
141
|
end
|
142
|
-
|
142
|
+
|
143
143
|
# def self.find_all_for_component(name)
|
144
144
|
# session = Netzke::Core.session
|
145
145
|
# cond = {:component_name => name}
|
146
|
-
#
|
146
|
+
#
|
147
147
|
# if session[:masq_user] || session[:masq_role]
|
148
148
|
# cond.merge!({:user_id => session[:masq_user], :role_id => session[:masq_role]})
|
149
149
|
# res = self.where(cond).all
|
@@ -154,17 +154,17 @@ class NetzkePreference < ActiveRecord::Base
|
|
154
154
|
# else
|
155
155
|
# res = self.where(cond).all
|
156
156
|
# end
|
157
|
-
#
|
158
|
-
# res
|
157
|
+
#
|
158
|
+
# res
|
159
159
|
# end
|
160
|
-
|
160
|
+
|
161
161
|
# def self.delete_all_for_component(name)
|
162
162
|
# self.destroy(find_all_for_component(name))
|
163
163
|
# end
|
164
|
-
#
|
164
|
+
#
|
165
165
|
# private
|
166
166
|
# def self.normalize_preference_name(name)
|
167
167
|
# name.to_s.gsub(".", "__").gsub("/", "__")
|
168
168
|
# end
|
169
|
-
|
169
|
+
|
170
170
|
end
|
data/features/actions.feature
CHANGED
@@ -8,6 +8,6 @@ Scenario: Pressing button should result in corresponding actions
|
|
8
8
|
When I go to the ComponentWithActions test page
|
9
9
|
Then I should see "Disabled action"
|
10
10
|
And button "Disabled action" should be disabled
|
11
|
-
|
11
|
+
|
12
12
|
When I press "Some action"
|
13
13
|
Then I should see "Some action was triggered"
|
data/features/basic.feature
CHANGED
@@ -7,7 +7,7 @@ Feature: Client/server communication
|
|
7
7
|
Scenario: Ask server to set our title
|
8
8
|
Given I am on the ServerCaller test page
|
9
9
|
Then I should see "Server Caller"
|
10
|
-
|
10
|
+
|
11
11
|
# When I execute "Ext.getCmp('server_caller').buttons.first().fireEvent('click');"
|
12
12
|
When I press "Call server"
|
13
13
|
Then I should see "All quiet here on the server"
|
@@ -9,23 +9,22 @@ Feature: Component loader
|
|
9
9
|
When I press "Load component"
|
10
10
|
Then I should see "Inner text"
|
11
11
|
And I should see "Simple Component"
|
12
|
-
|
12
|
+
|
13
13
|
When I press "Load in window"
|
14
14
|
Then I should see "Component loaded in window"
|
15
|
-
|
15
|
+
|
16
16
|
@selenium
|
17
17
|
Scenario: Component loader should invoke a callback
|
18
18
|
Given I am on the ComponentLoader test page
|
19
19
|
When I press "Load with feedback"
|
20
20
|
Then I should see "Callback invoked!"
|
21
|
-
|
22
|
-
|
21
|
+
|
22
|
+
|
23
23
|
@selenium
|
24
24
|
Scenario: Component loader should load a window component with another component in it
|
25
25
|
Given I am on the ComponentLoader test page
|
26
26
|
When I press "Load window with simple component"
|
27
27
|
Then I should see "Simple Component Inside Window"
|
28
28
|
And I should see "Inner text"
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
|
30
|
+
|
@@ -15,18 +15,17 @@ Feature: Composition
|
|
15
15
|
When I press "Call server" within "#some_composite__center_panel"
|
16
16
|
Then I should see "All quiet here on the server"
|
17
17
|
And I should not see "All quiet here on the server, shiny weather"
|
18
|
-
|
18
|
+
|
19
19
|
When I press "Call server" within "#some_composite__west_panel"
|
20
20
|
Then I should see "All quiet here on the server, shiny weather"
|
21
|
-
|
21
|
+
|
22
22
|
@javascript
|
23
23
|
Scenario: Server should be able to address (deeply) nested components
|
24
24
|
Given I am on the SomeComposite test page
|
25
25
|
When I press "Update west from server"
|
26
26
|
Then I should see "Here's an update for west panel"
|
27
|
-
|
27
|
+
|
28
28
|
When I press "Update east south from server"
|
29
29
|
Then I should see "Here's an update for south panel in east panel"
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
|
31
|
+
|
data/features/custom_css.feature
CHANGED
@@ -8,7 +8,7 @@ Feature: Custom css
|
|
8
8
|
When I go to the ComponentWithCustomCss test page
|
9
9
|
Then I should see "ComponentWithCustomCss"
|
10
10
|
But the body of ComponentWithCustomCss component should not be invisible
|
11
|
-
|
11
|
+
|
12
12
|
@javascript
|
13
13
|
Scenario: A dynamically loaded component with a hidden body should not display its body
|
14
14
|
When I go to the LoaderOfComponentWithCustomCss test page
|
data/features/scopes.feature
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
4
|
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
5
|
# files.
|
6
6
|
|
@@ -191,7 +191,7 @@ Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |
|
|
191
191
|
end
|
192
192
|
end
|
193
193
|
end
|
194
|
-
|
194
|
+
|
195
195
|
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
196
196
|
current_path = URI.parse(current_url).path
|
197
197
|
if current_path.respond_to? :should
|
@@ -205,8 +205,8 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
|
205
205
|
query = URI.parse(current_url).query
|
206
206
|
actual_params = query ? CGI.parse(query) : {}
|
207
207
|
expected_params = {}
|
208
|
-
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
209
|
-
|
208
|
+
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
209
|
+
|
210
210
|
if actual_params.respond_to? :should
|
211
211
|
actual_params.should == expected_params
|
212
212
|
else
|
data/features/support/env.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
4
|
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
5
|
# files.
|
6
6
|
|
@@ -27,7 +27,7 @@ require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links wi
|
|
27
27
|
# steps to use the XPath syntax.
|
28
28
|
Capybara.default_selector = :css
|
29
29
|
|
30
|
-
# If you set this to false, any error raised from within your app will bubble
|
30
|
+
# If you set this to false, any error raised from within your app will bubble
|
31
31
|
# up to your step definition and out to cucumber unless you catch it somewhere
|
32
32
|
# on the way. You can make Rails rescue errors and render error pages on a
|
33
33
|
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
|
@@ -39,15 +39,15 @@ Capybara.default_selector = :css
|
|
39
39
|
ActionController::Base.allow_rescue = false
|
40
40
|
|
41
41
|
# If you set this to true, each scenario will run in a database transaction.
|
42
|
-
# You can still turn off transactions on a per-scenario basis, simply tagging
|
42
|
+
# You can still turn off transactions on a per-scenario basis, simply tagging
|
43
43
|
# a feature or scenario with the @no-txn tag. If you are using Capybara,
|
44
44
|
# tagging with @culerity or @javascript will also turn transactions off.
|
45
45
|
#
|
46
46
|
# If you set this to false, transactions will be off for all scenarios,
|
47
47
|
# regardless of whether you use @no-txn or not.
|
48
48
|
#
|
49
|
-
# Beware that turning transactions off will leave data in your database
|
50
|
-
# after each scenario, which can lead to hard-to-debug failures in
|
49
|
+
# Beware that turning transactions off will leave data in your database
|
50
|
+
# after each scenario, which can lead to hard-to-debug failures in
|
51
51
|
# subsequent scenarios. If you do this, we recommend you create a Before
|
52
52
|
# block that will explicitly put your database in a known state.
|
53
53
|
Cucumber::Rails::World.use_transactional_fixtures = true
|
@@ -7,12 +7,12 @@ class NetzkeCoreGenerator < Rails::Generator::Base
|
|
7
7
|
}, :migration_file_name => "create_netzke_preferences"
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def self.gem_root
|
12
12
|
File.expand_path('../../../', __FILE__)
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.source_root
|
16
16
|
File.join(gem_root, 'templates', 'core')
|
17
|
-
end
|
17
|
+
end
|
18
18
|
end
|