mongoid_data_table 0.1.2 → 0.1.3
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.
@@ -7,9 +7,11 @@ module Mongoid
|
|
7
7
|
end
|
8
8
|
|
9
9
|
module ClassMethods
|
10
|
-
def for_data_table controller, fields, search_fields=nil, &
|
10
|
+
def for_data_table controller, fields, search_fields=nil, explicit_block=nil, &implicit_block
|
11
11
|
params = controller.params
|
12
12
|
search_fields ||= fields
|
13
|
+
block = (explicit_block or implicit_block)
|
14
|
+
|
13
15
|
objects = self.where(_where_conditions params[:sSearch], search_fields).
|
14
16
|
order_by(_order_by_fields params, fields).
|
15
17
|
paginate :page => _page(params),
|
@@ -29,7 +31,7 @@ module Mongoid
|
|
29
31
|
block[object].map do |string|
|
30
32
|
controller.instance_eval %{
|
31
33
|
Rails.logger.silence do
|
32
|
-
render_to_string :inline =>
|
34
|
+
render_to_string :inline => %Q|#{string}|, :locals => {:#{self.name.downcase} => object}
|
33
35
|
end
|
34
36
|
}
|
35
37
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_data_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jason Dew
|