panda_cms 0.6.1 → 0.6.3

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: 3676f4753c5561f12abfaddd4d9e96a349de95c1ecee5126d5bf093002c4e4bd
4
- data.tar.gz: 879ff146c2c451565ae6983fb4ce908c179e52b13b1084348609a60868be855f
3
+ metadata.gz: 96666fe5a080a1428ca44e73fef768066b869579efdbd156b95ab448b2c58825
4
+ data.tar.gz: f5c6fc6a7d62ffb4d02c0589b9dd0450f1e88df2711b0ba76abcd5f82c1ad005
5
5
  SHA512:
6
- metadata.gz: 9300786a0c99d6b14220b02e5770449b81ac0dcb1f92eaa1ae38d482687355e1066ae33b33f4ea5ad8831e4aefb7fabe9c1b676c78d0b5ff1eea4697bbf68fb6
7
- data.tar.gz: 780ea144e8034c04b0ed8af45555e310c22592bfc387bddb974d7be0be5be4eab87774eb262c1f8069fdb7eba29b73c8e1923057b93f3ae65e41e7acf2be5094
6
+ metadata.gz: d0f84177176aa3119defd218c40712c81f872f362578bcc69a8e531ff8d24350ab7f177fd77614961ff1d1349dcdf5a012c99113229a5649d945c2fdbb6aaf41
7
+ data.tar.gz: d3523315875e2b925d9b10a1a6341c5bd381fd0ddd73513b7af5c2051701193159799f0f6219ba5b80e226059f33c3b064de5ecaeb65359826f815e2e1e51db7
@@ -15,15 +15,16 @@ module PandaCms
15
15
  def create_templates
16
16
  # Templates
17
17
  initial_templates = [
18
- {name: "Homepage", file_path: "layouts/homepage", max_uses: 1},
18
+ {name: "Homepage", file_path: "layouts/homepage"},
19
19
  {name: "Page", file_path: "layouts/page"}
20
20
  ]
21
21
 
22
22
  initial_templates.each do |template|
23
23
  key = template[:name].downcase.to_sym
24
- @templates[key] = PandaCms::Template.find_or_create_by!(template)
24
+ @templates[key] = PandaCms::Template.find_or_create_by(template)
25
25
  end
26
26
 
27
+ @templates[:homepage].update(max_uses: 1)
27
28
  @templates
28
29
  end
29
30
 
@@ -32,9 +33,9 @@ module PandaCms
32
33
  #
33
34
  # @return [Hash] A hash containing the created pages
34
35
  def create_pages
35
- @pages[:home] = PandaCms::Page.find_or_create_by!({path: "/", title: "Home", template: @templates[:homepage]})
36
- @pages[:about] = PandaCms::Page.find_or_create_by!({path: "/about", title: "About", template: @templates[:page], parent: @pages[:home]})
37
- @pages[:terms] = PandaCms::Page.find_or_create_by!({path: "/terms-and-conditions", title: "Terms & Conditions", template: @templates[:page], parent: @pages[:home], status: "hidden"})
36
+ @pages[:home] = PandaCms::Page.find_or_create_by({path: "/", title: "Home", template: @templates[:homepage]})
37
+ @pages[:about] = PandaCms::Page.find_or_create_by({path: "/about", title: "About", template: @templates[:page], parent: @pages[:home]})
38
+ @pages[:terms] = PandaCms::Page.find_or_create_by({path: "/terms-and-conditions", title: "Terms & Conditions", template: @templates[:page], parent: @pages[:home], status: "hidden"})
38
39
 
39
40
  PandaCms::Page.reset_column_information
40
41
  PandaCms::Page.rebuild!
@@ -48,8 +49,8 @@ module PandaCms
48
49
  # @return [Hash] A hash containing the created menus
49
50
  def create_menus
50
51
  @menus = {}
51
- @menus[:main] = PandaCms::Menu.find_or_create_by!(name: "Main Menu")
52
- @menus[:footer] = PandaCms::Menu.find_or_create_by!(name: "Footer Menu")
52
+ @menus[:main] = PandaCms::Menu.find_or_create_by(name: "Main Menu")
53
+ @menus[:footer] = PandaCms::Menu.find_or_create_by(name: "Footer Menu")
53
54
 
54
55
  # Automatically create main menu from homepage
55
56
  unless @pages[:home].nil?
@@ -56,9 +56,6 @@ module PandaCms
56
56
  get "/*path", to: "panda_cms/pages#show", as: :panda_cms_page
57
57
  root to: "panda_cms/pages#root"
58
58
  end
59
-
60
- # Ensure we don't have any missing blocks from new templates
61
- PandaCms::Template.generate_missing_blocks
62
59
  end
63
60
 
64
61
  # Add the migrations to the main app
@@ -70,6 +67,34 @@ module PandaCms
70
67
  end
71
68
  end
72
69
 
70
+ initializer "#{engine_name}.backtrace_cleaner" do |app|
71
+ engine_root_regex = Regexp.escape(root.to_s + File::SEPARATOR)
72
+
73
+ # Clean those ERB lines, we don't need the internal autogenerated
74
+ # ERB method, what we do need (line number in ERB file) is already there
75
+ Rails.backtrace_cleaner.add_filter do |line|
76
+ line.sub(/(\.erb:\d+):in `__.*$/, "\\1")
77
+ end
78
+
79
+ # Remove our own engine's path prefix, even if it's
80
+ # being used from a local path rather than the gem directory.
81
+ Rails.backtrace_cleaner.add_filter do |line|
82
+ line.sub(/^#{engine_root_regex}/, "#{engine_name} ")
83
+ end
84
+
85
+ # Keep Umlaut's own stacktrace in the backtrace -- we have to remove Rails
86
+ # silencers and re-add them how we want.
87
+ Rails.backtrace_cleaner.remove_silencers!
88
+
89
+ # Silence what Rails silenced, UNLESS it looks like
90
+ # it's from Umlaut engine
91
+ Rails.backtrace_cleaner.add_silencer do |line|
92
+ (line !~ Rails::BacktraceCleaner::APP_DIRS_PATTERN) &&
93
+ (line !~ /^#{engine_root_regex}/) &&
94
+ (line !~ /^#{engine_name} /)
95
+ end
96
+ end
97
+
73
98
  # Set up ViewComponent and Lookbook
74
99
  # config.view_component.component_parent_class = "PandaCms::BaseComponent"
75
100
  # config.view_component.view_component_path = PandaCms::Engine.root.join("lib/components").to_s
@@ -1,3 +1,3 @@
1
1
  module PandaCms
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Panda Software Limited
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-08 00:00:00.000000000 Z
11
+ date: 2024-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage-office-previewer
@@ -417,7 +417,7 @@ dependencies:
417
417
  - !ruby/object:Gem::Version
418
418
  version: '2.0'
419
419
  - !ruby/object:Gem::Dependency
420
- name: annotate
420
+ name: annotaterb
421
421
  requirement: !ruby/object:Gem::Requirement
422
422
  requirements:
423
423
  - - ">="