wice_grid 3.6.0.pre3 → 3.6.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +95 -37
- data/README.md +9 -10
- data/lib/wice_grid.rb +0 -4
- data/vendor/assets/stylesheets/wice_grid.scss +0 -3
- data/wice_grid.gemspec +1 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51966eb69a24d7359b29c5444a4d3ee0ff2f9adc
|
4
|
+
data.tar.gz: 269e2b5b4feff23be4cb2bce0d91cbd5c286a71a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 574f2658fbba701f1e961485471021f298f52bdee520d0da5a84938a29aac5fbcd8748b9a1e5d450bf8b9863622e5bec1c5884bc7a8000850c758cb35ed894f3
|
7
|
+
data.tar.gz: 3942adfa077d76cf601f0af82b840e28f9d29a29180a93e04b55fcc1cbeee4c507ea21dc07fea766899b96f14231dc65b8c91e171d09c393a9fb435a3fb2222a
|
data/CHANGELOG.md
CHANGED
@@ -1,68 +1,126 @@
|
|
1
1
|
# 3.6.0
|
2
2
|
|
3
|
+
## New API For Joined Tables
|
3
4
|
|
4
|
-
|
5
|
-
Instead there is a number of filter types:
|
5
|
+
Before 3.6.0 `:model_class` was used in column definitions for columns from joined tables.
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
* jquery_datepicker
|
10
|
-
* bootstrap_datepicker
|
7
|
+
In 3.6.0 the API has changed to use associations.
|
8
|
+
If, say, a `Task` `belongs_to` a `Priority`, a column definition should specify this association using `:assoc`:
|
11
9
|
|
12
|
-
|
10
|
+
```ruby
|
11
|
+
g.column name: 'Priority', attribute: 'name', assoc: :priority do |task|
|
12
|
+
task.priority.name if task.priority
|
13
|
+
end
|
14
|
+
```
|
13
15
|
|
16
|
+
If, say, a `Task` `belongs_to` a `Project`, and a `Project` belongs to a `Customer`,
|
17
|
+
`assoc:` should be a list of these associations:
|
14
18
|
|
15
|
-
|
19
|
+
```ruby
|
20
|
+
g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer] do |task|
|
21
|
+
task.project.customer.name if task.project && task.project.customer
|
22
|
+
end
|
23
|
+
```
|
16
24
|
|
17
|
-
column model: 'ModelClass' do
|
18
25
|
|
19
|
-
|
26
|
+
## Blockless Columns For Joined Tables
|
20
27
|
|
21
|
-
|
28
|
+
Blockless columns used to only work for the main model.
|
29
|
+
Now they can be used for joined tables, too.
|
22
30
|
|
23
|
-
|
31
|
+
Instead of
|
24
32
|
|
25
|
-
|
33
|
+
```ruby
|
34
|
+
g.column name: 'Priority', attribute: 'name', assoc: :priority do |task|
|
35
|
+
task.priority.name if task.priority
|
36
|
+
end
|
37
|
+
```
|
26
38
|
|
27
|
-
|
39
|
+
you can write
|
28
40
|
|
29
|
-
|
41
|
+
```ruby
|
42
|
+
g.column name: 'Priority', attribute: 'name', assoc: :priority
|
43
|
+
```
|
30
44
|
|
31
|
-
|
32
|
-
* CSS is not copied to the app. It is included by @import "wice_grid" in your application.scss.
|
45
|
+
Instead of
|
33
46
|
|
34
|
-
|
47
|
+
```ruby
|
48
|
+
g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer] do |task|
|
49
|
+
task.project.customer.name if task.project && task.project.customer
|
50
|
+
end
|
51
|
+
```
|
35
52
|
|
36
|
-
|
53
|
+
you can write
|
37
54
|
|
38
|
-
|
39
|
-
|
40
|
-
|
55
|
+
```ruby
|
56
|
+
g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer]
|
57
|
+
```
|
41
58
|
|
42
|
-
you can write
|
43
59
|
|
44
|
-
|
60
|
+
## New Way To Choose Datepickers
|
45
61
|
|
46
|
-
|
62
|
+
Before 3.6.0 to choose a datepicker type we used `:helper_style` in column definitions and `Wice::Defaults:HELPER_STYLE` in the configuration_file.
|
63
|
+
|
64
|
+
In 3.6.0 `:helper_style` and `Wice::Defaults:HELPER_STYLE` are gone.
|
65
|
+
|
66
|
+
Now each datepicker is simply a separate filter type, and to pick a datepicker we can use `:filter_type`, just like other filter types are chosen.
|
67
|
+
|
68
|
+
Filter types for dates and datetimes are
|
69
|
+
|
70
|
+
* `:rails_datetime_helper`
|
71
|
+
* `:rails_date_helper`
|
72
|
+
* `:jquery_datepicker`
|
73
|
+
* `:bootstrap_datepicker`
|
74
|
+
|
75
|
+
Example:
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
g.column name: 'Updated', attribute: 'updated_at', filter_type: :rails_datetime_helper do |task|
|
79
|
+
task.updated_at.to_s(:db)
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
Default filter types for date and datetime columns are set by `Wice::Defaults:DEFAULT_FILTER_FOR_DATE` and `Wice::Defaults:DEFAULT_FILTER_FOR_DATETIME`.
|
84
|
+
|
85
|
+
|
86
|
+
## Icons
|
87
|
+
|
88
|
+
There are no more icons inside of the gem. Instead, [Font Awesome](https://github.com/FortAwesome/font-awesome-sass) is used.
|
89
|
+
|
90
|
+
## CSS
|
91
|
+
|
92
|
+
CSS is no longer copied to the applications asset directory. Instead the user is supposed to add
|
93
|
+
|
94
|
+
```sass
|
95
|
+
@import "wice_grid";
|
96
|
+
@import "font-awesome-sprockets";
|
97
|
+
@import "font-awesome";
|
98
|
+
```
|
99
|
+
|
100
|
+
to `application.scss`.
|
101
|
+
|
102
|
+
`font-awesome-sass` is not a dependency of WiceGrid in case you decide to style WiceGrid icons differently,
|
103
|
+
so you need to add it explicitly to your Gemfile:
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
gem 'font-awesome-sass', '~> 4.3'
|
107
|
+
```
|
47
108
|
|
48
|
-
g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer] do |task|
|
49
|
-
task.project.customer.name if task.project && task.project.customer
|
50
|
-
end
|
51
109
|
|
52
|
-
|
110
|
+
## CI_LIKE
|
53
111
|
|
54
|
-
|
112
|
+
Setting a configuration value in Wice::Defaults::STRING_MATCHING_OPERATORS to CI_LIKE will result in the following SQL generated for string filters:
|
55
113
|
|
56
|
-
|
114
|
+
```sql
|
115
|
+
UPPER(table.field) LIKE UPPER(?)"
|
116
|
+
```
|
57
117
|
|
58
|
-
Setting a configuration value in Wice::Defaults::STRING_MATCHING_OPERATORS to CI_LIKE will result in
|
59
|
-
the following SQL:
|
60
118
|
|
61
|
-
|
119
|
+
## USE_DEFAULT_SCOPE
|
62
120
|
|
63
|
-
|
64
|
-
|
65
|
-
|
121
|
+
New `USE_DEFAULT_SCOPE` configuration value from @nathanvda.
|
122
|
+
By default ActiveRecord calls are always executed inside `Model.unscoped{}`.
|
123
|
+
Setting `USE_DEFAULT_SCOPE` to `true` will use the default scope for all queries.
|
66
124
|
|
67
125
|
|
68
126
|
# 3.5.0
|
data/README.md
CHANGED
@@ -93,12 +93,12 @@ WARNING: Since 3.2.pre2 WiceGrid is not compatible with `will_paginate` because
|
|
93
93
|
|
94
94
|
Add the following to your Gemfile:
|
95
95
|
|
96
|
-
```
|
97
|
-
gem
|
98
|
-
gem
|
96
|
+
```ruby
|
97
|
+
gem "wice_grid", '3.6.0.pre4'
|
98
|
+
gem 'font-awesome-sass', '~> 4.3'
|
99
99
|
```
|
100
100
|
|
101
|
-
and run the `bundle` command.
|
101
|
+
and run the `bundle` command. `font-awesome-sass` is not a dependency of WiceGrid in case you decide to style WiceGrid icons differently.
|
102
102
|
|
103
103
|
Run the generator:
|
104
104
|
|
@@ -109,7 +109,6 @@ rails g wice_grid:install
|
|
109
109
|
This adds the following files:
|
110
110
|
* config/initializers/wice_grid_config.rb
|
111
111
|
* config/locales/wice_grid.yml
|
112
|
-
* app/assets/stylesheets/wice_grid.scss
|
113
112
|
|
114
113
|
|
115
114
|
Require WiceGrid javascript in your js index file:
|
@@ -144,21 +143,21 @@ Here is `application.js` if [Bootstrap Datepicker](https://github.com/Nerian/boo
|
|
144
143
|
//= require_tree .
|
145
144
|
```
|
146
145
|
|
147
|
-
Require WiceGrid CSS in your `application.scss`:
|
146
|
+
Require WiceGrid and [Font Awesome](http://fortawesome.github.io/Font-Awesome/) CSS in your `application.scss`:
|
148
147
|
|
149
148
|
```
|
150
149
|
@import "wice_grid";
|
150
|
+
@import "font-awesome-sprockets";
|
151
|
+
@import "font-awesome";
|
151
152
|
```
|
152
153
|
|
153
154
|
This will provide very basic styles, not specifying exactly how the table should look like, but if
|
154
155
|
the application uses Twitter Bootstrap, the markup generated by WiceGrid will have correct classes and
|
155
156
|
will fit nicely.
|
156
157
|
|
157
|
-
WiceGrid uses icons from [Font Awesome](http://fortawesome.github.io/Font-Awesome/)
|
158
|
+
WiceGrid uses icons from [Font Awesome](http://fortawesome.github.io/Font-Awesome/).
|
158
159
|
|
159
|
-
Should you decide to write you own styles for WiceGrid,
|
160
|
-
from the plugin into `app/assets/stylesheets`, rename it to avoid loading name clashes, and replace
|
161
|
-
`@import "wice_grid";` by a directive to load your own SASS file.
|
160
|
+
Should you decide to write you own styles for WiceGrid, you can just remove these imports and write your own styles.
|
162
161
|
|
163
162
|
|
164
163
|
## Basics
|
data/lib/wice_grid.rb
CHANGED
@@ -23,10 +23,6 @@ require 'wice/columns/common_js_date_datetime_conditions_generator_mixin.rb'
|
|
23
23
|
require 'wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb'
|
24
24
|
require 'kaminari.rb'
|
25
25
|
|
26
|
-
# unless Kernel.const_defined?(:FontAwesome)
|
27
|
-
# gem 'font-awesome-sass'
|
28
|
-
# require 'font-awesome-sass.rb'
|
29
|
-
# end
|
30
26
|
|
31
27
|
ActionController::Base.send(:helper_method, :wice_grid_custom_filter_params)
|
32
28
|
|
data/wice_grid.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'wice_grid'
|
4
|
-
s.version = '3.6.0.
|
4
|
+
s.version = '3.6.0.pre4'
|
5
5
|
s.authors = ['Yuri Leikind']
|
6
6
|
s.email = ['yuri.leikind@gmail.com']
|
7
7
|
s.homepage = 'https://github.com/leikind/wice_grid'
|
@@ -20,10 +20,6 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency 'kaminari', ['~> 0.16']
|
21
21
|
s.add_dependency 'coffee-rails', ['> 3.2']
|
22
22
|
|
23
|
-
# s.add_dependency 'font-awesome-sass', ['~> 4.3']
|
24
|
-
# s.add_runtime_dependency 'sass', '~> 3.2'
|
25
|
-
# s.add_development_dependency 'sass-rails'
|
26
|
-
|
27
23
|
s.add_development_dependency('rake', '~> 10.1')
|
28
24
|
s.add_development_dependency('rspec', '~> 3.2.0')
|
29
25
|
|