alchemy-json_api 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60e3517753943623b96dc3b70e5f6fe1ae0d9ffceaeeac3045935e4f49ac0c3f
4
- data.tar.gz: 2988b73369eff64ce7c99e09ca4ff0bdc2a0fb3789965d761c9264ff96b9ba48
3
+ metadata.gz: edb472c33e158bda23963966813783a459044d61d268a5ba57a45591584f7f2a
4
+ data.tar.gz: 73ebfd2b1fd491c217cfb577bc422fa558cad73f1c39c987aaac694766de6fee
5
5
  SHA512:
6
- metadata.gz: a71f11fc71138caa5a2d2337e8545a602f9ed6fd96ab7cad65b6768ecb1f321e445a16ffab7d1fbfe99cca71270286e86f38d64f4d2cbaaec31472de32a86f81
7
- data.tar.gz: d5d3e534e20c9ec196050873d7c0331f16a4a86c8a173f9f8e37ca9c1b3782e2a56740bdbcf1eb846529b37a67f81889f7b8a246f0aa4a8046d42fcd039f4d18
6
+ metadata.gz: 8393412853b2a72ee6d997cd57d208cfaeab3b9c351aa6c7a4374f7bafd322cbfa9d45d4fb1c9326e7908f1799d741d2f8365e8a85e37412f2efb8b39d040dbb
7
+ data.tar.gz: 692729353563f43124fafc2d239d4fcf204f897509953211598e6e15f8a5c6d85b8468be874dc52570bb72c80cb7f4b595fc451cca399e3e8c26893ef645e720
@@ -4,8 +4,12 @@ module Alchemy
4
4
  class LayoutPagesController < JsonApi::PagesController
5
5
  private
6
6
 
7
+ def base_page_scope
8
+ Page.all
9
+ end
10
+
7
11
  def page_scope
8
- base_page_scope.layoutpages
12
+ page_scope_with_includes.layoutpages
9
13
  end
10
14
  end
11
15
  end
@@ -42,19 +42,22 @@ module Alchemy
42
42
  end
43
43
 
44
44
  def page_scope
45
- base_page_scope.contentpages
45
+ page_scope_with_includes.contentpages
46
+ end
47
+
48
+ def page_scope_with_includes
49
+ base_page_scope.
50
+ with_language(Language.current).
51
+ preload(language: {nodes: [:parent, :page]}, all_elements: [:parent_element, :nested_elements, { contents: { essence: :ingredient_association } }])
46
52
  end
47
53
 
48
54
  def base_page_scope
49
55
  # cancancan is not able to merge our complex AR scopes for logged in users
50
56
  if can?(:edit_content, Page)
51
- pages = Page.all
57
+ Page.all
52
58
  else
53
- pages = Page.published
59
+ Page.published
54
60
  end
55
- pages.
56
- with_language(Language.current).
57
- preload(language: {nodes: [:parent, :page]}, all_elements: [:parent_element, :nested_elements, { contents: { essence: :ingredient_association } }])
58
61
  end
59
62
 
60
63
  def jsonapi_serializer_class(_resource, _is_collection)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Alchemy
3
3
  module JsonApi
4
- VERSION = "0.9.0"
4
+ VERSION = "0.9.1"
5
5
  end
6
6
  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.9.0
4
+ version: 0.9.1
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-30 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alchemy_cms