alchemy-json_api 0.1.0 → 0.2.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/base_controller.rb +1 -0
- data/app/controllers/alchemy/json_api/pages_controller.rb +12 -1
- data/app/serializers/alchemy/json_api/element_serializer.rb +1 -1
- data/app/serializers/alchemy/json_api/node_serializer.rb +1 -1
- data/lib/alchemy/json_api/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf27f9f29046c7ad0e2d417d3c9cca5e0d58d59c7bc729119d76f37adeaa4b28
|
4
|
+
data.tar.gz: 697deefd22185ca5df6811f9687129e34c33e445feacae02f71fd045f5e96830
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d6fc09988a259d084f4e34440985dbe85122c191342bf7b4b722b559f1e3d9500ffd7ab3e6e4c32748a946305ca5b96fc0ff13fcb9236d73626b57116e8bf70
|
7
|
+
data.tar.gz: 139fc4a4b1e17957dd1cddad50a6f26601e773adb5b83b41a0fb2234cddc58d6f9aa24f24000f00607fa64cee0d3e7304105f396204c9c72fcd50c500e1d3460
|
@@ -8,7 +8,9 @@ module Alchemy
|
|
8
8
|
allowed = [:page_layout]
|
9
9
|
|
10
10
|
jsonapi_filter(page_scope, allowed) do |filtered|
|
11
|
-
|
11
|
+
jsonapi_paginate(filtered.result) do |paginated|
|
12
|
+
render jsonapi: paginated
|
13
|
+
end
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
@@ -18,6 +20,15 @@ module Alchemy
|
|
18
20
|
|
19
21
|
private
|
20
22
|
|
23
|
+
def jsonapi_meta(pages)
|
24
|
+
pagination = jsonapi_pagination_meta(pages)
|
25
|
+
|
26
|
+
{
|
27
|
+
pagination: pagination.presence,
|
28
|
+
total: page_scope.count
|
29
|
+
}.compact
|
30
|
+
end
|
31
|
+
|
21
32
|
def load_page
|
22
33
|
@page = load_page_by_id || load_page_by_urlname || raise(ActiveRecord::RecordNotFound)
|
23
34
|
end
|
@@ -8,7 +8,7 @@ module Alchemy::JsonApi
|
|
8
8
|
:updated_at,
|
9
9
|
)
|
10
10
|
attribute :element_type, &:name
|
11
|
-
belongs_to :parent_element, record_type: :element
|
11
|
+
belongs_to :parent_element, record_type: :element, serializer: self
|
12
12
|
|
13
13
|
belongs_to :page
|
14
14
|
has_many :essences, polymorphic: true do |element|
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
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.2.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: 2020-
|
11
|
+
date: 2020-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: alchemy_cms
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '5.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fast_jsonapi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|