netzke-basepack 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 +27 -2
- data/TODO.rdoc +1 -5
- data/app/models/netzke_persistent_array_auto_model.rb +0 -1
- data/features/components_in_view.feature +11 -0
- data/features/form_panel.feature +49 -0
- data/features/grid_panel.feature +32 -1
- data/features/i18n.feature +18 -0
- data/features/nested_attributes.feature +23 -0
- data/features/search_in_grid.feature +9 -9
- data/features/simple_app.feature +10 -0
- data/features/step_definitions/grid_panel_steps.rb +23 -0
- data/features/support/paths.rb +6 -0
- data/features/support/pickle.rb +0 -1
- data/features/virtual_attributes.feature +20 -0
- data/javascripts/basepack.js +166 -243
- data/lib/netzke-basepack.rb +3 -3
- data/lib/netzke/active_record.rb +6 -7
- data/lib/netzke/active_record/attributes.rb +214 -143
- data/lib/netzke/active_record/combobox_options.rb +12 -10
- data/lib/netzke/basepack.rb +6 -3
- data/lib/netzke/basepack/accordion_panel.rb +4 -2
- data/lib/netzke/basepack/auth_app.rb +152 -0
- data/lib/netzke/basepack/basic_app.rb +2 -262
- data/lib/netzke/basepack/form_panel.rb +35 -27
- data/lib/netzke/basepack/form_panel/fields.rb +35 -17
- data/lib/netzke/basepack/form_panel/javascripts/comma_list_cbg.js +59 -0
- data/lib/netzke/basepack/form_panel/javascripts/display_mode.js +62 -0
- data/lib/netzke/basepack/form_panel/javascripts/main.js +138 -0
- data/lib/netzke/basepack/form_panel/javascripts/n_radio_group.js +25 -0
- data/lib/netzke/basepack/form_panel/services.rb +12 -9
- data/lib/netzke/basepack/grid_panel.rb +87 -53
- data/lib/netzke/basepack/grid_panel/columns.rb +60 -15
- data/lib/netzke/basepack/grid_panel/javascripts/advanced_search.js +2 -64
- data/lib/netzke/basepack/grid_panel/javascripts/edit_in_form.js +2 -2
- data/lib/netzke/basepack/grid_panel/javascripts/{pre.js → main.js} +35 -17
- data/lib/netzke/basepack/grid_panel/javascripts/misc.js +4 -0
- data/lib/netzke/basepack/grid_panel/services.rb +17 -14
- data/lib/netzke/basepack/paging_form_panel.rb +92 -0
- data/lib/netzke/basepack/simple_app.rb +71 -0
- data/lib/netzke/basepack/simple_app/javascripts/main.js +53 -0
- data/lib/netzke/basepack/{basic_app → simple_app/javascripts}/statusbar_ext.js +0 -0
- data/lib/netzke/basepack/tab_panel.rb +2 -12
- data/lib/netzke/basepack/tab_panel/javascripts/main.js +11 -0
- data/lib/netzke/basepack/version.rb +2 -2
- data/lib/netzke/basepack/window.rb +6 -7
- data/lib/netzke/basepack/wrap_lazy_loaded.rb +3 -1
- data/lib/netzke/data_accessor.rb +25 -14
- data/lib/netzke/ext.rb +1 -1
- data/locales/en.yml +22 -0
- data/netzke-basepack.gemspec +66 -12
- data/spec/active_record/attributes_spec.rb +31 -2
- data/spec/factories.rb +16 -1
- data/test/rails_app/Gemfile +2 -2
- data/test/rails_app/Gemfile.lock +76 -77
- data/test/rails_app/app/components/author_grid.rb +7 -0
- data/test/rails_app/app/components/book_form.rb +24 -0
- data/test/rails_app/app/components/book_grid.rb +6 -1
- data/test/rails_app/app/components/book_grid_with_default_values.rb +11 -0
- data/test/rails_app/app/components/book_grid_with_nested_attributes.rb +13 -0
- data/test/rails_app/app/components/book_grid_with_virtual_attributes.rb +22 -0
- data/test/rails_app/app/components/book_paging_form_panel.rb +20 -0
- data/test/rails_app/app/components/book_presentation.rb +18 -0
- data/test/rails_app/app/components/books_bound_to_author.rb +10 -0
- data/test/rails_app/app/components/form_without_model.rb +19 -0
- data/test/rails_app/app/components/lockable_book_form.rb +17 -0
- data/test/rails_app/app/components/lockable_user_form.rb +7 -0
- data/test/rails_app/app/components/simple_window.rb +10 -0
- data/test/rails_app/app/components/some_accordion_panel.rb +22 -0
- data/test/rails_app/app/components/{simple_basic_app.rb → some_auth_app.rb} +3 -3
- data/test/rails_app/app/components/some_border_layout.rb +10 -7
- data/test/rails_app/app/components/some_simple_app.rb +34 -0
- data/test/rails_app/app/components/some_tab_panel.rb +16 -11
- data/test/rails_app/app/components/user_form.rb +11 -4
- data/test/rails_app/app/components/user_grid.rb +7 -1
- data/test/rails_app/app/components/window_component_loader.rb +1 -0
- data/test/rails_app/app/controllers/application_controller.rb +6 -0
- data/test/rails_app/app/controllers/components_controller.rb +3 -3
- data/test/rails_app/app/controllers/welcome_controller.rb +2 -2
- data/test/rails_app/app/helpers/embedded_components_helper.rb +2 -0
- data/test/rails_app/app/models/address.rb +3 -0
- data/test/rails_app/app/models/author.rb +2 -0
- data/test/rails_app/app/models/book.rb +1 -0
- data/test/rails_app/app/models/user.rb +1 -2
- data/test/rails_app/app/views/components/simple_panel.html.erb +1 -0
- data/test/rails_app/app/views/layouts/nested.html.erb +5 -0
- data/test/rails_app/config/application.rb +1 -1
- data/test/rails_app/config/initializers/netzke.rb +0 -4
- data/test/rails_app/config/locales/es.yml +16 -0
- data/test/rails_app/config/routes.rb +4 -1
- data/test/rails_app/db/development_structure.sql +33 -4
- data/test/rails_app/db/migrate/20101026190021_create_books.rb +2 -0
- data/test/rails_app/db/migrate/20110101143818_create_addresses.rb +17 -0
- data/test/rails_app/db/schema.rb +33 -1
- data/test/rails_app/spec/controllers/embedded_components_controller_spec.rb +12 -0
- data/test/rails_app/spec/helpers/embedded_components_helper_spec.rb +15 -0
- data/test/rails_app/spec/models/address_spec.rb +5 -0
- data/test/rails_app/spec/views/embedded_components/index.html.erb_spec.rb +5 -0
- metadata +67 -13
- data/features/basic_app.feature +0 -12
- data/lib/netzke/active_record/association_attributes.rb +0 -102
- data/lib/netzke/basepack/form_panel/javascripts/pre.js +0 -76
- data/lib/netzke/basepack/form_panel/javascripts/xcheckbox.js +0 -82
- data/lib/netzke/basepack/grid_panel/javascript.rb +0 -69
- data/locale/en.yml +0 -16
data/test/rails_app/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
|
-
gem 'rails', '3.0.
|
3
|
+
gem 'rails', '3.0.3'
|
4
4
|
|
5
5
|
gem 'netzke-core'#, :git => "~/code/netzke/netzke-core"
|
6
6
|
gem 'netzke-persistence'#, :git => "~/code/netzke/netzke-persistence"
|
@@ -16,7 +16,7 @@ group :development, :test do
|
|
16
16
|
gem 'capybara'
|
17
17
|
gem 'cucumber-rails'
|
18
18
|
gem 'cucumber'
|
19
|
-
gem 'rspec-rails'
|
19
|
+
gem 'rspec-rails'
|
20
20
|
gem 'spork'
|
21
21
|
gem 'launchy' # So you can do Then show me the page
|
22
22
|
gem 'factory_girl'
|
data/test/rails_app/Gemfile.lock
CHANGED
@@ -2,35 +2,34 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
abstract (1.0.0)
|
5
|
-
actionmailer (3.0.
|
6
|
-
actionpack (= 3.0.
|
7
|
-
mail (~> 2.2.
|
8
|
-
actionpack (3.0.
|
9
|
-
activemodel (= 3.0.
|
10
|
-
activesupport (= 3.0.
|
5
|
+
actionmailer (3.0.3)
|
6
|
+
actionpack (= 3.0.3)
|
7
|
+
mail (~> 2.2.9)
|
8
|
+
actionpack (3.0.3)
|
9
|
+
activemodel (= 3.0.3)
|
10
|
+
activesupport (= 3.0.3)
|
11
11
|
builder (~> 2.1.2)
|
12
12
|
erubis (~> 2.6.6)
|
13
|
-
i18n (~> 0.4
|
13
|
+
i18n (~> 0.4)
|
14
14
|
rack (~> 1.2.1)
|
15
|
-
rack-mount (~> 0.6.
|
16
|
-
rack-test (~> 0.5.
|
15
|
+
rack-mount (~> 0.6.13)
|
16
|
+
rack-test (~> 0.5.6)
|
17
17
|
tzinfo (~> 0.3.23)
|
18
|
-
activemodel (3.0.
|
19
|
-
activesupport (= 3.0.
|
18
|
+
activemodel (3.0.3)
|
19
|
+
activesupport (= 3.0.3)
|
20
20
|
builder (~> 2.1.2)
|
21
|
-
i18n (~> 0.4
|
22
|
-
activerecord (3.0.
|
23
|
-
activemodel (= 3.0.
|
24
|
-
activesupport (= 3.0.
|
25
|
-
arel (~>
|
21
|
+
i18n (~> 0.4)
|
22
|
+
activerecord (3.0.3)
|
23
|
+
activemodel (= 3.0.3)
|
24
|
+
activesupport (= 3.0.3)
|
25
|
+
arel (~> 2.0.2)
|
26
26
|
tzinfo (~> 0.3.23)
|
27
|
-
activeresource (3.0.
|
28
|
-
activemodel (= 3.0.
|
29
|
-
activesupport (= 3.0.
|
30
|
-
activesupport (3.0.
|
27
|
+
activeresource (3.0.3)
|
28
|
+
activemodel (= 3.0.3)
|
29
|
+
activesupport (= 3.0.3)
|
30
|
+
activesupport (3.0.3)
|
31
31
|
acts_as_list (0.1.2)
|
32
|
-
arel (
|
33
|
-
activesupport (~> 3.0.0)
|
32
|
+
arel (2.0.6)
|
34
33
|
builder (2.1.2)
|
35
34
|
capybara (0.4.0)
|
36
35
|
celerity (>= 0.7.9)
|
@@ -41,51 +40,50 @@ GEM
|
|
41
40
|
rack-test (>= 0.5.4)
|
42
41
|
selenium-webdriver (>= 0.0.27)
|
43
42
|
xpath (~> 0.1.2)
|
44
|
-
celerity (0.8.
|
45
|
-
childprocess (0.1.
|
43
|
+
celerity (0.8.7)
|
44
|
+
childprocess (0.1.6)
|
46
45
|
ffi (~> 0.6.3)
|
47
|
-
configuration (1.
|
48
|
-
cucumber (0.
|
49
|
-
builder (
|
46
|
+
configuration (1.2.0)
|
47
|
+
cucumber (0.10.0)
|
48
|
+
builder (>= 2.1.2)
|
50
49
|
diff-lcs (~> 1.1.2)
|
51
|
-
gherkin (~> 2.2
|
50
|
+
gherkin (~> 2.3.2)
|
52
51
|
json (~> 1.4.6)
|
53
52
|
term-ansicolor (~> 1.0.5)
|
54
53
|
cucumber-rails (0.3.2)
|
55
54
|
cucumber (>= 0.8.0)
|
56
|
-
culerity (0.2.
|
55
|
+
culerity (0.2.14)
|
57
56
|
database_cleaner (0.6.0)
|
58
57
|
diff-lcs (1.1.2)
|
59
58
|
erubis (2.6.6)
|
60
59
|
abstract (>= 1.0.0)
|
61
|
-
factory_girl (1.3.
|
60
|
+
factory_girl (1.3.3)
|
62
61
|
ffi (0.6.3)
|
63
62
|
rake (>= 0.8.7)
|
64
|
-
gherkin (2.
|
63
|
+
gherkin (2.3.3)
|
65
64
|
json (~> 1.4.6)
|
66
|
-
|
67
|
-
i18n (0.4.2)
|
65
|
+
i18n (0.5.0)
|
68
66
|
json (1.4.6)
|
69
67
|
json_pure (1.4.6)
|
70
68
|
launchy (0.3.7)
|
71
69
|
configuration (>= 0.0.5)
|
72
70
|
rake (>= 0.8.1)
|
73
|
-
mail (2.2.
|
71
|
+
mail (2.2.14)
|
74
72
|
activesupport (>= 2.3.6)
|
75
|
-
i18n (
|
73
|
+
i18n (>= 0.4.0)
|
76
74
|
mime-types (~> 1.16)
|
77
75
|
treetop (~> 1.4.8)
|
78
|
-
meta_where (0.9.
|
79
|
-
activerecord (~> 3.0.
|
80
|
-
activesupport (~> 3.0.
|
81
|
-
arel (~>
|
76
|
+
meta_where (0.9.10)
|
77
|
+
activerecord (~> 3.0.2)
|
78
|
+
activesupport (~> 3.0.2)
|
79
|
+
arel (~> 2.0.2)
|
82
80
|
mime-types (1.16)
|
83
81
|
mysql2 (0.2.6)
|
84
|
-
netzke-core (0.6.
|
82
|
+
netzke-core (0.6.5)
|
85
83
|
activesupport (>= 3.0.1)
|
86
|
-
netzke-persistence (0.
|
87
|
-
nokogiri (1.4.
|
88
|
-
pickle (0.4.
|
84
|
+
netzke-persistence (0.1.1)
|
85
|
+
nokogiri (1.4.4)
|
86
|
+
pickle (0.4.4)
|
89
87
|
cucumber (>= 0.8)
|
90
88
|
rake
|
91
89
|
rspec (>= 1.3)
|
@@ -94,51 +92,52 @@ GEM
|
|
94
92
|
rack (1.2.1)
|
95
93
|
rack-mount (0.6.13)
|
96
94
|
rack (>= 1.0.0)
|
97
|
-
rack-test (0.5.
|
95
|
+
rack-test (0.5.7)
|
98
96
|
rack (>= 1.0)
|
99
|
-
rails (3.0.
|
100
|
-
actionmailer (= 3.0.
|
101
|
-
actionpack (= 3.0.
|
102
|
-
activerecord (= 3.0.
|
103
|
-
activeresource (= 3.0.
|
104
|
-
activesupport (= 3.0.
|
105
|
-
bundler (~> 1.0
|
106
|
-
railties (= 3.0.
|
107
|
-
railties (3.0.
|
108
|
-
actionpack (= 3.0.
|
109
|
-
activesupport (= 3.0.
|
110
|
-
rake (>= 0.8.
|
111
|
-
thor (~> 0.14.
|
97
|
+
rails (3.0.3)
|
98
|
+
actionmailer (= 3.0.3)
|
99
|
+
actionpack (= 3.0.3)
|
100
|
+
activerecord (= 3.0.3)
|
101
|
+
activeresource (= 3.0.3)
|
102
|
+
activesupport (= 3.0.3)
|
103
|
+
bundler (~> 1.0)
|
104
|
+
railties (= 3.0.3)
|
105
|
+
railties (3.0.3)
|
106
|
+
actionpack (= 3.0.3)
|
107
|
+
activesupport (= 3.0.3)
|
108
|
+
rake (>= 0.8.7)
|
109
|
+
thor (~> 0.14.4)
|
112
110
|
rake (0.8.7)
|
113
|
-
rspec (2.0
|
114
|
-
rspec-core (~> 2.0
|
115
|
-
rspec-expectations (~> 2.0
|
116
|
-
rspec-mocks (~> 2.0
|
117
|
-
rspec-core (2.0
|
118
|
-
rspec-expectations (2.0
|
119
|
-
diff-lcs (
|
120
|
-
rspec-mocks (2.0
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
111
|
+
rspec (2.4.0)
|
112
|
+
rspec-core (~> 2.4.0)
|
113
|
+
rspec-expectations (~> 2.4.0)
|
114
|
+
rspec-mocks (~> 2.4.0)
|
115
|
+
rspec-core (2.4.0)
|
116
|
+
rspec-expectations (2.4.0)
|
117
|
+
diff-lcs (~> 1.1.2)
|
118
|
+
rspec-mocks (2.4.0)
|
119
|
+
rspec-rails (2.4.1)
|
120
|
+
actionpack (~> 3.0)
|
121
|
+
activesupport (~> 3.0)
|
122
|
+
railties (~> 3.0)
|
123
|
+
rspec (~> 2.4.0)
|
125
124
|
rubyzip (0.9.4)
|
126
|
-
selenium-webdriver (0.
|
127
|
-
childprocess (
|
125
|
+
selenium-webdriver (0.1.2)
|
126
|
+
childprocess (~> 0.1.5)
|
128
127
|
ffi (~> 0.6.3)
|
129
128
|
json_pure
|
130
129
|
rubyzip
|
131
130
|
spork (0.8.4)
|
132
131
|
sqlite3-ruby (1.3.2)
|
133
132
|
term-ansicolor (1.0.5)
|
134
|
-
thor (0.14.
|
135
|
-
treetop (1.4.
|
133
|
+
thor (0.14.6)
|
134
|
+
treetop (1.4.9)
|
136
135
|
polyglot (>= 0.3.1)
|
137
136
|
tzinfo (0.3.23)
|
138
137
|
will_paginate (3.0.pre2)
|
139
|
-
xpath (0.1.
|
138
|
+
xpath (0.1.3)
|
140
139
|
nokogiri (~> 1.3)
|
141
|
-
yard (0.6.
|
140
|
+
yard (0.6.4)
|
142
141
|
|
143
142
|
PLATFORMS
|
144
143
|
ruby
|
@@ -156,8 +155,8 @@ DEPENDENCIES
|
|
156
155
|
netzke-core
|
157
156
|
netzke-persistence
|
158
157
|
pickle
|
159
|
-
rails (= 3.0.
|
160
|
-
rspec-rails
|
158
|
+
rails (= 3.0.3)
|
159
|
+
rspec-rails
|
161
160
|
spork
|
162
161
|
sqlite3-ruby
|
163
162
|
will_paginate (= 3.0.pre2)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class BookForm < Netzke::Basepack::FormPanel
|
2
|
+
js_property :title, Book.model_name.human
|
3
|
+
|
4
|
+
include BookPresentation
|
5
|
+
|
6
|
+
def configuration
|
7
|
+
super.merge(
|
8
|
+
:model => "Book",
|
9
|
+
:record => Book.first,
|
10
|
+
:items => [
|
11
|
+
:title,
|
12
|
+
{:name => :author__first_name, :setter => author_first_name_setter},
|
13
|
+
:digitized,
|
14
|
+
:exemplars,
|
15
|
+
{:name => :in_abundance, :getter => in_abundance_getter, :xtype => :displayfield},
|
16
|
+
{:name => :tags, :xtype => :commalistcbg, :options => %w(read cool recommend buy)},
|
17
|
+
{:name => :rating, :xtype => :nradiogroup, :options => %w(Good Average Poor)}
|
18
|
+
]
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class BookGridWithDefaultValues < Netzke::Basepack::GridPanel
|
2
|
+
js_property :title, "Books"
|
3
|
+
|
4
|
+
def default_config
|
5
|
+
super.merge(
|
6
|
+
:model => "Book",
|
7
|
+
:columns => [{:name => 'title', :default_value => "Lolita"}, {:name => 'exemplars', :default_value => 100}, {:name => 'digitized', :default_value => true}]
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class BookGridWithNestedAttributes < Netzke::Basepack::GridPanel
|
2
|
+
def configuration
|
3
|
+
super.merge(
|
4
|
+
:model => "Book",
|
5
|
+
:columns => [:title, {:name => :author__first_name, :nested_attribute => true}, {:name => :author__last_name, :nested_attribute => true}]
|
6
|
+
)
|
7
|
+
end
|
8
|
+
|
9
|
+
def default_fields_for_forms
|
10
|
+
[{:name => :title}, {:name => :author__first_name, :nested_attribute => true}, {:name => :author__last_name, :nested_attribute => true}]
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class BookGridWithVirtualAttributes < Netzke::Basepack::GridPanel
|
2
|
+
js_property :title, "Books"
|
3
|
+
|
4
|
+
include BookPresentation
|
5
|
+
|
6
|
+
def default_config
|
7
|
+
super.merge(
|
8
|
+
:model => "Book",
|
9
|
+
:columns => default_fields_for_forms
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
def default_fields_for_forms
|
14
|
+
[
|
15
|
+
{:name => :title},
|
16
|
+
{:name => :author__first_name, :setter => author_first_name_setter},
|
17
|
+
{:name => :exemplars},
|
18
|
+
{:name => :in_abundance, :getter => in_abundance_getter}
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class BookPagingFormPanel < Netzke::Basepack::PagingFormPanel
|
2
|
+
def default_config
|
3
|
+
super.merge({
|
4
|
+
:model => "Book",
|
5
|
+
:scope => {:digitized => true},
|
6
|
+
:mode => :lockable,
|
7
|
+
:items => [{:layout => :hbox, :label_align => :top, :border => false, :defaults => {:border => false}, :items => [{
|
8
|
+
:flex => 2,
|
9
|
+
:layout => :form,
|
10
|
+
:defaults => {:anchor => "-8"},
|
11
|
+
:items => [:title, :notes]
|
12
|
+
},{
|
13
|
+
:flex => 1,
|
14
|
+
:layout => :form,
|
15
|
+
:defaults => {:anchor => "-8"},
|
16
|
+
:items => [:author__name, :exemplars, :digitized]
|
17
|
+
}]}]
|
18
|
+
})
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module BookPresentation
|
2
|
+
# A setter that creates an author on the fly
|
3
|
+
def author_first_name_setter
|
4
|
+
lambda do |r,v|
|
5
|
+
if (author = Author.where(:first_name => v).first).nil?
|
6
|
+
r.author = Author.create(:first_name => v)
|
7
|
+
else
|
8
|
+
r.author = author
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# A getter that returns "YES" if exemplars are more than 3, "NO" otherwise
|
14
|
+
def in_abundance_getter
|
15
|
+
lambda {|r| r.exemplars.to_i > 3 ? "YES" : "NO"}
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Grid with books that belong to the first author in the DB (assumes the existence of at least 1 author)
|
2
|
+
class BooksBoundToAuthor < Netzke::Basepack::GridPanel
|
3
|
+
def default_config
|
4
|
+
super.merge(
|
5
|
+
:model => "Book",
|
6
|
+
:scope => {:author_id => Author.first.id},
|
7
|
+
:strong_default_attrs => {:author_id => Author.first.id}
|
8
|
+
)
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class FormWithoutModel < Netzke::Basepack::FormPanel
|
2
|
+
def configuration
|
3
|
+
super.merge(
|
4
|
+
:items => [
|
5
|
+
:text_field,
|
6
|
+
{:name => :number_field, :attr_type => :integer},
|
7
|
+
{:name => :boolean_field, :attr_type => :boolean, :input_value => true},
|
8
|
+
{:name => :date_field, :attr_type => :date},
|
9
|
+
{:name => :datetime_field, :attr_type => :datetime},
|
10
|
+
{:name => :combobox_field, :xtype => :combo, :store => ["One", "Two", "Three"]}
|
11
|
+
]
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def netzke_submit_endpoint(params)
|
16
|
+
data = ActiveSupport::JSON.decode(params.data)
|
17
|
+
{:feedback => data.each_pair.map{ |k,v| "#{k.humanize}: #{v}" }.join("<br/>")}
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class LockableBookForm < BookForm
|
2
|
+
def default_config
|
3
|
+
super.merge(:mode => :lockable)
|
4
|
+
end
|
5
|
+
|
6
|
+
def configuration
|
7
|
+
sup = super
|
8
|
+
sup.merge(
|
9
|
+
:items => sup[:items].reject{ |i| i.is_a?(Hash) && i[:name] == :author__first_name } + [{
|
10
|
+
:xtype => :compositefield,
|
11
|
+
:defaults => {:flex => 1},
|
12
|
+
:field_label => "Author name (first, last)",
|
13
|
+
:items => [{:name => :author__first_name, :nested_attribute => true}, {:name => :author__last_name, :nested_attribute => true}]
|
14
|
+
}]
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|