panda_cms 0.6.1 → 0.6.2

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: 785a3596f68d157ff6e6363a95c507f536554f276fec85626e488cb3e3ca167f
4
+ data.tar.gz: 8847bd7ffd2b09a6e42a2fc7d4444de20f38e42e91616620092caf558ffafe3d
5
5
  SHA512:
6
- metadata.gz: 9300786a0c99d6b14220b02e5770449b81ac0dcb1f92eaa1ae38d482687355e1066ae33b33f4ea5ad8831e4aefb7fabe9c1b676c78d0b5ff1eea4697bbf68fb6
7
- data.tar.gz: 780ea144e8034c04b0ed8af45555e310c22592bfc387bddb974d7be0be5be4eab87774eb262c1f8069fdb7eba29b73c8e1923057b93f3ae65e41e7acf2be5094
6
+ metadata.gz: bf0a5477ebf5c79bd379275f63bbdb0da9e80896ac81372b976f4dc8a02c9635e2799ff6da1325efe4bdb0368e96a4ffef1271c0340344e52dd3e8a3456e61c5
7
+ data.tar.gz: 0bf5912db2be52720903d71be1ab9fba53b873aad9723caf1b3d4b6b9fe1f372cb81eb54b29d3f33874bfea12ecbc072f67497fb359054ac72efa59352c17693
@@ -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?
@@ -70,6 +70,34 @@ module PandaCms
70
70
  end
71
71
  end
72
72
 
73
+ initializer "#{engine_name}.backtrace_cleaner" do |app|
74
+ engine_root_regex = Regexp.escape(root.to_s + File::SEPARATOR)
75
+
76
+ # Clean those ERB lines, we don't need the internal autogenerated
77
+ # ERB method, what we do need (line number in ERB file) is already there
78
+ Rails.backtrace_cleaner.add_filter do |line|
79
+ line.sub(/(\.erb:\d+):in `__.*$/, "\\1")
80
+ end
81
+
82
+ # Remove our own engine's path prefix, even if it's
83
+ # being used from a local path rather than the gem directory.
84
+ Rails.backtrace_cleaner.add_filter do |line|
85
+ line.sub(/^#{engine_root_regex}/, "#{engine_name} ")
86
+ end
87
+
88
+ # Keep Umlaut's own stacktrace in the backtrace -- we have to remove Rails
89
+ # silencers and re-add them how we want.
90
+ Rails.backtrace_cleaner.remove_silencers!
91
+
92
+ # Silence what Rails silenced, UNLESS it looks like
93
+ # it's from Umlaut engine
94
+ Rails.backtrace_cleaner.add_silencer do |line|
95
+ (line !~ Rails::BacktraceCleaner::APP_DIRS_PATTERN) &&
96
+ (line !~ /^#{engine_root_regex}/) &&
97
+ (line !~ /^#{engine_name} /)
98
+ end
99
+ end
100
+
73
101
  # Set up ViewComponent and Lookbook
74
102
  # config.view_component.component_parent_class = "PandaCms::BaseComponent"
75
103
  # 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.2"
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.2
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
  - - ">="