table_sortable 1.0.0.pre.alpha.13 → 1.0.0.pre.alpha.14
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.
- checksums.yaml +4 -4
- data/lib/table_sortable/column.rb +1 -1
- data/lib/table_sortable/core.rb +9 -0
- data/lib/table_sortable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7a82828045598ce128b6a87cf868658298439bb
|
4
|
+
data.tar.gz: c0259c3b6d5656afcd0ee912c632e3e0a03e3f9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8cc0ea7a17b998735c303b081e43f47393c20ba7014d3912c570a7f6811a5d2a0e231fff76631c2a891c2b9769813bc3a3ec0e16fd1ab0dae6433a98c50282f
|
7
|
+
data.tar.gz: 0c748c81881144e60ce79385a992c6b339671124f48123b98ccfba14a7d3b7bd2ad6e0646cc4579b942c4a0480738f3d33b0c7f93dd0b1f0deddb76d696eb5a3
|
@@ -16,7 +16,7 @@ module TableSortable
|
|
16
16
|
template = options[:template] || col_name
|
17
17
|
column_options = options[:options] || {}
|
18
18
|
includes = options[:includes] || []
|
19
|
-
scope = options[:scope]
|
19
|
+
scope = options[:scope].is_a?(Symbol) ? (-> { send(options[:scope]) }) : options[:scope]
|
20
20
|
visible = options[:visible].nil? ? true : options[:visible]
|
21
21
|
|
22
22
|
@name = col_name.to_sym
|
data/lib/table_sortable/core.rb
CHANGED
@@ -68,6 +68,15 @@ module TableSortable
|
|
68
68
|
scope
|
69
69
|
end
|
70
70
|
|
71
|
+
def include_and_scope(scope)
|
72
|
+
includes = columns.map{|rc| rc.includes}.flatten.compact.uniq
|
73
|
+
the_scope = scope.includes(includes)
|
74
|
+
columns.map{|rc| rc.scope}.flatten.compact.uniq.each do |scope_proc|
|
75
|
+
the_scope = the_scope.instance_exec(&scope_proc)
|
76
|
+
end
|
77
|
+
the_scope
|
78
|
+
end
|
79
|
+
|
71
80
|
def initialize_table_sortable
|
72
81
|
@columns = TableSortable::Columns.new
|
73
82
|
define_column_offset 0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_sortable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.alpha.
|
4
|
+
version: 1.0.0.pre.alpha.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oded Davidov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|