comfortable_media_surfer 3.1.2 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a85a3f0b343392faa4c1a694a01ed10f22a2bbc4a0226457ccc4477560ca3d4
4
- data.tar.gz: 637c668f4813532a4c184b7513b72497c636ff3d507d0f165b586b580cf3f536
3
+ metadata.gz: df84d4de2393538c878591357b75bd7cc61cb27a3e4eea90acb44ce21579dca1
4
+ data.tar.gz: abef451e22b1a95f3d49ca1dc28ec3d1a4c31034e2f1eda54d88f212e3c78cba
5
5
  SHA512:
6
- metadata.gz: 2f48fbc4b720a10e251a088d125a0e3e45e4539a7f2e5d697209f8ba21afa7f206a875e53702ed87f2819391886e344c32fc2cb3b170dd32a53e68c6a6b275cb
7
- data.tar.gz: 78dbda62d0289007c4cf021866585057b4448a1452f06dd1b97d718b0ce597dc98b5a31fcf54962e13662bf0da012aa2106b0a5ebad0d1406e525b9ff7e8bd1c
6
+ metadata.gz: 89445969fe9fa29f82adb27e4fe91d07270fc1a9b12eac200daa3a64fd6554acb2213ac27bb9f59215f9e978228b537181265f9c7a3089339bc1f3eea861cdc2
7
+ data.tar.gz: 0a70882548a1298e1406f46828d96f07ab90c53348e2af489bd7998d9f23ba720d563c0072df583a39898918a9301d161245d3d356703b44bbb453643ca06d50
data/CHANGELOG.md CHANGED
@@ -12,6 +12,8 @@ For all changes prior to the inception of this project, see the [Release History
12
12
 
13
13
  ## [Unreleased]
14
14
 
15
+ ## [v3.1.2] - 2025-05-26
16
+
15
17
  ### Fixed
16
18
 
17
19
  - Fixed Expand/Collapse error in Admin/Pages.
@@ -80,7 +82,8 @@ First release of `comfortable_media_surfer`. This new gem is a revival of [Comfo
80
82
 
81
83
  - Rebranded **ComfortableMexicanSofa** as **ComfortableMediaSurfer** in order to publish new gem (database table names and schema have not changed).
82
84
 
83
- [Unreleased]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.0...master
85
+ [Unreleased]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.2...master
86
+ [v3.1.2]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.1...v3.1.2
84
87
  [v3.1.1]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.0...v3.1.1
85
88
  [v3.1.0]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.0.0...v3.1.0
86
89
  [v3.0.0]: https://github.com/shakacode/comfortable-media-surfer/compare/v2.0.19...v3.0.0
@@ -0,0 +1,6 @@
1
+ [attributes]
2
+ label: Child of Child Seed Page
3
+ layout: nested
4
+
5
+ [textares content]
6
+ Child A of Child B Page Seed Content
@@ -39,15 +39,15 @@ class ComfortableMediaSurfer::Content::Renderer
39
39
  # @param [Comfy::Cms::WithFragments, nil] context
40
40
  def initialize(context)
41
41
  @context = context
42
- @depth = 0
43
42
  end
44
43
 
45
44
  # This is how we render content out. Takes context (cms page) and content
46
45
  # nodes
47
46
  # @param [Array<String, ComfortableMediaSurfer::Content::Tag>]
48
47
  # @param [Boolean] allow_erb
49
- def render(nodes, allow_erb = ComfortableMediaSurfer.config.allow_erb)
50
- if (@depth += 1) > MAX_DEPTH
48
+ # @param [Integer] depth current tag nesting position
49
+ def render(nodes, allow_erb = ComfortableMediaSurfer.config.allow_erb, depth = 0)
50
+ if depth >= MAX_DEPTH
51
51
  raise Error, 'Deep tag nesting or recursive nesting detected'
52
52
  end
53
53
 
@@ -58,7 +58,7 @@ class ComfortableMediaSurfer::Content::Renderer
58
58
  else
59
59
  tokens = tokenize(node.render)
60
60
  nodes = nodes(tokens)
61
- render(nodes, allow_erb || node.allow_erb?)
61
+ render(nodes, allow_erb || node.allow_erb?, depth.next)
62
62
  end
63
63
  end.flatten.join
64
64
  end
@@ -15,37 +15,23 @@ module ComfortableMediaSurfer::Seeds::File
15
15
  .where('active_storage_blobs.filename' => filename).references(:blob).first ||
16
16
  site.files.new
17
17
 
18
- # We need to track actual file and its attributes
19
- fresh_file = false
20
-
21
18
  if File.exist?(attrs_path = File.join(path, "_#{filename}.yml")) && fresh_seed?(file, attrs_path)
22
- fresh_file = true
23
-
24
19
  attrs = YAML.safe_load_file(attrs_path)
25
20
  category_ids = category_names_to_ids(file, attrs.delete('categories'))
26
21
  file.attributes = attrs.merge(
27
22
  category_ids: category_ids
28
23
  )
24
+ save(file, file_path)
29
25
  end
30
26
 
31
27
  if fresh_seed?(file, file_path)
32
- fresh_file = true
33
-
34
- file_handler = File.open(file_path)
35
- file.file = {
36
- io: file_handler,
37
- filename: filename,
38
- content_type: MimeMagic.by_magic(file_handler)
39
- }
40
- end
41
-
42
- if fresh_file
43
- if file.save
44
- message = "[CMS SEEDS] Imported File \t #{file_path}"
45
- ComfortableMediaSurfer.logger.info(message)
46
- else
47
- message = "[CMS SEEDS] Failed to import File \n#{file.errors.inspect}"
48
- ComfortableMediaSurfer.logger.warn(message)
28
+ File.open(file_path) do |file_handler|
29
+ file.file = {
30
+ io: file_handler,
31
+ filename: filename,
32
+ content_type: MimeMagic.by_magic(file_handler)
33
+ }
34
+ save(file, file_path)
49
35
  end
50
36
  end
51
37
 
@@ -55,5 +41,15 @@ module ComfortableMediaSurfer::Seeds::File
55
41
  # cleaning up
56
42
  site.files.where('id NOT IN (?)', seed_ids).destroy_all
57
43
  end
44
+
45
+ private
46
+
47
+ def save(file, path)
48
+ if file.save
49
+ ComfortableMediaSurfer.logger.info("[CMS SEEDS] Imported File \t #{path}")
50
+ else
51
+ ComfortableMediaSurfer.logger.warn("[CMS SEEDS] Failed to import File \n#{file.errors.inspect}")
52
+ end
53
+ end
58
54
  end
59
55
  end
@@ -29,7 +29,7 @@ module ComfortableMediaSurfer::Seeds::Page
29
29
  # setting page record
30
30
  page =
31
31
  if parent.present?
32
- child = site.pages.where(slug: slug).first_or_initialize
32
+ child = site.pages.where(slug: slug, parent_id: parent.id).first_or_initialize
33
33
  child.parent = parent
34
34
  child
35
35
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ComfortableMediaSurfer
4
- VERSION = '3.1.2'
4
+ VERSION = '3.1.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfortable_media_surfer
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Khabarov
@@ -556,6 +556,7 @@ files:
556
556
  - db/cms_seeds/sample-site/layouts/default/content.html
557
557
  - db/cms_seeds/sample-site/layouts/default/nested/content.html
558
558
  - db/cms_seeds/sample-site/pages/index/child_a/content.html
559
+ - db/cms_seeds/sample-site/pages/index/child_b/child_a/content.html
559
560
  - db/cms_seeds/sample-site/pages/index/child_b/content.html
560
561
  - db/cms_seeds/sample-site/pages/index/cms logo.png
561
562
  - db/cms_seeds/sample-site/pages/index/content.es.html