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
@@ -0,0 +1,132 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
require 'netzke-core'
|
3
|
+
|
4
|
+
module Netzke
|
5
|
+
describe Composition do
|
6
|
+
class SomeComponent < Base
|
7
|
+
endpoint :method_one
|
8
|
+
endpoint :method_two
|
9
|
+
|
10
|
+
def self.config
|
11
|
+
super.merge({
|
12
|
+
:pref_one => 1,
|
13
|
+
:pref_two => 2
|
14
|
+
})
|
15
|
+
end
|
16
|
+
|
17
|
+
def components
|
18
|
+
{
|
19
|
+
:nested_one => {:class_name => 'NestedComponentOne'},
|
20
|
+
:nested_two => {:class_name => 'NestedComponentTwo'}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def available_permissions
|
25
|
+
%w(read update)
|
26
|
+
end
|
27
|
+
|
28
|
+
def default_config
|
29
|
+
{
|
30
|
+
:config_uno => true,
|
31
|
+
:config_dos => false
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class NestedComponentOne < Base
|
37
|
+
end
|
38
|
+
|
39
|
+
class NestedComponentTwo < Base
|
40
|
+
def components
|
41
|
+
{
|
42
|
+
:nested => {:class_name => 'DeepNestedComponent'}
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class DeepNestedComponent < Base
|
48
|
+
def components
|
49
|
+
{
|
50
|
+
:nested => {:class_name => "VeryDeepNestedComponent"}
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class VeryDeepNestedComponent < Base
|
56
|
+
end
|
57
|
+
|
58
|
+
class ComponentOne < Base
|
59
|
+
end
|
60
|
+
|
61
|
+
class ComponentTwo < Base
|
62
|
+
end
|
63
|
+
|
64
|
+
class SomeComposite < Base
|
65
|
+
component :component_one do
|
66
|
+
{
|
67
|
+
:class_name => "ComponentOne",
|
68
|
+
:title => "My Cool Component"
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
def config
|
73
|
+
{
|
74
|
+
:items => [
|
75
|
+
{:class_name => "ComponentTwo", :name => "my_component_two"},
|
76
|
+
{:class_name => "ComponentTwo"} # name omitted, will be "component_two1"
|
77
|
+
]
|
78
|
+
}.deep_merge super
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should be possible to create (nested) component instances" do
|
83
|
+
component = SomeComponent.new(:name => 'some_component')
|
84
|
+
|
85
|
+
# instantiate components
|
86
|
+
nested_component_one = component.component_instance(:nested_one)
|
87
|
+
nested_component_two = component.component_instance(:nested_two)
|
88
|
+
deep_nested_component = component.component_instance(:nested_two__nested)
|
89
|
+
|
90
|
+
nested_component_one.class.should == NestedComponentOne
|
91
|
+
nested_component_two.class.should == NestedComponentTwo
|
92
|
+
deep_nested_component.class.should == DeepNestedComponent
|
93
|
+
|
94
|
+
component.global_id.should == 'some_component'
|
95
|
+
nested_component_one.global_id.should == 'some_component__nested_one'
|
96
|
+
nested_component_two.global_id.should == 'some_component__nested_two'
|
97
|
+
deep_nested_component.global_id.should == 'some_component__nested_two__nested'
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should be possible to define nested components in different ways" do
|
101
|
+
composite = SomeComposite.new
|
102
|
+
components = composite.components
|
103
|
+
|
104
|
+
components.keys.size.should == 3
|
105
|
+
components[:component_one][:class_name].should == "ComponentOne"
|
106
|
+
components[:my_component_two][:class_name].should == "ComponentTwo"
|
107
|
+
components[:component_two1][:class_name].should == "ComponentTwo"
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
# DIDN'T WORK OUT till now
|
112
|
+
# it "should be possible to override the superclass's declaration of a component" do
|
113
|
+
# composite = SomeComposite.new
|
114
|
+
# composite.components[:component_one][:title].should == "My Cool Component"
|
115
|
+
#
|
116
|
+
# class ExtendedComposite < SomeComposite
|
117
|
+
# component :component_one do |orig|
|
118
|
+
# orig.merge(:title => orig[:title] + ", extended")
|
119
|
+
# end
|
120
|
+
#
|
121
|
+
# component :component_two do
|
122
|
+
# {:title => "Another Nested Component"}
|
123
|
+
# end
|
124
|
+
# end
|
125
|
+
#
|
126
|
+
# extended_composite = ExtendedComposite.new
|
127
|
+
# extended_composite.components[:component_one][:title].should == "My Cool Component, extended"
|
128
|
+
# extended_composite.components[:component_one][:class_name].should == "ComponentOne"
|
129
|
+
# extended_composite.components[:component_two][:title].should == "Another Nested Component"
|
130
|
+
# end
|
131
|
+
end
|
132
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
require 'netzke-core'
|
3
|
+
|
4
|
+
module Netzke
|
5
|
+
describe Javascript do
|
6
|
+
class SomeComponent < Base
|
7
|
+
end
|
8
|
+
class InheritedComponent < SomeComponent
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "extends_netzke_component?" do
|
12
|
+
InheritedComponent.extends_netzke_component?.should == true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../lib/netzke/core_ext'
|
2
|
+
|
3
|
+
describe "Core extensions" do
|
4
|
+
it "should properly do deep_each_pair" do
|
5
|
+
res = {}
|
6
|
+
{
|
7
|
+
:one => 1,
|
8
|
+
:two => {:three => 3},
|
9
|
+
:nine => [
|
10
|
+
{:four => 4, :five => {:six => 6}},
|
11
|
+
{:seven => [{:eight => 8}]}
|
12
|
+
]
|
13
|
+
}.deep_each_pair{ |k,v| res[k] = v }
|
14
|
+
res.should == {:one => 1, :three => 3, :four => 4, :six => 6, :eight => 8}
|
15
|
+
end
|
16
|
+
end
|
data/spec/spec.opt
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../../test/rails_app/config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
|
6
|
+
# Each time recreate test database with migrations
|
7
|
+
db_file = File.dirname(__FILE__) + "/../test/rails_app/db/test.sqlite3"
|
8
|
+
File.delete(db_file) if File.exists?(db_file)
|
9
|
+
ActiveRecord::Migrator.migrate(File.dirname(__FILE__) + "/../test/rails_app/db/migrate")
|
10
|
+
|
11
|
+
# Load the factories for this plugin:
|
12
|
+
# require File.dirname(__FILE__) + '/factories'
|
13
|
+
|
14
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
15
|
+
# in spec/support/ and its subdirectories.
|
16
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
# == Mock Framework
|
20
|
+
#
|
21
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
22
|
+
#
|
23
|
+
# config.mock_with :mocha
|
24
|
+
# config.mock_with :flexmock
|
25
|
+
# config.mock_with :rr
|
26
|
+
config.mock_with :rspec
|
27
|
+
|
28
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
29
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
30
|
+
|
31
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
32
|
+
# examples within a transaction, remove the following line or assign false
|
33
|
+
# instead of true.
|
34
|
+
config.use_transactional_fixtures = true
|
35
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateNetzkePreferences < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
+
drop_table(:netzke_preferences) if table_exists?(:netzke_preferences)
|
4
|
+
|
3
5
|
create_table :netzke_preferences do |t|
|
4
|
-
t.string
|
5
|
-
t.
|
6
|
-
t.string :value
|
6
|
+
t.string :key
|
7
|
+
t.text :value
|
7
8
|
t.integer :user_id
|
8
9
|
t.integer :role_id
|
9
|
-
t.string :widget_name
|
10
10
|
|
11
11
|
t.timestamps
|
12
12
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '3.0.0'
|
4
|
+
|
5
|
+
# Bundle edge Rails instead:
|
6
|
+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
7
|
+
|
8
|
+
gem 'sqlite3-ruby', :require => 'sqlite3'
|
9
|
+
|
10
|
+
# Use unicorn as the web server
|
11
|
+
# gem 'unicorn'
|
12
|
+
|
13
|
+
# Deploy with Capistrano
|
14
|
+
# gem 'capistrano'
|
15
|
+
|
16
|
+
# To use debugger
|
17
|
+
# gem 'ruby-debug'
|
18
|
+
|
19
|
+
# Bundle the extra gems:
|
20
|
+
# gem 'bj'
|
21
|
+
# gem 'nokogiri', '1.4.1'
|
22
|
+
# gem 'sqlite3-ruby', :require => 'sqlite3'
|
23
|
+
# gem 'aws-s3', :require => 'aws/s3'
|
24
|
+
|
25
|
+
# Bundle gems for the local environment. Make sure to
|
26
|
+
# put test-only gems in this group so their generators
|
27
|
+
# and rake tasks are available in development mode:
|
28
|
+
group :development, :test do
|
29
|
+
gem 'capybara'
|
30
|
+
gem 'database_cleaner'
|
31
|
+
gem 'cucumber-rails'
|
32
|
+
gem 'cucumber'
|
33
|
+
gem 'rspec-rails', "~>2.0.0"
|
34
|
+
gem 'spork'
|
35
|
+
gem 'launchy' # So you can do Then show me the page
|
36
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
abstract (1.0.0)
|
5
|
+
actionmailer (3.0.0)
|
6
|
+
actionpack (= 3.0.0)
|
7
|
+
mail (~> 2.2.5)
|
8
|
+
actionpack (3.0.0)
|
9
|
+
activemodel (= 3.0.0)
|
10
|
+
activesupport (= 3.0.0)
|
11
|
+
builder (~> 2.1.2)
|
12
|
+
erubis (~> 2.6.6)
|
13
|
+
i18n (~> 0.4.1)
|
14
|
+
rack (~> 1.2.1)
|
15
|
+
rack-mount (~> 0.6.12)
|
16
|
+
rack-test (~> 0.5.4)
|
17
|
+
tzinfo (~> 0.3.23)
|
18
|
+
activemodel (3.0.0)
|
19
|
+
activesupport (= 3.0.0)
|
20
|
+
builder (~> 2.1.2)
|
21
|
+
i18n (~> 0.4.1)
|
22
|
+
activerecord (3.0.0)
|
23
|
+
activemodel (= 3.0.0)
|
24
|
+
activesupport (= 3.0.0)
|
25
|
+
arel (~> 1.0.0)
|
26
|
+
tzinfo (~> 0.3.23)
|
27
|
+
activeresource (3.0.0)
|
28
|
+
activemodel (= 3.0.0)
|
29
|
+
activesupport (= 3.0.0)
|
30
|
+
activesupport (3.0.0)
|
31
|
+
arel (1.0.1)
|
32
|
+
activesupport (~> 3.0.0)
|
33
|
+
builder (2.1.2)
|
34
|
+
capybara (0.4.0)
|
35
|
+
celerity (>= 0.7.9)
|
36
|
+
culerity (>= 0.2.4)
|
37
|
+
mime-types (>= 1.16)
|
38
|
+
nokogiri (>= 1.3.3)
|
39
|
+
rack (>= 1.0.0)
|
40
|
+
rack-test (>= 0.5.4)
|
41
|
+
selenium-webdriver (>= 0.0.27)
|
42
|
+
xpath (~> 0.1.2)
|
43
|
+
celerity (0.8.2)
|
44
|
+
childprocess (0.1.3)
|
45
|
+
ffi (~> 0.6.3)
|
46
|
+
configuration (1.1.0)
|
47
|
+
cucumber (0.9.2)
|
48
|
+
builder (~> 2.1.2)
|
49
|
+
diff-lcs (~> 1.1.2)
|
50
|
+
gherkin (~> 2.2.5)
|
51
|
+
json (~> 1.4.6)
|
52
|
+
term-ansicolor (~> 1.0.5)
|
53
|
+
cucumber-rails (0.3.2)
|
54
|
+
cucumber (>= 0.8.0)
|
55
|
+
culerity (0.2.12)
|
56
|
+
database_cleaner (0.5.2)
|
57
|
+
diff-lcs (1.1.2)
|
58
|
+
erubis (2.6.6)
|
59
|
+
abstract (>= 1.0.0)
|
60
|
+
ffi (0.6.3)
|
61
|
+
rake (>= 0.8.7)
|
62
|
+
gherkin (2.2.9)
|
63
|
+
json (~> 1.4.6)
|
64
|
+
term-ansicolor (~> 1.0.5)
|
65
|
+
i18n (0.4.1)
|
66
|
+
json (1.4.6)
|
67
|
+
json_pure (1.4.6)
|
68
|
+
launchy (0.3.7)
|
69
|
+
configuration (>= 0.0.5)
|
70
|
+
rake (>= 0.8.1)
|
71
|
+
mail (2.2.7)
|
72
|
+
activesupport (>= 2.3.6)
|
73
|
+
mime-types
|
74
|
+
treetop (>= 1.4.5)
|
75
|
+
mime-types (1.16)
|
76
|
+
nokogiri (1.4.3.1)
|
77
|
+
polyglot (0.3.1)
|
78
|
+
rack (1.2.1)
|
79
|
+
rack-mount (0.6.13)
|
80
|
+
rack (>= 1.0.0)
|
81
|
+
rack-test (0.5.6)
|
82
|
+
rack (>= 1.0)
|
83
|
+
rails (3.0.0)
|
84
|
+
actionmailer (= 3.0.0)
|
85
|
+
actionpack (= 3.0.0)
|
86
|
+
activerecord (= 3.0.0)
|
87
|
+
activeresource (= 3.0.0)
|
88
|
+
activesupport (= 3.0.0)
|
89
|
+
bundler (~> 1.0.0)
|
90
|
+
railties (= 3.0.0)
|
91
|
+
railties (3.0.0)
|
92
|
+
actionpack (= 3.0.0)
|
93
|
+
activesupport (= 3.0.0)
|
94
|
+
rake (>= 0.8.4)
|
95
|
+
thor (~> 0.14.0)
|
96
|
+
rake (0.8.7)
|
97
|
+
rspec (2.0.1)
|
98
|
+
rspec-core (~> 2.0.1)
|
99
|
+
rspec-expectations (~> 2.0.1)
|
100
|
+
rspec-mocks (~> 2.0.1)
|
101
|
+
rspec-core (2.0.1)
|
102
|
+
rspec-expectations (2.0.1)
|
103
|
+
diff-lcs (>= 1.1.2)
|
104
|
+
rspec-mocks (2.0.1)
|
105
|
+
rspec-core (~> 2.0.1)
|
106
|
+
rspec-expectations (~> 2.0.1)
|
107
|
+
rspec-rails (2.0.1)
|
108
|
+
rspec (~> 2.0.0)
|
109
|
+
rubyzip (0.9.4)
|
110
|
+
selenium-webdriver (0.0.29)
|
111
|
+
childprocess (>= 0.0.7)
|
112
|
+
ffi (~> 0.6.3)
|
113
|
+
json_pure
|
114
|
+
rubyzip
|
115
|
+
spork (0.8.4)
|
116
|
+
sqlite3-ruby (1.3.1)
|
117
|
+
term-ansicolor (1.0.5)
|
118
|
+
thor (0.14.3)
|
119
|
+
treetop (1.4.8)
|
120
|
+
polyglot (>= 0.3.1)
|
121
|
+
tzinfo (0.3.23)
|
122
|
+
xpath (0.1.2)
|
123
|
+
nokogiri (~> 1.3)
|
124
|
+
|
125
|
+
PLATFORMS
|
126
|
+
ruby
|
127
|
+
|
128
|
+
DEPENDENCIES
|
129
|
+
capybara
|
130
|
+
cucumber
|
131
|
+
cucumber-rails
|
132
|
+
database_cleaner
|
133
|
+
launchy
|
134
|
+
rails (= 3.0.0)
|
135
|
+
rspec-rails (~> 2.0.0)
|
136
|
+
spork
|
137
|
+
sqlite3-ruby
|
@@ -0,0 +1,15 @@
|
|
1
|
+
== Netzke-core testing application
|
2
|
+
|
3
|
+
This application is used as a helper app by the Cucumber and RSpec tests run from the root of the plugin, but can also be run stand-alone (don't forget to link extjs into public, and run the migrations).
|
4
|
+
|
5
|
+
After you start the server, you can access any component from lib/netzke using the following URL schema:
|
6
|
+
|
7
|
+
http://localhost:3000/components/<full_component_class_name>, e.g.:
|
8
|
+
|
9
|
+
http://localhost:3000/components/ServerCaller
|
10
|
+
|
11
|
+
or
|
12
|
+
|
13
|
+
http://localhost:3000/components/ScopedComponents::SomeScopedComponent
|
14
|
+
|
15
|
+
etc
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
require 'rake'
|
6
|
+
|
7
|
+
RailsApp::Application.load_tasks
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class ComponentLoader < Netzke::Base
|
2
|
+
component :simple_component, :title => "Simple Component", :lazy_loading => true
|
3
|
+
|
4
|
+
component :component_loaded_in_window, {
|
5
|
+
:class_name => "SimpleComponent",
|
6
|
+
:title => "Component loaded in window",
|
7
|
+
:lazy_loading => true
|
8
|
+
}
|
9
|
+
|
10
|
+
component :window_with_simple_component, {
|
11
|
+
:class_name => "SimpleWindow",
|
12
|
+
:items => [{
|
13
|
+
:class_name => "SimpleComponent",
|
14
|
+
:title => "Simple Component Inside Window"
|
15
|
+
}],
|
16
|
+
:lazy_loading => true
|
17
|
+
}
|
18
|
+
|
19
|
+
js_method :on_load_with_feedback, <<-JS
|
20
|
+
function(){
|
21
|
+
this.loadComponent({name: 'simple_component', callback: function(){
|
22
|
+
this.setTitle("Callback" + " invoked!");
|
23
|
+
}, scope: this});
|
24
|
+
}
|
25
|
+
JS
|
26
|
+
|
27
|
+
action :load_with_feedback
|
28
|
+
|
29
|
+
action :load_window_with_simple_component
|
30
|
+
|
31
|
+
js_properties(
|
32
|
+
:title => "Component Loader",
|
33
|
+
:layout => "fit",
|
34
|
+
:bbar => [{:text => "Load component", :ref => "../button"}, {:text => "Load in window", :ref => "../loadInWindowButton"}, :load_with_feedback.action, :load_window_with_simple_component.action]
|
35
|
+
)
|
36
|
+
|
37
|
+
js_method :on_load_window_with_simple_component, <<-JS
|
38
|
+
function(params){
|
39
|
+
this.loadComponent({name: "window_with_simple_component"});
|
40
|
+
}
|
41
|
+
JS
|
42
|
+
|
43
|
+
js_method :init_component, <<-JS
|
44
|
+
function(){
|
45
|
+
#{js_full_class_name}.superclass.initComponent.call(this);
|
46
|
+
|
47
|
+
this.button.on('click', function(){
|
48
|
+
this.loadComponent({name: 'simple_component', container: this.getId()});
|
49
|
+
}, this);
|
50
|
+
|
51
|
+
this.loadInWindowButton.on('click', function(){
|
52
|
+
var w = new Ext.Window({width: 500, height: 400, modal: true, layout:'fit'});
|
53
|
+
w.show(null, function(){
|
54
|
+
this.loadComponent({name: 'component_loaded_in_window', container: w.getId()});
|
55
|
+
}, this);
|
56
|
+
}, this);
|
57
|
+
}
|
58
|
+
JS
|
59
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class ComponentWithActions < Netzke::Base
|
2
|
+
# Define actions as a hash
|
3
|
+
action :another_action, :disabled => true, :text => "Disabled action", :icon => :accept
|
4
|
+
|
5
|
+
# ... or as a block returning hash
|
6
|
+
action :some_action do
|
7
|
+
{:text => "Some Cool Action", :icon => Netzke::Core.icons_uri + "/delete.png"}
|
8
|
+
end
|
9
|
+
|
10
|
+
# ... or directly as a method
|
11
|
+
def _my_action_action
|
12
|
+
{:text => "Not used"}
|
13
|
+
end
|
14
|
+
|
15
|
+
js_property :title, "Panel that has actions"
|
16
|
+
|
17
|
+
js_property :bbar, [:some_action.action, :another_action.action]
|
18
|
+
|
19
|
+
js_property :tbar, [{
|
20
|
+
:xtype => 'buttongroup',
|
21
|
+
:columns => 3,
|
22
|
+
:title => 'A group',
|
23
|
+
:items => [{
|
24
|
+
:text => 'Paste',
|
25
|
+
:scale => 'large',
|
26
|
+
:rowspan => 3, :iconCls => 'add',
|
27
|
+
:iconAlign => 'top',
|
28
|
+
:cls => 'x-btn-as-arrow'
|
29
|
+
},{
|
30
|
+
:xtype => 'splitbutton',
|
31
|
+
:text => 'Menu Button',
|
32
|
+
:scale => 'large',
|
33
|
+
:rowspan => 3,
|
34
|
+
:iconCls => 'add',
|
35
|
+
:iconAlign => 'top',
|
36
|
+
:arrowAlign => 'bottom',
|
37
|
+
:menu => [:some_action.action]
|
38
|
+
},{
|
39
|
+
:xtype => 'splitbutton', :text => 'Cut', :menu => [:another_action.action]
|
40
|
+
}, :another_action.action,
|
41
|
+
{
|
42
|
+
:menu => [:some_action.action], :text => 'Format'
|
43
|
+
}]
|
44
|
+
}]
|
45
|
+
|
46
|
+
js_method :on_some_action, <<-JS
|
47
|
+
function(){
|
48
|
+
this.update("Some action was triggered");
|
49
|
+
}
|
50
|
+
JS
|
51
|
+
|
52
|
+
js_method :on_another_action, <<-JS
|
53
|
+
function(){
|
54
|
+
this.update("Another action was triggered");
|
55
|
+
}
|
56
|
+
JS
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# This component has the header hidden by custom CSS
|
2
|
+
class ComponentWithCustomCss < Netzke::Base
|
3
|
+
js_property :title, "ComponentWithCustomCss"
|
4
|
+
|
5
|
+
js_property :html, "A component with the header hidden by means of custom CSS"
|
6
|
+
|
7
|
+
css_include "#{File.dirname(__FILE__)}/custom.css"
|
8
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class ComponentWithIncludedJs < Netzke::Base
|
2
|
+
js_include "#{File.dirname(__FILE__)}/included.js"
|
3
|
+
|
4
|
+
js_base_class "Netzke.ComponentWithIncludedJs"
|
5
|
+
|
6
|
+
action :print_message
|
7
|
+
|
8
|
+
js_property :bbar, [:print_message.action]
|
9
|
+
|
10
|
+
js_method :on_print_message, <<-JS
|
11
|
+
function(){
|
12
|
+
this.updateBodyWithMessage("Some message " + "shown in the body");
|
13
|
+
}
|
14
|
+
JS
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class ComponentWithSessionPersistence < Netzke::Base
|
2
|
+
js_property :title, "No Title (yet!)"
|
3
|
+
js_property :bbar, [{:text => "Tell server to store new title", :ref => "../button"}]
|
4
|
+
|
5
|
+
config :default, :session_persistence => true
|
6
|
+
|
7
|
+
js_method :bug_server, <<-JS
|
8
|
+
function(){
|
9
|
+
this.whatsUp();
|
10
|
+
}
|
11
|
+
JS
|
12
|
+
|
13
|
+
js_method :init_component, <<-JS
|
14
|
+
function(){
|
15
|
+
#{js_full_class_name}.superclass.initComponent.call(this);
|
16
|
+
this.button.on('click', this.bugServer, this);
|
17
|
+
}
|
18
|
+
JS
|
19
|
+
|
20
|
+
endpoint :whats_up do |params|
|
21
|
+
update_session_options(:title => "New Title!")
|
22
|
+
{}
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Deprecated
|
2
|
+
class ServerCaller < Netzke::Base
|
3
|
+
js_properties :title => "Server caller",
|
4
|
+
:bbar => [:call_server.action]
|
5
|
+
|
6
|
+
js_method :on_call_server, <<-JS
|
7
|
+
function(){
|
8
|
+
this.whatsUp();
|
9
|
+
}
|
10
|
+
JS
|
11
|
+
|
12
|
+
ActiveSupport::Deprecation.silence do
|
13
|
+
api :whats_up
|
14
|
+
end
|
15
|
+
|
16
|
+
def whats_up(params)
|
17
|
+
{:set_title => "Hello from the server!"}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class ExtendedServerCaller < ServerCaller
|
2
|
+
|
3
|
+
js_properties :title => "Extended Server Caller"
|
4
|
+
|
5
|
+
js_method :on_bug_server, <<-JS
|
6
|
+
function(){
|
7
|
+
#{js_full_class_name}.superclass.onBugServer.call(this);
|
8
|
+
this.getBottomToolbar().addButton({text: "Added" + " by extended Server Caller"});
|
9
|
+
this.getBottomToolbar().doLayout();
|
10
|
+
}
|
11
|
+
JS
|
12
|
+
|
13
|
+
def whats_up(params)
|
14
|
+
orig = super
|
15
|
+
orig.merge(:set_title => orig[:set_title] + ", shiny weather")
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|