alchemy_cms 4.0.4 → 4.0.5

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: 4789f71b73e8e1c28df8895f5fd37a5b90871f18454aa06e4a43b1d7449ecdfb
4
- data.tar.gz: df714e6c16fef1e84749c65c3a43b2105a45d90d11a90f633bef27980766c6c9
3
+ metadata.gz: 35a5066f5fee296b67dd64a9d8ddd912a83a4197c4a0c101e9c4ede1973f1af2
4
+ data.tar.gz: 36bebc442b75517a7f39e15fb6bc7a80ec3f03c1a126a220dfef6dbc4c55e39c
5
5
  SHA512:
6
- metadata.gz: '08acde8f5cde62a637166deb21acf95dc5496be094aaf6655403e386f4b1a8b3796ca9b45376c9013a13673a0758159d151590208350da4fec5bbca544b217c4'
7
- data.tar.gz: 2722b7268f01d730a2ae343189c5e145b786ae39dfdce80d61889776870c3e4badace52e97a888b483e236229f8a19a86b10dc8a8914a329c1213d51154053ea
6
+ metadata.gz: 3e7de480331dd62d6a65cd477ad95d9e3648e693a6dcd7577ba6faa574204bd9a4fcb66c9b0c3c2599cbb74209f3ae18ff8866ab14c7e59b59fc2d6f3700ec3b
7
+ data.tar.gz: dbe2c4290d20bb68218f6628165086d3747a5cb6153b891c6618ed4789fae15e1fca231a6b5e6fd78357d20db730e6fbd83b1e845a5099e98fb5a160b03b98f9
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.0.5 (unreleased)
4
+
5
+ - Do not cache sitemap in Turbolinks [#1463](https://github.com/AlchemyCMS/alchemy_cms/pull/1463) ([tvdeyen](https://github.com/tvdeyen))
6
+ - Skip folded deeper levels when rendering page tree [#1324](https://github.com/AlchemyCMS/alchemy_cms/pull/1324) ([pascalj](https://github.com/pascalj))
7
+
3
8
  ## 4.0.4 (2018-09-05)
4
9
 
5
10
  - Allow Kaminari 1.x [#1467](https://github.com/AlchemyCMS/alchemy_cms/pull/1467) ([tvdeyen](https://github.com/tvdeyen))
@@ -15,5 +15,10 @@ module Alchemy
15
15
  belongs_to :page, required: true
16
16
  belongs_to :user, required: true,
17
17
  class_name: Alchemy.user_class_name
18
+
19
+ def self.folded_for_user(user)
20
+ return none unless Alchemy.user_class < ActiveRecord::Base
21
+ where(user: user, folded: true)
22
+ end
18
23
  end
19
24
  end
@@ -10,23 +10,24 @@ module Alchemy
10
10
  tree = []
11
11
  path = [{id: object.parent_id, children: tree}]
12
12
  page_list = object.self_and_descendants
13
- skip_branch = false
14
13
  base_level = object.level - 1
14
+ # Load folded pages in advance
15
+ folded_user_pages = FoldedPage.folded_for_user(opts[:user]).pluck(:page_id)
16
+ folded_depth = Float::INFINITY
15
17
 
16
18
  page_list.each_with_index do |page, i|
17
19
  has_children = page_list[i + 1] && page_list[i + 1].parent_id == page.id
18
- folded = has_children && page.folded?(opts[:user])
20
+ folded = has_children && folded_user_pages.include?(page.id)
19
21
 
20
- if skip_branch
21
- next if page.parent_id == path.last[:children].last[:id]
22
-
23
- skip_branch = false
22
+ if page.depth > folded_depth
23
+ next
24
+ else
25
+ folded_depth = Float::INFINITY
24
26
  end
25
27
 
26
- # Do not walk my children if I'm folded and you don't need to have the
27
- # full tree.
28
+ # If this page is folded, skip all pages that are on a higher level (further down the tree).
28
29
  if folded && !opts[:full]
29
- skip_branch = true
30
+ folded_depth = page.depth
30
31
  end
31
32
 
32
33
  if page.parent_id != path.last[:id]
@@ -1,3 +1,7 @@
1
+ <% content_for :javascript_includes do %>
2
+ <meta name="turbolinks-cache-control" content="no-cache">
3
+ <% end %>
4
+
1
5
  <% content_for :toolbar do %>
2
6
  <div class="toolbar_buttons">
3
7
  <%= render 'alchemy/admin/partials/site_select' %>
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "4.0.4"
4
+ VERSION = "4.0.5"
5
5
 
6
6
  def self.version
7
7
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.4
4
+ version: 4.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2018-09-05 00:00:00.000000000 Z
16
+ date: 2018-09-17 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: active_model_serializers