tabulatr 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/Gemfile +5 -5
- data/Gemfile.lock +92 -49
- data/README.textile +95 -54
- data/assets/images/buttons_lite_background.png +0 -0
- data/assets/images/pager_arrow_left.gif +0 -0
- data/assets/images/pager_arrow_left_off.gif +0 -0
- data/assets/images/pager_arrow_right.gif +0 -0
- data/assets/images/pager_arrow_right_off.gif +0 -0
- data/assets/images/sort_arrow_down.gif +0 -0
- data/assets/images/sort_arrow_down_off.gif +0 -0
- data/assets/images/sort_arrow_up.gif +0 -0
- data/assets/images/sort_arrow_up_off.gif +0 -0
- data/init.rb +1 -0
- data/lib/generators/tabulatr/install_generator.rb +53 -0
- data/lib/tabulatr/version.rb +3 -0
- data/spec/dummy_app/.gitignore +4 -0
- data/spec/dummy_app/app/controllers/application_controller.rb +3 -0
- data/spec/dummy_app/app/controllers/products_controller.rb +90 -0
- data/spec/dummy_app/app/controllers/vendors_controller.rb +83 -0
- data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
- data/spec/dummy_app/app/helpers/products_helper.rb +2 -0
- data/spec/dummy_app/app/helpers/vendors_helper.rb +2 -0
- data/spec/dummy_app/app/models/product.rb +6 -0
- data/spec/dummy_app/app/models/tag.rb +3 -0
- data/spec/dummy_app/app/models/vendor.rb +5 -0
- data/spec/dummy_app/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy_app/app/views/products/_form.html.erb +41 -0
- data/spec/dummy_app/app/views/products/edit.html.erb +6 -0
- data/spec/dummy_app/app/views/products/index.html.erb +31 -0
- data/spec/dummy_app/app/views/products/index_filters.html.erb +8 -0
- data/spec/dummy_app/app/views/products/index_select.html.erb +6 -0
- data/spec/dummy_app/app/views/products/index_simple.html.erb +10 -0
- data/spec/dummy_app/app/views/products/new.html.erb +5 -0
- data/spec/dummy_app/app/views/products/show.html.erb +35 -0
- data/spec/dummy_app/app/views/vendors/_form.html.erb +33 -0
- data/spec/dummy_app/app/views/vendors/edit.html.erb +6 -0
- data/spec/dummy_app/app/views/vendors/index.html.erb +31 -0
- data/spec/dummy_app/app/views/vendors/new.html.erb +5 -0
- data/spec/dummy_app/app/views/vendors/show.html.erb +30 -0
- data/spec/dummy_app/config.ru +4 -0
- data/spec/dummy_app/config/application.rb +42 -0
- data/spec/dummy_app/config/boot.rb +13 -0
- data/spec/dummy_app/config/database.yml +22 -0
- data/spec/dummy_app/config/environment.rb +5 -0
- data/spec/dummy_app/config/environments/development.rb +26 -0
- data/spec/dummy_app/config/environments/production.rb +49 -0
- data/spec/dummy_app/config/environments/test.rb +35 -0
- data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_app/config/initializers/inflections.rb +10 -0
- data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
- data/spec/dummy_app/config/initializers/secret_token.rb +7 -0
- data/spec/dummy_app/config/initializers/session_store.rb +8 -0
- data/spec/dummy_app/config/initializers/tabulatr_settings.rb +11 -0
- data/spec/dummy_app/config/locales/en.yml +5 -0
- data/spec/dummy_app/config/routes.rb +69 -0
- data/spec/dummy_app/db/migrate/20110112151112_create_vendors.rb +16 -0
- data/spec/dummy_app/db/migrate/20110112151200_create_products.rb +17 -0
- data/spec/dummy_app/db/migrate/20110212104327_create_tags.rb +19 -0
- data/spec/dummy_app/doc/README_FOR_APP +2 -0
- data/spec/dummy_app/lib/tasks/.gitkeep +0 -0
- data/spec/dummy_app/lib/tasks/db.rake +40 -0
- data/spec/dummy_app/public/404.html +26 -0
- data/spec/dummy_app/public/422.html +26 -0
- data/spec/dummy_app/public/500.html +26 -0
- data/spec/dummy_app/public/favicon.ico +0 -0
- data/spec/dummy_app/public/images/rails.png +0 -0
- data/spec/dummy_app/public/images/tabulatr/buttons_lite_background.png +0 -0
- data/spec/dummy_app/public/images/tabulatr/pager_arrow_left.gif +0 -0
- data/spec/dummy_app/public/images/tabulatr/pager_arrow_left_off.gif +0 -0
- data/spec/dummy_app/public/images/tabulatr/pager_arrow_right.gif +0 -0
- data/spec/dummy_app/public/images/tabulatr/pager_arrow_right_off.gif +0 -0
- data/spec/dummy_app/public/images/tabulatr/sort_arrow_down.gif +0 -0
- data/spec/dummy_app/public/images/tabulatr/sort_arrow_down_off.gif +0 -0
- data/spec/dummy_app/public/images/tabulatr/sort_arrow_up.gif +0 -0
- data/spec/dummy_app/public/images/tabulatr/sort_arrow_up_off.gif +0 -0
- data/spec/dummy_app/public/index.html +239 -0
- data/spec/dummy_app/public/javascripts/application.js +2 -0
- data/spec/dummy_app/public/javascripts/controls.js +965 -0
- data/spec/dummy_app/public/javascripts/dragdrop.js +974 -0
- data/spec/dummy_app/public/javascripts/effects.js +1123 -0
- data/spec/dummy_app/public/javascripts/prototype.js +6001 -0
- data/spec/dummy_app/public/javascripts/rails.js +175 -0
- data/spec/dummy_app/public/robots.txt +5 -0
- data/spec/dummy_app/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy_app/public/stylesheets/tabulatr.css +107 -0
- data/spec/requests/tabulatrs_spec.rb +275 -0
- data/spec/spec_helper.rb +22 -0
- data/tabulatr.gemspec +25 -22
- metadata +166 -19
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile
CHANGED
@@ -2,12 +2,12 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem "rails"
|
6
|
-
gem "whiny_hash"
|
7
|
-
gem "id_stuffer"
|
8
|
-
|
9
5
|
group :development, :test do
|
6
|
+
gem 'sqlite3-ruby', :require => 'sqlite3'
|
7
|
+
gem 'ruby-debug19'
|
10
8
|
gem 'rspec'
|
11
9
|
gem 'rspec-rails'
|
12
|
-
gem '
|
10
|
+
gem 'capybara'
|
11
|
+
gem 'launchy'
|
12
|
+
gem 'database_cleaner'
|
13
13
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,48 +1,73 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tabulatr (0.0.
|
4
|
+
tabulatr (0.0.2)
|
5
5
|
id_stuffer (>= 0.0.1)
|
6
|
-
rails (~> 3.0
|
6
|
+
rails (~> 3.0)
|
7
7
|
whiny_hash (>= 0.0.2)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: http://rubygems.org/
|
11
11
|
specs:
|
12
12
|
abstract (1.0.0)
|
13
|
-
actionmailer (3.0.
|
14
|
-
actionpack (= 3.0.
|
15
|
-
mail (~> 2.2.
|
16
|
-
actionpack (3.0.
|
17
|
-
activemodel (= 3.0.
|
18
|
-
activesupport (= 3.0.
|
13
|
+
actionmailer (3.0.5)
|
14
|
+
actionpack (= 3.0.5)
|
15
|
+
mail (~> 2.2.15)
|
16
|
+
actionpack (3.0.5)
|
17
|
+
activemodel (= 3.0.5)
|
18
|
+
activesupport (= 3.0.5)
|
19
19
|
builder (~> 2.1.2)
|
20
20
|
erubis (~> 2.6.6)
|
21
21
|
i18n (~> 0.4)
|
22
22
|
rack (~> 1.2.1)
|
23
23
|
rack-mount (~> 0.6.13)
|
24
|
-
rack-test (~> 0.5.
|
24
|
+
rack-test (~> 0.5.7)
|
25
25
|
tzinfo (~> 0.3.23)
|
26
|
-
activemodel (3.0.
|
27
|
-
activesupport (= 3.0.
|
26
|
+
activemodel (3.0.5)
|
27
|
+
activesupport (= 3.0.5)
|
28
28
|
builder (~> 2.1.2)
|
29
29
|
i18n (~> 0.4)
|
30
|
-
activerecord (3.0.
|
31
|
-
activemodel (= 3.0.
|
32
|
-
activesupport (= 3.0.
|
30
|
+
activerecord (3.0.5)
|
31
|
+
activemodel (= 3.0.5)
|
32
|
+
activesupport (= 3.0.5)
|
33
33
|
arel (~> 2.0.2)
|
34
34
|
tzinfo (~> 0.3.23)
|
35
|
-
activeresource (3.0.
|
36
|
-
activemodel (= 3.0.
|
37
|
-
activesupport (= 3.0.
|
38
|
-
activesupport (3.0.
|
39
|
-
|
35
|
+
activeresource (3.0.5)
|
36
|
+
activemodel (= 3.0.5)
|
37
|
+
activesupport (= 3.0.5)
|
38
|
+
activesupport (3.0.5)
|
39
|
+
archive-tar-minitar (0.5.2)
|
40
|
+
arel (2.0.9)
|
40
41
|
builder (2.1.2)
|
42
|
+
capybara (0.4.1.2)
|
43
|
+
celerity (>= 0.7.9)
|
44
|
+
culerity (>= 0.2.4)
|
45
|
+
mime-types (>= 1.16)
|
46
|
+
nokogiri (>= 1.3.3)
|
47
|
+
rack (>= 1.0.0)
|
48
|
+
rack-test (>= 0.5.4)
|
49
|
+
selenium-webdriver (>= 0.0.27)
|
50
|
+
xpath (~> 0.1.3)
|
51
|
+
celerity (0.8.8)
|
52
|
+
childprocess (0.1.7)
|
53
|
+
ffi (~> 0.6.3)
|
54
|
+
columnize (0.3.2)
|
55
|
+
configuration (1.2.0)
|
56
|
+
culerity (0.2.15)
|
57
|
+
database_cleaner (0.6.6)
|
41
58
|
diff-lcs (1.1.2)
|
42
59
|
erubis (2.6.6)
|
43
60
|
abstract (>= 1.0.0)
|
61
|
+
ffi (0.6.3)
|
62
|
+
rake (>= 0.8.7)
|
44
63
|
i18n (0.5.0)
|
45
64
|
id_stuffer (0.0.1)
|
65
|
+
json_pure (1.5.1)
|
66
|
+
launchy (0.4.0)
|
67
|
+
configuration (>= 0.0.5)
|
68
|
+
rake (>= 0.8.1)
|
69
|
+
linecache19 (0.5.11)
|
70
|
+
ruby_core_source (>= 0.1.4)
|
46
71
|
mail (2.2.15)
|
47
72
|
activesupport (>= 2.3.6)
|
48
73
|
i18n (>= 0.4.0)
|
@@ -51,56 +76,74 @@ GEM
|
|
51
76
|
mime-types (1.16)
|
52
77
|
nokogiri (1.4.4)
|
53
78
|
polyglot (0.3.1)
|
54
|
-
rack (1.2.
|
79
|
+
rack (1.2.2)
|
55
80
|
rack-mount (0.6.13)
|
56
81
|
rack (>= 1.0.0)
|
57
|
-
rack-test (0.5.
|
82
|
+
rack-test (0.5.7)
|
58
83
|
rack (>= 1.0)
|
59
|
-
rails (3.0.
|
60
|
-
actionmailer (= 3.0.
|
61
|
-
actionpack (= 3.0.
|
62
|
-
activerecord (= 3.0.
|
63
|
-
activeresource (= 3.0.
|
64
|
-
activesupport (= 3.0.
|
84
|
+
rails (3.0.5)
|
85
|
+
actionmailer (= 3.0.5)
|
86
|
+
actionpack (= 3.0.5)
|
87
|
+
activerecord (= 3.0.5)
|
88
|
+
activeresource (= 3.0.5)
|
89
|
+
activesupport (= 3.0.5)
|
65
90
|
bundler (~> 1.0)
|
66
|
-
railties (= 3.0.
|
67
|
-
railties (3.0.
|
68
|
-
actionpack (= 3.0.
|
69
|
-
activesupport (= 3.0.
|
91
|
+
railties (= 3.0.5)
|
92
|
+
railties (3.0.5)
|
93
|
+
actionpack (= 3.0.5)
|
94
|
+
activesupport (= 3.0.5)
|
70
95
|
rake (>= 0.8.7)
|
71
96
|
thor (~> 0.14.4)
|
72
97
|
rake (0.8.7)
|
73
|
-
rspec (2.
|
74
|
-
rspec-core (~> 2.
|
75
|
-
rspec-expectations (~> 2.
|
76
|
-
rspec-mocks (~> 2.
|
77
|
-
rspec-core (2.
|
78
|
-
rspec-expectations (2.
|
98
|
+
rspec (2.5.0)
|
99
|
+
rspec-core (~> 2.5.0)
|
100
|
+
rspec-expectations (~> 2.5.0)
|
101
|
+
rspec-mocks (~> 2.5.0)
|
102
|
+
rspec-core (2.5.1)
|
103
|
+
rspec-expectations (2.5.0)
|
79
104
|
diff-lcs (~> 1.1.2)
|
80
|
-
rspec-mocks (2.
|
81
|
-
rspec-rails (2.
|
105
|
+
rspec-mocks (2.5.0)
|
106
|
+
rspec-rails (2.5.0)
|
82
107
|
actionpack (~> 3.0)
|
83
108
|
activesupport (~> 3.0)
|
84
109
|
railties (~> 3.0)
|
85
|
-
rspec (~> 2.
|
110
|
+
rspec (~> 2.5.0)
|
111
|
+
ruby-debug-base19 (0.11.24)
|
112
|
+
columnize (>= 0.3.1)
|
113
|
+
linecache19 (>= 0.5.11)
|
114
|
+
ruby_core_source (>= 0.1.4)
|
115
|
+
ruby-debug19 (0.11.6)
|
116
|
+
columnize (>= 0.3.1)
|
117
|
+
linecache19 (>= 0.5.11)
|
118
|
+
ruby-debug-base19 (>= 0.11.19)
|
119
|
+
ruby_core_source (0.1.4)
|
120
|
+
archive-tar-minitar (>= 0.5.2)
|
121
|
+
rubyzip (0.9.4)
|
122
|
+
selenium-webdriver (0.1.3)
|
123
|
+
childprocess (~> 0.1.5)
|
124
|
+
ffi (~> 0.6.3)
|
125
|
+
json_pure
|
126
|
+
rubyzip
|
127
|
+
sqlite3 (1.3.3)
|
128
|
+
sqlite3-ruby (1.3.3)
|
129
|
+
sqlite3 (>= 1.3.3)
|
86
130
|
thor (0.14.6)
|
87
131
|
treetop (1.4.9)
|
88
132
|
polyglot (>= 0.3.1)
|
89
|
-
tzinfo (0.3.
|
90
|
-
webrat (0.7.2)
|
91
|
-
nokogiri (>= 1.2.0)
|
92
|
-
rack (>= 1.0)
|
93
|
-
rack-test (>= 0.5.3)
|
133
|
+
tzinfo (0.3.25)
|
94
134
|
whiny_hash (0.0.2)
|
135
|
+
xpath (0.1.3)
|
136
|
+
nokogiri (~> 1.3)
|
95
137
|
|
96
138
|
PLATFORMS
|
97
139
|
ruby
|
98
140
|
|
99
141
|
DEPENDENCIES
|
100
|
-
|
101
|
-
|
142
|
+
capybara
|
143
|
+
database_cleaner
|
144
|
+
launchy
|
102
145
|
rspec
|
103
146
|
rspec-rails
|
147
|
+
ruby-debug19
|
148
|
+
sqlite3-ruby
|
104
149
|
tabulatr!
|
105
|
-
webrat
|
106
|
-
whiny_hash
|
data/README.textile
CHANGED
@@ -11,7 +11,7 @@ We found ourselves reinventing the wheel in every project we made, by using
|
|
11
11
|
* difterent ways of implementing selecting and batch actions,
|
12
12
|
* different layouts.
|
13
13
|
|
14
|
-
We finally thought that whilst gems like Formtastic or SimpleForm provide a really cool, uniform, and concise way to implement forms, it's time for a table builder. During a project with Magento (*shiver*) we decided that their general tables are quite reasonable, and enterprise-proven -- so that's our starting point.
|
14
|
+
We finally thought that whilst gems like Formtastic or SimpleForm provide a really cool, uniform, and concise way to implement forms, it's time for a table builder. During a project with Magento (*shiver*) we decided that their general tables are quite reasonable, and enterprise-proven -- so that's our starting point.
|
15
15
|
|
16
16
|
h3. Visual Components
|
17
17
|
|
@@ -19,10 +19,10 @@ Every Tabulatr table consists of the following components:
|
|
19
19
|
|
20
20
|
* a wrapping form
|
21
21
|
* a 'Controls Container' containing the table-controls as
|
22
|
-
* the paginator,
|
23
|
-
* the batch_actions,
|
24
|
-
* the submit button,
|
25
|
-
* controls to manage selecting/checking/marking,
|
22
|
+
* the paginator,
|
23
|
+
* the batch_actions,
|
24
|
+
* the submit button,
|
25
|
+
* controls to manage selecting/checking/marking,
|
26
26
|
* an info_text
|
27
27
|
* The actual table consisting of
|
28
28
|
* A header row,
|
@@ -30,7 +30,7 @@ Every Tabulatr table consists of the following components:
|
|
30
30
|
* data rows,
|
31
31
|
* possibly a selecting/checking/marking column
|
32
32
|
* possibly action links/buttons
|
33
|
-
|
33
|
+
|
34
34
|
Whilst this is a strong decision, we made everything as-configurable-as-possible, there are roughly 150 options you can use to tweak almost every aspect of Tabulatr.
|
35
35
|
|
36
36
|
h3. Features
|
@@ -49,7 +49,7 @@ We suppose we have a couple of models
|
|
49
49
|
* tags has and belong to many products
|
50
50
|
* vendors have many products
|
51
51
|
* products belong to vendors and have and belong to many tags
|
52
|
-
|
52
|
+
|
53
53
|
h3. Controller
|
54
54
|
|
55
55
|
In the products controllers index action we have:
|
@@ -62,7 +62,7 @@ In the products controllers index action we have:
|
|
62
62
|
|
63
63
|
the find_for_table method is injected into ActiveRecord by Tabulatr, it retrieves all relevant data from the params hash automagically.
|
64
64
|
|
65
|
-
h3.View
|
65
|
+
h3. View
|
66
66
|
|
67
67
|
To get a simple Table, all we need to do is
|
68
68
|
|
@@ -79,15 +79,18 @@ To get a simple Table, all we need to do is
|
|
79
79
|
|
80
80
|
but the result is pretty fancy, already:
|
81
81
|
|
82
|
-
<img src="assets/simple_table.png" />
|
82
|
+
<img src="https://github.com/provideal/tabulatr/raw/master/assets/simple_table.png" />
|
83
83
|
|
84
84
|
To add a column with ckeckboxes (thus giving all the "Select ..." buttons a reasonable semantics), we simply add a
|
85
|
+
|
85
86
|
<pre>
|
86
|
-
t.checkbox
|
87
|
+
t.checkbox
|
87
88
|
</pre>
|
89
|
+
|
88
90
|
row.
|
89
91
|
|
90
92
|
To add e.g. edit-buttons, we specify
|
93
|
+
|
91
94
|
<pre>
|
92
95
|
t.action do |record|
|
93
96
|
link_to "Edit", edit_product_path(record)
|
@@ -95,6 +98,7 @@ To add e.g. edit-buttons, we specify
|
|
95
98
|
</pre>
|
96
99
|
|
97
100
|
To add a select-popup with batch-actions (i.e., actions that are to be perfored on all selected rows), we add an option to the table_for:
|
101
|
+
|
98
102
|
<pre>
|
99
103
|
<%= table_for @products, :batch_actions => {'foo' => 'Foo', 'delete' => "Delete"} do |t|
|
100
104
|
...
|
@@ -102,6 +106,7 @@ To add a select-popup with batch-actions (i.e., actions that are to be perfored
|
|
102
106
|
</pre>
|
103
107
|
|
104
108
|
to handle the actual batch action, we have to add a block to the <tt>find_for_table</tt> call in the controller:
|
109
|
+
|
105
110
|
<pre>
|
106
111
|
@products = Product.find_for_table(params) do |batch_actions|
|
107
112
|
batch_actions.delete do |ids|
|
@@ -112,12 +117,47 @@ to handle the actual batch action, we have to add a block to the <tt>find_for_ta
|
|
112
117
|
return
|
113
118
|
end
|
114
119
|
batch_actions.foo do |ids|
|
115
|
-
|
120
|
+
... do whatever is foo-ish to the records
|
116
121
|
end
|
117
122
|
end
|
118
123
|
</pre>
|
124
|
+
|
119
125
|
where the <tt>ids</tt> parameter to the block is actually an Array containing the numeric ids of the currently selected rows.
|
120
126
|
|
127
|
+
h2. Installation
|
128
|
+
|
129
|
+
Installation is pretty straightforward. Just include a line
|
130
|
+
|
131
|
+
<pre>
|
132
|
+
gem 'tabulatr', '...current version here'
|
133
|
+
</pre>
|
134
|
+
|
135
|
+
in your applications <tt>Gemfile</tt>, then run <tt>bundle install</tt>.
|
136
|
+
|
137
|
+
If you want to use a predefined stylesheet and the images for sorting and paging, just issue
|
138
|
+
|
139
|
+
<pre>
|
140
|
+
$ rails g tabulatr:install
|
141
|
+
create public/stylesheets/tabulatr.css
|
142
|
+
create public/images/tabulatr/buttons_lite_background.png
|
143
|
+
create public/images/tabulatr/pager_arrow_left.gif
|
144
|
+
create public/images/tabulatr/pager_arrow_left_off.gif
|
145
|
+
create public/images/tabulatr/pager_arrow_right.gif
|
146
|
+
create public/images/tabulatr/pager_arrow_right_off.gif
|
147
|
+
create public/images/tabulatr/sort_arrow_down.gif
|
148
|
+
create public/images/tabulatr/sort_arrow_down_off.gif
|
149
|
+
create public/images/tabulatr/sort_arrow_up.gif
|
150
|
+
create public/images/tabulatr/sort_arrow_up_off.gif
|
151
|
+
-------------------------------------------------------
|
152
|
+
Please note: We have copied a sample stylesheet to
|
153
|
+
public/stylesheets/tabulatr.css
|
154
|
+
to actually use it in your application, please include
|
155
|
+
it in your layout file. You may use s/th like
|
156
|
+
<%= stylesheet_link_tag :tabulatr %>
|
157
|
+
for that.
|
158
|
+
-------------------------------------------------------
|
159
|
+
</pre>
|
160
|
+
|
121
161
|
h2. Options
|
122
162
|
|
123
163
|
Literally every aspect of Tabulatr can be tweaked to fit your needs. You may add or remove components, change the class or other html attributes of the generated html nodes. There are options of several types:
|
@@ -127,40 +167,40 @@ h3. Table Options
|
|
127
167
|
These options are to be specified at the form_for level and change the appearance and behaviour of the table. This is taken from <tt>lib/tabulatr/tabulatr/settings.rb</tt>
|
128
168
|
|
129
169
|
<pre>
|
130
|
-
remote: false,
|
131
|
-
form_class: 'tabulatr_form',
|
132
|
-
table_class: 'tabulatr_table',
|
133
|
-
sortable_class: 'sortable',
|
134
|
-
sorting_asc_class: 'sorting-asc',
|
135
|
-
sorting_desc_class: 'sorting-desc',
|
136
|
-
page_left_class: 'page-left',
|
137
|
-
page_right_class: 'page-right',
|
138
|
-
page_no_class: 'page-no',
|
139
|
-
control_div_class_before: 'table-controls',
|
140
|
-
control_div_class_after: 'table-controls',
|
141
|
-
paginator_div_class: 'paginator',
|
142
|
-
batch_actions_div_class: 'batch-actions',
|
170
|
+
remote: false, # add data-remote="true" to form
|
171
|
+
form_class: 'tabulatr_form', # class of the overall form
|
172
|
+
table_class: 'tabulatr_table', # class for the actual data table
|
173
|
+
sortable_class: 'sortable', # class for the header of a sortable column
|
174
|
+
sorting_asc_class: 'sorting-asc', # class for the currently asc sorting column
|
175
|
+
sorting_desc_class: 'sorting-desc', # class for the currently desc sorting column
|
176
|
+
page_left_class: 'page-left', # class for the page left button
|
177
|
+
page_right_class: 'page-right', # class for the page right button
|
178
|
+
page_no_class: 'page-no', # class for the page no <input>
|
179
|
+
control_div_class_before: 'table-controls', # class of the upper div containing the paging and batch action controls
|
180
|
+
control_div_class_after: 'table-controls', # class of the lower div containing the paging and batch action controls
|
181
|
+
paginator_div_class: 'paginator', # class of the div containing the paging controls
|
182
|
+
batch_actions_div_class: 'batch-actions', # class of the div containing the batch action controls
|
143
183
|
select_controls_div_class: 'check-controls', # class of the div containing the check controls
|
144
|
-
submit_class: 'submit-table',
|
145
|
-
pagesize_select_class: 'pagesize_select',
|
146
|
-
select_all_class: 'select-btn',
|
147
|
-
select_none_class: 'select-btn',
|
148
|
-
select_visible_class: 'select-btn',
|
149
|
-
unselect_visible_class: 'select-btn',
|
150
|
-
select_filtered_class: 'select-btn',
|
151
|
-
unselect_filtered_class: 'select-btn',
|
152
|
-
info_text_class: 'info-text',
|
153
|
-
|
154
|
-
batch_actions_label: 'Batch Action: ',
|
155
|
-
batch_actions_type: :select,
|
156
|
-
batch_actions_class: 'batch-action-inputs',
|
157
|
-
submit_label: 'Apply',
|
158
|
-
select_all_label: 'Select All',
|
159
|
-
select_none_label: 'Select None',
|
160
|
-
select_visible_label: 'Select visible',
|
161
|
-
unselect_visible_label: 'Unselect visible',
|
162
|
-
select_filtered_label: 'Select filtered',
|
163
|
-
unselect_filtered_label: 'Unselect filtered'
|
184
|
+
submit_class: 'submit-table', # class of submit button
|
185
|
+
pagesize_select_class: 'pagesize_select', # class of the pagesize select element
|
186
|
+
select_all_class: 'select-btn', # class of the select all button
|
187
|
+
select_none_class: 'select-btn', # class of the select none button
|
188
|
+
select_visible_class: 'select-btn', # class of the select visible button
|
189
|
+
unselect_visible_class: 'select-btn', # class of the unselect visible button
|
190
|
+
select_filtered_class: 'select-btn', # class of the select filtered button
|
191
|
+
unselect_filtered_class: 'select-btn', # class of the unselect filteredbutton
|
192
|
+
info_text_class: 'info-text', # class of the info text div
|
193
|
+
|
194
|
+
batch_actions_label: 'Batch Action: ', # Text to show in front of the batch action select
|
195
|
+
batch_actions_type: :select, # :select or :button depending on the kind of input you want
|
196
|
+
batch_actions_class: 'batch-action-inputs', # class to apply on the batch action input elements
|
197
|
+
submit_label: 'Apply', # Text on the submit button
|
198
|
+
select_all_label: 'Select All', # Text on the select all button
|
199
|
+
select_none_label: 'Select None', # Text on the select none button
|
200
|
+
select_visible_label: 'Select visible', # Text on the select visible button
|
201
|
+
unselect_visible_label: 'Unselect visible', # Text on the unselect visible button
|
202
|
+
select_filtered_label: 'Select filtered', # Text on the select filtered button
|
203
|
+
unselect_filtered_label: 'Unselect filtered', # Text on the unselect filtered button
|
164
204
|
info_text: "Showing %1$d, total %2$d, selected %3$d, matching %4$d",
|
165
205
|
|
166
206
|
# which controls to be rendered above and below the tabel and in which order
|
@@ -208,7 +248,6 @@ h3. Column Options
|
|
208
248
|
td_html: false, # a hash with html attributes for the cells
|
209
249
|
th_html: false, # a hash with html attributes for the header cell
|
210
250
|
filter_html: false, # a hash with html attributes for the filter cell
|
211
|
-
filter_html: false, # a hash with html attributes for the filter cell
|
212
251
|
filter: true, # false for no filter field,
|
213
252
|
# container for options_for_select
|
214
253
|
# String from options_from_collection_for_select or the like
|
@@ -225,13 +264,14 @@ h3. Column Options
|
|
225
264
|
sortable: true # if set, sorting-stuff is added to the header cell
|
226
265
|
</pre>
|
227
266
|
|
228
|
-
h3. Global settings
|
267
|
+
h3. Global settings
|
229
268
|
|
230
269
|
These settings are *not* supposed to be changed on a per-table basis. This is necessary, because the <tt>find_for_table</tt> method needs to rely on a priori information.
|
231
270
|
|
232
271
|
h4. Table Form Options
|
233
272
|
|
234
|
-
This hash contains all the information about the naming of the generated form elements. To override them, you should, in an initializer, call
|
273
|
+
This hash contains all the information about the naming of the generated form elements. To override them, you should, in an initializer, call
|
274
|
+
|
235
275
|
<pre>
|
236
276
|
Tabulatr.table_form_options(my_options_hash)
|
237
277
|
</pre>
|
@@ -251,7 +291,8 @@ This hash contains all the information about the naming of the generated form el
|
|
251
291
|
|
252
292
|
h4. Paginate options
|
253
293
|
|
254
|
-
To override these, you should, in an initializer, call
|
294
|
+
To override these, you should, in an initializer, call
|
295
|
+
|
255
296
|
<pre>
|
256
297
|
Tabulatr.paginate_options(my_options_hash)
|
257
298
|
</pre>
|
@@ -262,16 +303,16 @@ To override these, you should, in an initializer, call
|
|
262
303
|
pagesizes: [10, 20, 50]
|
263
304
|
</pre>
|
264
305
|
|
265
|
-
h2.Dependencies
|
306
|
+
h2. Dependencies
|
266
307
|
|
267
308
|
We use
|
268
|
-
* <a href="http://github.com/
|
269
|
-
* <a href="http://github.com/
|
270
|
-
* And... eh... It's an extension for
|
309
|
+
* <a href="http://github.com/provideal/whiny_hash">WhinyHash</a> to handle the options in a fail-early-manner,
|
310
|
+
* <a href="http://github.com/provideal/id_stuffer">IdStuffer</a> to compress the _remembered_ ids.
|
311
|
+
* And... eh... It's an extension for Rails 3, so it might be handy to have a version of Rails 3 and Ruby 1.9.2.
|
271
312
|
|
272
|
-
h2.Bugs
|
313
|
+
h2. Bugs
|
273
314
|
|
274
|
-
There are, definitely, roughly 1000 bugs in Tabulatr, although we do some testing (see <tt>spec
|
315
|
+
There are, definitely, roughly 1000 bugs in Tabulatr, although we do some testing (see <tt>spec/</tt>). So if you hunt them, please let me know.
|
275
316
|
|
276
317
|
h2. License
|
277
318
|
|