alchemy-json_api 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/alchemy/json_api/layout_pages_controller.rb +1 -1
- data/app/controllers/alchemy/json_api/pages_controller.rb +1 -1
- data/app/models/alchemy/json_api/element.rb +2 -2
- data/app/models/alchemy/json_api/page.rb +8 -6
- data/lib/alchemy/json_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec8c154e4f6ac5ba72d6d96b39a60475acf9b0d411d3a4e2d34c81fc271d1489
|
4
|
+
data.tar.gz: c0cc273e02b2038e5462428fa1f7d0960be37ccf8225abd76af7343ca4f76ec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f0ebd08816a2d97347555eaf114735b429ec7c1e2592f9c1ff0b652be9f0799c782489987eac5d3142d5f5246ac6f02375460d62931ef4cfcca4f8a3e9ad809
|
7
|
+
data.tar.gz: '08c7a5e5570c995b3495844bcceb9a145173cb3e224fce0051a5b672eae408aee58850e1b612fb25051c0896c571365481daabe28d7e4766b62742e1b0363e34'
|
@@ -50,7 +50,7 @@ module Alchemy
|
|
50
50
|
def page_scope_with_includes
|
51
51
|
base_page_scope.
|
52
52
|
with_language(Language.current).
|
53
|
-
preload(language: { nodes: [:parent, :page] }, all_elements: { contents: { essence: :ingredient_association } })
|
53
|
+
preload(language: { nodes: [:parent, :page, :children] }, all_elements: { contents: { essence: :ingredient_association } })
|
54
54
|
end
|
55
55
|
|
56
56
|
def base_page_scope
|
@@ -12,14 +12,14 @@ module Alchemy
|
|
12
12
|
scope :available, -> { where(public: true).where.not(position: nil) }
|
13
13
|
|
14
14
|
def parent_element
|
15
|
-
page.
|
15
|
+
page.all_elements.detect do |element|
|
16
16
|
element.id == parent_element_id
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def nested_elements
|
21
21
|
@_nested_elements ||= begin
|
22
|
-
page.
|
22
|
+
page.all_elements.select do |element|
|
23
23
|
element.parent_element_id == id
|
24
24
|
end
|
25
25
|
end
|
@@ -23,17 +23,13 @@ module Alchemy
|
|
23
23
|
# The top level public, non-fixed elements of this page that - if present -
|
24
24
|
# contains their nested_elements.
|
25
25
|
def elements
|
26
|
-
@_elements ||=
|
27
|
-
!element.fixed? || element.parent_element_id.nil?
|
28
|
-
end
|
26
|
+
@_elements ||= first_level_elements.reject(&:fixed?)
|
29
27
|
end
|
30
28
|
|
31
29
|
# The top level public, fixed elements of this page that - if present -
|
32
30
|
# contains their nested_elements.
|
33
31
|
def fixed_elements
|
34
|
-
@_fixed_elements ||=
|
35
|
-
element.fixed? || element.parent_element_id.nil?
|
36
|
-
end
|
32
|
+
@_fixed_elements ||= first_level_elements.select(&:fixed?)
|
37
33
|
end
|
38
34
|
|
39
35
|
def element_ids
|
@@ -43,6 +39,12 @@ module Alchemy
|
|
43
39
|
def fixed_element_ids
|
44
40
|
@_fixed_element_ids ||= fixed_elements.map(&:id)
|
45
41
|
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def first_level_elements
|
46
|
+
@_first_level_elements ||= all_elements.reject(&:parent_element_id)
|
47
|
+
end
|
46
48
|
end
|
47
49
|
end
|
48
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alchemy-json_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Meyerhoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: alchemy_cms
|