netzke-basepack 0.2.0.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/ar_ext_test.rb CHANGED
@@ -5,11 +5,12 @@ require 'netzke/ar_ext'
5
5
  class ArExtTest < ActiveSupport::TestCase
6
6
  fixtures :cities, :countries, :continents
7
7
 
8
- test "default column config" do
8
+ test "default column and field configs" do
9
9
  cc = Book.default_column_config(:title)
10
10
 
11
11
  assert_equal("Title", cc[:label])
12
12
  assert_equal(:text_field, cc[:editor])
13
+ assert(!cc[:height])
13
14
 
14
15
  cc = Book.default_column_config({:name => :amount, :label => 'AMOUNT'})
15
16
 
@@ -22,6 +23,11 @@ class ArExtTest < ActiveSupport::TestCase
22
23
 
23
24
  cc = Book.default_column_config(:genre__popular)
24
25
  assert_equal(:checkbox, cc[:editor])
26
+
27
+ cc = Book.default_column_config(:title)
28
+
29
+ # cc = Book.default_field_config(:title)
30
+ # assert(cc[:height])
25
31
  end
26
32
 
27
33
  test "choices for column" do
@@ -42,6 +48,12 @@ class ArExtTest < ActiveSupport::TestCase
42
48
  assert_equal(2, cities.size)
43
49
  assert(cities.include?('Cordoba') && cities.include?('Concordia'))
44
50
  end
51
+
52
+ test "to array" do
53
+ b = Book.create({:title => 'Rayuela', :genre_id => 200, :amount => 1000})
54
+ columns = [:recent, {:name => :title}, {:name => :amount}, :genre_id]
55
+ assert_equal(['Yes', 'Rayuela', 1000, 200], b.to_array(columns))
56
+ end
45
57
 
46
58
  end
47
59
 
@@ -8,9 +8,9 @@ require 'netzke-core'
8
8
  require 'netzke/border_layout_panel'
9
9
  require 'netzke/panel'
10
10
  require 'netzke/properties_tool'
11
- require 'netzke/grid_js_builder'
12
- require 'netzke/grid_interface'
13
- require 'netzke/grid'
11
+ require 'netzke/grid_panel_js_builder'
12
+ require 'netzke/grid_panel_interface'
13
+ require 'netzke/grid_panel'
14
14
 
15
15
  class BorderLayoutPanelTest < ActiveSupport::TestCase
16
16
  test "dependencies" do
@@ -5,15 +5,20 @@ require 'netzke/properties_tool'
5
5
  require 'netzke/container'
6
6
  require 'netzke/accordion_panel'
7
7
 
8
- require 'netzke/grid_interface'
9
- require 'netzke/grid_js_builder'
10
- require 'netzke/grid'
8
+ require 'netzke/grid_panel_interface'
9
+ require 'netzke/grid_panel_js_builder'
10
+ require 'netzke/grid_panel'
11
11
 
12
12
  require 'netzke/ar_ext'
13
13
  require 'netzke/column'
14
14
 
15
15
  class GridPanelTest < ActiveSupport::TestCase
16
16
 
17
+ test "class configuration" do
18
+ assert_equal(NetzkeGridPanelColumn, Netzke::GridPanel.column_manager_class)
19
+ assert_equal(NetzkeLayout, Netzke::GridPanel.layout_manager_class)
20
+ end
21
+
17
22
  test "interface" do
18
23
  grid = Netzke::GridPanel.new(:name => 'grid', :data_class_name => 'Book', :layout_manager => false, :columns => [:id, :title, :recent])
19
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-basepack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei Kozlov
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-07 00:00:00 -06:00
12
+ date: 2009-01-23 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: "0"
34
34
  - - "="
35
35
  - !ruby/object:Gem::Version
36
- version: 0.2.1
36
+ version: 0.2.2
37
37
  version:
38
38
  description: Base Netzke widgets - grid, form, tree, and more
39
39
  email: sergei@writelesscode.com
@@ -43,12 +43,14 @@ extensions: []
43
43
 
44
44
  extra_rdoc_files:
45
45
  - CHANGELOG
46
+ - lib/app/models/netzke_form_panel_field.rb
46
47
  - lib/app/models/netzke_grid_panel_column.rb
47
48
  - lib/netzke/accordion_panel.rb
48
49
  - lib/netzke/ar_ext.rb
49
50
  - lib/netzke/border_layout_panel.rb
50
51
  - lib/netzke/column.rb
51
52
  - lib/netzke/container.rb
53
+ - lib/netzke/form_panel.rb
52
54
  - lib/netzke/grid_panel.rb
53
55
  - lib/netzke/grid_panel_interface.rb
54
56
  - lib/netzke/grid_panel_js_builder.rb
@@ -59,25 +61,29 @@ extra_rdoc_files:
59
61
  - lib/netzke/wrapper.rb
60
62
  - lib/netzke-basepack.rb
61
63
  - LICENSE
62
- - README.mdown
64
+ - README.rdoc
63
65
  - tasks/netzke_basepack_tasks.rake
64
66
  files:
65
67
  - CHANGELOG
66
68
  - css/basepack.css
67
69
  - generators/netzke_basepack/netzke_basepack_generator.rb
68
- - generators/netzke_basepack/netzke_grid_panel_generator.rb
69
- - generators/netzke_basepack/templates/create_netzke_grid_panel_columns.rb
70
70
  - generators/netzke_basepack/USAGE
71
+ - generators/netzke_form_panel/netzke_form_panel_generator.rb
72
+ - generators/netzke_form_panel/templates/create_netzke_form_panel_fields.rb
73
+ - generators/netzke_grid_panel/netzke_grid_panel_generator.rb
74
+ - generators/netzke_grid_panel/templates/create_netzke_grid_panel_columns.rb
71
75
  - init.rb
72
76
  - install.rb
73
77
  - javascripts/basepack.js
74
78
  - javascripts/filters.js
79
+ - lib/app/models/netzke_form_panel_field.rb
75
80
  - lib/app/models/netzke_grid_panel_column.rb
76
81
  - lib/netzke/accordion_panel.rb
77
82
  - lib/netzke/ar_ext.rb
78
83
  - lib/netzke/border_layout_panel.rb
79
84
  - lib/netzke/column.rb
80
85
  - lib/netzke/container.rb
86
+ - lib/netzke/form_panel.rb
81
87
  - lib/netzke/grid_panel.rb
82
88
  - lib/netzke/grid_panel_interface.rb
83
89
  - lib/netzke/grid_panel_js_builder.rb
@@ -90,7 +96,7 @@ files:
90
96
  - LICENSE
91
97
  - Manifest
92
98
  - Rakefile
93
- - README.mdown
99
+ - README.rdoc
94
100
  - tasks/netzke_basepack_tasks.rake
95
101
  - test/app_root/app/controllers/application.rb
96
102
  - test/app_root/app/models/book.rb
@@ -115,7 +121,12 @@ files:
115
121
  - test/app_root/db/migrate/20081223025635_create_countries.rb
116
122
  - test/app_root/db/migrate/20081223025653_create_continents.rb
117
123
  - test/app_root/db/migrate/20081223025732_create_cities.rb
124
+ - test/app_root/db/migrate/20090102223630_create_netzke_layouts.rb
125
+ - test/app_root/db/migrate/20090102223811_create_netzke_grid_panel_columns.rb
118
126
  - test/app_root/script/console
127
+ - test/app_root/vendor/plugins/acts_as_list/init.rb
128
+ - test/app_root/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb
129
+ - test/app_root/vendor/plugins/acts_as_list/README
119
130
  - test/ar_ext_test.rb
120
131
  - test/border_layout_panel_test.rb
121
132
  - test/column_test.rb
@@ -141,7 +152,7 @@ rdoc_options:
141
152
  - --title
142
153
  - Netzke-basepack
143
154
  - --main
144
- - README.mdown
155
+ - README.rdoc
145
156
  require_paths:
146
157
  - lib
147
158
  required_ruby_version: !ruby/object:Gem::Requirement
data/README.mdown DELETED
@@ -1,83 +0,0 @@
1
- # netzke-basepack
2
- A pack of basic Rails/Ext JS widgets, as a part of Netzke framework.
3
-
4
- # Prerequisites
5
- 1. Rails >= 2.2
6
- 2. Ext JS >= 2.0: its root *must* be accessible as `RAILS_ROOT/public/extjs`. You may symlink your Ext JS library here like this (from your app folder): `cd public && ln -s ~/Developer/extjs/ext-2.2 extjs`
7
- 3. `acts_as_list` plugin must be installed: `./script/plugin install git://github.com/rails/acts_as_list.git`
8
-
9
- # Installation
10
- Install the gem:
11
- `gem install netzke-basepack`
12
-
13
- Include it into environment.rb:
14
- `config.gem "netzke-basepack"`
15
-
16
- # Usage
17
- First, run the generators to have the necessary migrations:
18
-
19
- `./script/generate netzke_core`
20
-
21
- `./script/generate netzke_grid`
22
-
23
- Do the migrations:
24
-
25
- `rake db:migrate`
26
-
27
- The following example will provide you with a grid-based scaffold for ActiveRecord-model called `Book`. You may generate it like this:
28
-
29
- `./script/generate model Book title:string amount:integer`
30
- (don't forget to run the migrations after it)
31
-
32
- In the controller declare the widget:
33
-
34
- `class WelcomeController < ApplicationController
35
- netzke :books, :widget_class_name => 'GridPanel', :data_class_name => 'Book'
36
- end`
37
-
38
- After a widget is declared in the controller, it can be accessed in 3 different ways: 1) loaded by means of an automatically created controller action which will produce a basic HTML-page with the widget (handy for testing), 2) embedded directly into a view (by means of helpers), 3) dynamically loaded by other widgets (usually by the widget of class 'Application', if you want a desktop-like, AJAX-driven web-app).
39
-
40
- ## Using automatically created controller action
41
- Without writing any more code, you can access the widget by `http://yourhost/welcome/books_test`. That is to say, you simply append `_test` to your widget's name (as declared in the controller) to get the action name.
42
-
43
- ## Embedding a widget into a view
44
- netzke-core plugin provides the following 2 helpers to put inside your head-tag (use it in your layout):
45
-
46
- 1. `netzke_js_include` - to include extjs and netzke javascript files
47
- 2. `netzke_css_include` - to include the css. This one can take a parameter to specify a color schema you wish for Ext JS, e.g.: `netzke_css_include(:gray)`
48
-
49
- Declaring a widget in the controller provides you with a couple of helpers that can be used in the view:
50
-
51
- 1. `books_class_definition` will contain the javascript code defining the code for the JS class.
52
- 2. `books_widget_instance` will declare a local javascript variable called `book`.
53
-
54
- Use these helpers inside of the `<script>`-tag like the following (in the view):
55
-
56
- `<script type="text/javascript" charset="utf-8">
57
- <%= books_class_definition %>
58
- Ext.onReady(function(){
59
- <%= books_widget_instance %>
60
- books.render("books");
61
- })
62
- </script>
63
- <div id="books">the widget will be rendered in this div</div>`
64
-
65
- If your layout already calls `yield :javascripts` wrapped in the `<script>`-tag, you can have all javascript-code in one place on the page:
66
-
67
- `<% content_for :javascripts do %>
68
- <%= books_class_definition %>
69
- Ext.onReady(function(){
70
- <%= books_widget_instance %>
71
- books.render("books");
72
- })
73
- <% end %>
74
- <p>... your page content here ...</p>
75
- <div id="books">the widget will be rendered in this div</div>`
76
-
77
- ## Dynamic loading of widgets
78
- TODO: this part will be covered later
79
-
80
- # Credentials
81
- Testing done with the help of `http://github.com/pluginaweek/plugin_test_helper`
82
-
83
- Copyright (c) 2008 Sergei Kozlov, released under the MIT license