netzke-basepack 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +18 -0
- data/README.rdoc +11 -4
- data/Rakefile +19 -3
- data/TODO.rdoc +1 -1
- data/generators/netzke_basepack/netzke_basepack_generator.rb +13 -0
- data/generators/netzke_basepack/templates/create_netzke_field_lists.rb +18 -0
- data/generators/netzke_basepack/templates/public_assets/ts-checkbox.gif +0 -0
- data/install.rb +1 -1
- data/javascripts/basepack.js +124 -30
- data/lib/app/models/netzke_field_list.rb +261 -0
- data/lib/app/models/netzke_model_attr_list.rb +21 -0
- data/lib/app/models/netzke_persistent_array_auto_model.rb +58 -0
- data/lib/netzke-basepack.rb +17 -2
- data/lib/netzke/active_record.rb +10 -0
- data/lib/netzke/active_record/association_attributes.rb +102 -0
- data/lib/netzke/active_record/attributes.rb +100 -0
- data/lib/netzke/active_record/combobox_options.rb +43 -0
- data/lib/netzke/active_record/data_accessor.rb +9 -12
- data/lib/netzke/attributes_configurator.rb +195 -0
- data/lib/netzke/basic_app.rb +47 -4
- data/lib/netzke/configuration_panel.rb +1 -1
- data/lib/netzke/data_accessor.rb +7 -30
- data/lib/netzke/fields_configurator.rb +106 -41
- data/lib/netzke/form_panel.rb +28 -125
- data/lib/netzke/form_panel/form_panel_api.rb +2 -3
- data/lib/netzke/form_panel/form_panel_fields.rb +147 -0
- data/lib/netzke/form_panel/form_panel_js.rb +35 -15
- data/lib/netzke/grid_panel.rb +130 -213
- data/lib/netzke/grid_panel/grid_panel_api.rb +254 -257
- data/lib/netzke/grid_panel/grid_panel_columns.rb +226 -0
- data/lib/netzke/grid_panel/grid_panel_js.rb +126 -119
- data/lib/netzke/grid_panel/record_form_window.rb +7 -1
- data/lib/netzke/json_array_editor.rb +61 -0
- data/lib/netzke/plugins/configuration_tool.rb +1 -1
- data/lib/netzke/property_editor.rb +3 -3
- data/lib/netzke/search_panel.rb +164 -27
- data/lib/netzke/tab_panel.rb +14 -12
- data/stylesheets/basepack.css +43 -2
- data/test/app_root/app/models/book.rb +1 -1
- data/test/app_root/app/models/role.rb +3 -0
- data/test/app_root/app/models/user.rb +3 -0
- data/test/app_root/config/database.yml +1 -1
- data/test/app_root/db/migrate/20090102223630_create_netzke_field_lists.rb +18 -0
- data/test/app_root/db/migrate/20090423214303_create_roles.rb +11 -0
- data/test/app_root/db/migrate/20090423222114_create_users.rb +12 -0
- data/test/fixtures/books.yml +4 -2
- data/test/fixtures/categories.yml +2 -2
- data/test/fixtures/genres.yml +6 -6
- data/test/fixtures/roles.yml +8 -0
- data/test/fixtures/users.yml +11 -0
- data/test/test_helper.rb +2 -0
- data/test/unit/active_record_basepack_test.rb +2 -2
- data/test/unit/fields_configuration_test.rb +18 -0
- data/test/unit/grid_panel_test.rb +29 -27
- metadata +41 -16
- data/lib/app/models/netzke_auto_column.rb +0 -4
- data/lib/app/models/netzke_auto_field.rb +0 -4
- data/lib/app/models/netzke_auto_table.rb +0 -61
- data/lib/netzke/active_record/basepack.rb +0 -134
- data/lib/netzke/grid_panel/javascripts/filters.js +0 -7
- data/test/app_root/db/migrate/20090102223630_create_netzke_layouts.rb +0 -14
- data/test/unit/helper_model_test.rb +0 -30
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateNetzkeFieldLists < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :netzke_field_lists do |t|
|
4
|
+
t.string :name
|
5
|
+
t.text :value
|
6
|
+
t.string :type
|
7
|
+
t.string :model_name
|
8
|
+
t.integer :user_id
|
9
|
+
t.integer :role_id
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :netzke_field_lists
|
17
|
+
end
|
18
|
+
end
|
data/test/fixtures/books.yml
CHANGED
data/test/fixtures/genres.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
2
2
|
|
3
|
-
|
4
|
-
name:
|
5
|
-
|
3
|
+
fiction:
|
4
|
+
name: fiction
|
5
|
+
category: bestseller
|
6
6
|
|
7
|
-
|
8
|
-
name:
|
9
|
-
|
7
|
+
essay:
|
8
|
+
name: essay
|
9
|
+
category: bestseller
|
data/test/test_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
require 'netzke/active_record/
|
3
|
+
require 'netzke/active_record/attributes'
|
4
4
|
|
5
5
|
class ActiveRecordBasepackTest < ActiveSupport::TestCase
|
6
6
|
fixtures :cities, :countries, :continents
|
@@ -46,7 +46,7 @@ class ActiveRecordBasepackTest < ActiveSupport::TestCase
|
|
46
46
|
test "to array" do
|
47
47
|
Book.send(:include, Netzke::ActiveRecord::DataAccessor)
|
48
48
|
b = Book.create({:title => 'Rayuela', :genre_id => 200, :amount => 1000})
|
49
|
-
columns = [:recent, {:name =>
|
49
|
+
columns = [{:name => "recent"}, {:name => "title"}, {:name => "amount"}, {:name => "genre_id"}]
|
50
50
|
assert_equal(['Yes', 'Rayuela', 1000, 200], b.to_array(columns))
|
51
51
|
end
|
52
52
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'netzke-core'
|
3
|
+
|
4
|
+
class FieldsConfigurationTest < ActiveSupport::TestCase
|
5
|
+
test "attributes configurator" do
|
6
|
+
Netzke::Base.session[:netzke_user_id] = User.find_by_login("seller1").id
|
7
|
+
|
8
|
+
NetzkeModelAttrList.update_list_for_current_authority("Book", [{:name => "title", :label => "Title for seller1", :hidden => false}, {:name => "recent", :label => "Recent", :hidden => true}])
|
9
|
+
|
10
|
+
list = NetzkeModelAttrList.read_list("Book")
|
11
|
+
assert_equal(["Title for seller1", false], [list[0][:label], list[0][:hidden]])
|
12
|
+
|
13
|
+
Netzke::Base.masquerade_as(:role, Role.find_by_name("seller").id)
|
14
|
+
list = NetzkeModelAttrList.read_list("Book")
|
15
|
+
# assert_equal(["Title for seller1", false], [list[0][:label], list[0][:hidden]])
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -1,50 +1,52 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'netzke-core'
|
3
3
|
|
4
|
-
require 'netzke/plugins/configuration_tool'
|
5
|
-
require 'netzke/accordion_panel'
|
6
|
-
|
7
|
-
require 'netzke/grid_panel/grid_panel_api'
|
8
|
-
require 'netzke/grid_panel/grid_panel_js'
|
9
|
-
require 'netzke/grid_panel'
|
10
|
-
|
11
|
-
require 'netzke/active_record/basepack'
|
12
|
-
|
13
4
|
class GridPanelTest < ActiveSupport::TestCase
|
14
5
|
|
15
6
|
test "api" do
|
16
7
|
grid = Netzke::GridPanel.new(:name => 'grid', :model => 'Book', :columns => [:id, :title, :recent])
|
8
|
+
grid_data = grid.get_data[:data]
|
9
|
+
assert_equal(2, grid_data.count)
|
17
10
|
|
18
11
|
# post
|
19
12
|
res = grid.post_data("created_records" => [{:title => 'Lord of the Rings'}].to_nifty_json)
|
20
|
-
assert_equal('Lord of the Rings', Book.
|
13
|
+
assert_equal('Lord of the Rings', Book.last.title)
|
21
14
|
|
22
|
-
|
23
|
-
|
15
|
+
# update
|
16
|
+
grid.post_data("updated_records" => [{:id => Book.last.id, :title => 'Lolita'}].to_json)
|
17
|
+
assert_equal('Lolita', Book.last.title)
|
24
18
|
|
25
|
-
grid.post_data("created_records" => [{:title => 'Upanishad'}].to_json)
|
26
|
-
|
27
19
|
# get
|
28
|
-
data = grid.get_data
|
29
|
-
assert_equal(
|
30
|
-
assert_equal('
|
31
|
-
|
32
|
-
#
|
33
|
-
|
20
|
+
data = grid.get_data[:data]
|
21
|
+
assert_equal(3, Book.count)
|
22
|
+
assert_equal('Separate Reality', data[0][1]) # title of the first book
|
23
|
+
assert_equal('The Journey to Ixtlan', data[1][1]) # title of the second book
|
24
|
+
assert_equal('Yes', data[2][2]) # "recent" virtual column in the last book
|
25
|
+
|
26
|
+
# delete all books
|
27
|
+
res = grid.delete_data(:records => Book.all.map(&:id).to_json)
|
34
28
|
assert_equal(nil, Book.first)
|
35
29
|
|
36
30
|
end
|
37
31
|
|
38
|
-
test "normalize index" do
|
39
|
-
|
32
|
+
# test "normalize index" do
|
33
|
+
# grid = Netzke::GridPanel.new(:name => 'grid', :model => 'Book', :columns => [:id, :col0, {:name => :col1, :excluded => true}, :col2, {:name => :col3, :excluded => true}, :col4, :col5])
|
34
|
+
#
|
35
|
+
# assert_equal(0, grid.normalize_index(0))
|
36
|
+
# assert_equal(1, grid.normalize_index(1))
|
37
|
+
# assert_equal(3, grid.normalize_index(2))
|
38
|
+
# assert_equal(5, grid.normalize_index(3))
|
39
|
+
# assert_equal(6, grid.normalize_index(4))
|
40
|
+
# end
|
41
|
+
|
42
|
+
test "default columns" do
|
43
|
+
grid = Netzke::GridPanel.new(:model => "Book")
|
40
44
|
|
41
|
-
assert_equal(
|
42
|
-
assert_equal(
|
43
|
-
assert_equal(3, grid.normalize_index(2))
|
44
|
-
assert_equal(5, grid.normalize_index(3))
|
45
|
-
assert_equal(6, grid.normalize_index(4))
|
45
|
+
assert_equal(7, grid.columns.size)
|
46
|
+
# assert_equal({:name => "id", :type => :integer}, grid.columns.first)
|
46
47
|
end
|
47
48
|
|
49
|
+
|
48
50
|
# TODO: add tests with association column
|
49
51
|
|
50
52
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 9
|
9
|
+
version: 0.5.9
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Sergei Kozlov
|
@@ -14,27 +14,29 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-11 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: netzke-core
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - ">="
|
26
27
|
- !ruby/object:Gem::Version
|
27
28
|
segments:
|
28
29
|
- 0
|
29
30
|
- 5
|
30
|
-
-
|
31
|
-
version: 0.5.
|
31
|
+
- 2
|
32
|
+
version: 0.5.2
|
32
33
|
type: :runtime
|
33
34
|
version_requirements: *id001
|
34
35
|
- !ruby/object:Gem::Dependency
|
35
36
|
name: searchlogic
|
36
37
|
prerelease: false
|
37
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
38
40
|
requirements:
|
39
41
|
- - ">="
|
40
42
|
- !ruby/object:Gem::Version
|
@@ -49,6 +51,7 @@ dependencies:
|
|
49
51
|
name: will_paginate
|
50
52
|
prerelease: false
|
51
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
52
55
|
requirements:
|
53
56
|
- - ">="
|
54
57
|
- !ruby/object:Gem::Version
|
@@ -63,6 +66,7 @@ dependencies:
|
|
63
66
|
name: acts_as_list
|
64
67
|
prerelease: false
|
65
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
66
70
|
requirements:
|
67
71
|
- - ">="
|
68
72
|
- !ruby/object:Gem::Version
|
@@ -91,16 +95,23 @@ files:
|
|
91
95
|
- Rakefile
|
92
96
|
- TODO.rdoc
|
93
97
|
- autotest/discover.rb
|
98
|
+
- generators/netzke_basepack/netzke_basepack_generator.rb
|
99
|
+
- generators/netzke_basepack/templates/create_netzke_field_lists.rb
|
100
|
+
- generators/netzke_basepack/templates/public_assets/ts-checkbox.gif
|
94
101
|
- init.rb
|
95
102
|
- install.rb
|
96
103
|
- javascripts/basepack.js
|
97
|
-
- lib/app/models/
|
98
|
-
- lib/app/models/
|
99
|
-
- lib/app/models/
|
104
|
+
- lib/app/models/netzke_field_list.rb
|
105
|
+
- lib/app/models/netzke_model_attr_list.rb
|
106
|
+
- lib/app/models/netzke_persistent_array_auto_model.rb
|
100
107
|
- lib/netzke-basepack.rb
|
101
108
|
- lib/netzke/accordion_panel.rb
|
102
|
-
- lib/netzke/active_record
|
109
|
+
- lib/netzke/active_record.rb
|
110
|
+
- lib/netzke/active_record/association_attributes.rb
|
111
|
+
- lib/netzke/active_record/attributes.rb
|
112
|
+
- lib/netzke/active_record/combobox_options.rb
|
103
113
|
- lib/netzke/active_record/data_accessor.rb
|
114
|
+
- lib/netzke/attributes_configurator.rb
|
104
115
|
- lib/netzke/basic_app.rb
|
105
116
|
- lib/netzke/basic_app/statusbar_ext.js
|
106
117
|
- lib/netzke/border_layout_panel.rb
|
@@ -110,15 +121,17 @@ files:
|
|
110
121
|
- lib/netzke/fields_configurator.rb
|
111
122
|
- lib/netzke/form_panel.rb
|
112
123
|
- lib/netzke/form_panel/form_panel_api.rb
|
124
|
+
- lib/netzke/form_panel/form_panel_fields.rb
|
113
125
|
- lib/netzke/form_panel/form_panel_js.rb
|
114
126
|
- lib/netzke/form_panel/javascripts/netzkefileupload.js
|
115
127
|
- lib/netzke/form_panel/javascripts/xcheckbox.js
|
116
128
|
- lib/netzke/grid_panel.rb
|
117
129
|
- lib/netzke/grid_panel/grid_panel_api.rb
|
130
|
+
- lib/netzke/grid_panel/grid_panel_columns.rb
|
118
131
|
- lib/netzke/grid_panel/grid_panel_js.rb
|
119
|
-
- lib/netzke/grid_panel/javascripts/filters.js
|
120
132
|
- lib/netzke/grid_panel/javascripts/rows-dd.js
|
121
133
|
- lib/netzke/grid_panel/record_form_window.rb
|
134
|
+
- lib/netzke/json_array_editor.rb
|
122
135
|
- lib/netzke/masquerade_selector.rb
|
123
136
|
- lib/netzke/panel.rb
|
124
137
|
- lib/netzke/plugins/configuration_tool.rb
|
@@ -139,6 +152,8 @@ files:
|
|
139
152
|
- test/app_root/app/models/continent.rb
|
140
153
|
- test/app_root/app/models/country.rb
|
141
154
|
- test/app_root/app/models/genre.rb
|
155
|
+
- test/app_root/app/models/role.rb
|
156
|
+
- test/app_root/app/models/user.rb
|
142
157
|
- test/app_root/config/boot.rb
|
143
158
|
- test/app_root/config/database.yml
|
144
159
|
- test/app_root/config/environment.rb
|
@@ -155,7 +170,9 @@ files:
|
|
155
170
|
- test/app_root/db/migrate/20081223025635_create_countries.rb
|
156
171
|
- test/app_root/db/migrate/20081223025653_create_continents.rb
|
157
172
|
- test/app_root/db/migrate/20081223025732_create_cities.rb
|
158
|
-
- test/app_root/db/migrate/
|
173
|
+
- test/app_root/db/migrate/20090102223630_create_netzke_field_lists.rb
|
174
|
+
- test/app_root/db/migrate/20090423214303_create_roles.rb
|
175
|
+
- test/app_root/db/migrate/20090423222114_create_users.rb
|
159
176
|
- test/app_root/script/console
|
160
177
|
- test/app_root/vendor/plugins/acts_as_list/README
|
161
178
|
- test/app_root/vendor/plugins/acts_as_list/init.rb
|
@@ -167,12 +184,14 @@ files:
|
|
167
184
|
- test/fixtures/continents.yml
|
168
185
|
- test/fixtures/countries.yml
|
169
186
|
- test/fixtures/genres.yml
|
187
|
+
- test/fixtures/roles.yml
|
188
|
+
- test/fixtures/users.yml
|
170
189
|
- test/schema.rb
|
171
190
|
- test/test_helper.rb
|
172
191
|
- test/unit/accordion_panel_test.rb
|
173
192
|
- test/unit/active_record_basepack_test.rb
|
193
|
+
- test/unit/fields_configuration_test.rb
|
174
194
|
- test/unit/grid_panel_test.rb
|
175
|
-
- test/unit/helper_model_test.rb
|
176
195
|
- test/unit/netzke_basepack_test.rb
|
177
196
|
- test/unit/tab_panel_test.rb
|
178
197
|
- uninstall.rb
|
@@ -180,12 +199,13 @@ has_rdoc: true
|
|
180
199
|
homepage: http://github.com/skozlov/netzke-basepack
|
181
200
|
licenses: []
|
182
201
|
|
183
|
-
post_install_message:
|
202
|
+
post_install_message: "\n ========================================================================\n\n Thanks for installing Netzke Basepack!\n \n Run \"./script/generate netzke_basepack\" to finish the installation.\n\n Netzke home page: http://netzke.org\n Netzke Google Groups: http://groups.google.com/group/netzke\n Netzke tutorials: http://blog.writelesscode.com\n\n ========================================================================\n\n"
|
184
203
|
rdoc_options:
|
185
204
|
- --charset=UTF-8
|
186
205
|
require_paths:
|
187
206
|
- lib
|
188
207
|
required_ruby_version: !ruby/object:Gem::Requirement
|
208
|
+
none: false
|
189
209
|
requirements:
|
190
210
|
- - ">="
|
191
211
|
- !ruby/object:Gem::Version
|
@@ -193,6 +213,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
193
213
|
- 0
|
194
214
|
version: "0"
|
195
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
|
+
none: false
|
196
217
|
requirements:
|
197
218
|
- - ">="
|
198
219
|
- !ruby/object:Gem::Version
|
@@ -202,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
223
|
requirements: []
|
203
224
|
|
204
225
|
rubyforge_project: netzke-basepack
|
205
|
-
rubygems_version: 1.3.
|
226
|
+
rubygems_version: 1.3.7
|
206
227
|
signing_key:
|
207
228
|
specification_version: 3
|
208
229
|
summary: Pre-built Rails + ExtJS widgets for your RIA
|
@@ -214,6 +235,8 @@ test_files:
|
|
214
235
|
- test/app_root/app/models/continent.rb
|
215
236
|
- test/app_root/app/models/country.rb
|
216
237
|
- test/app_root/app/models/genre.rb
|
238
|
+
- test/app_root/app/models/role.rb
|
239
|
+
- test/app_root/app/models/user.rb
|
217
240
|
- test/app_root/config/boot.rb
|
218
241
|
- test/app_root/config/environment.rb
|
219
242
|
- test/app_root/config/environments/in_memory.rb
|
@@ -229,7 +252,9 @@ test_files:
|
|
229
252
|
- test/app_root/db/migrate/20081223025635_create_countries.rb
|
230
253
|
- test/app_root/db/migrate/20081223025653_create_continents.rb
|
231
254
|
- test/app_root/db/migrate/20081223025732_create_cities.rb
|
232
|
-
- test/app_root/db/migrate/
|
255
|
+
- test/app_root/db/migrate/20090102223630_create_netzke_field_lists.rb
|
256
|
+
- test/app_root/db/migrate/20090423214303_create_roles.rb
|
257
|
+
- test/app_root/db/migrate/20090423222114_create_users.rb
|
233
258
|
- test/app_root/vendor/plugins/acts_as_list/init.rb
|
234
259
|
- test/app_root/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb
|
235
260
|
- test/console_with_fixtures.rb
|
@@ -237,7 +262,7 @@ test_files:
|
|
237
262
|
- test/test_helper.rb
|
238
263
|
- test/unit/accordion_panel_test.rb
|
239
264
|
- test/unit/active_record_basepack_test.rb
|
265
|
+
- test/unit/fields_configuration_test.rb
|
240
266
|
- test/unit/grid_panel_test.rb
|
241
|
-
- test/unit/helper_model_test.rb
|
242
267
|
- test/unit/netzke_basepack_test.rb
|
243
268
|
- test/unit/tab_panel_test.rb
|