facet 0.16.3 → 0.17.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/facet/concerns/collection.rb +1 -1
- data/lib/facet/concerns/core.rb +7 -2
- data/lib/facet/concerns/record.rb +5 -1
- data/lib/facet/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 040065d48def1cb14c2df4ac357a6f0b94376cc643b408e9a7582a5d99cfd2dd
|
4
|
+
data.tar.gz: 47689ae773aef5787988305704dc23f9417a7c9b47bab63b0cfa9b24c3b67a49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 833a9ab8ca87f34851cfb22e8b74ceefa0bf189aefc3d99ae450be961ca6eaa500e7dc8ecc51b06015954a65bf65c4d83befb99f944c967bb1b24ca01b4839e9
|
7
|
+
data.tar.gz: 5f1f2991e1cb887ef91679ca1c3663d00256523c4ec1f840815390389c4d329c908197ab958c2ee696e1281c9376f26312416d3b6a9759d413084e957d4dee46
|
data/lib/facet/concerns/core.rb
CHANGED
@@ -6,13 +6,14 @@ module Facet
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
8
|
included do
|
9
|
-
attr_reader :current_page, :filter_by, :sort_by
|
9
|
+
attr_reader :current_page, :filter_by, :sort_by, :source
|
10
10
|
end
|
11
11
|
|
12
|
-
def initialize(current_page: nil, filter_by: nil, sort_by: nil, all: false, paginate: true)
|
12
|
+
def initialize(current_page: nil, filter_by: nil, sort_by: nil, all: false, paginate: true, source: nil)
|
13
13
|
@current_page = page_for(current_page, paginate)
|
14
14
|
@filter_by = filter_for(filter_by, all)
|
15
15
|
@sort_by = sort_for(sort_by)
|
16
|
+
@source = source
|
16
17
|
end
|
17
18
|
|
18
19
|
def paginated?
|
@@ -27,6 +28,10 @@ module Facet
|
|
27
28
|
sort_by.present?
|
28
29
|
end
|
29
30
|
|
31
|
+
def source?
|
32
|
+
source.present?
|
33
|
+
end
|
34
|
+
|
30
35
|
private
|
31
36
|
|
32
37
|
def page_for(current_page, paginate)
|
@@ -6,7 +6,7 @@ module Facet
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
8
|
included do
|
9
|
-
delegate :record_class, :record_scope, to: :class
|
9
|
+
delegate :record_class, :record_scope, :self_scope, to: :class
|
10
10
|
end
|
11
11
|
|
12
12
|
class_methods do
|
@@ -14,6 +14,10 @@ module Facet
|
|
14
14
|
name.chomp("Facet").constantize
|
15
15
|
end
|
16
16
|
|
17
|
+
def self_scope
|
18
|
+
record_class.model_name.collection.to_sym
|
19
|
+
end
|
20
|
+
|
17
21
|
def record_scope
|
18
22
|
scoped? ? @record_scope : :all
|
19
23
|
end
|
data/lib/facet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Garside
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.17.4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.17.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: short_circu_it
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.17.4
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.17.4
|
55
55
|
description: Create cacheable collections of filtered, sorted, and paginated ActiveRecord
|
56
56
|
objects
|
57
57
|
email:
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
|
-
rubygems_version: 3.0.
|
97
|
+
rubygems_version: 3.0.6
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: A filterable, sortable, pageable, and Rails cacheable ActiveRecord::Relation
|