panda-cms 0.7.4 → 0.7.5

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.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +37 -2
  3. data/Rakefile +2 -0
  4. data/app/builders/panda/cms/form_builder.rb +13 -5
  5. data/app/components/panda/cms/admin/heading_component.rb +5 -4
  6. data/app/components/panda/cms/admin/panel_component.rb +2 -2
  7. data/app/components/panda/cms/admin/statistics_component.rb +1 -2
  8. data/app/components/panda/cms/admin/user_activity_component.html.erb +3 -1
  9. data/app/components/panda/cms/admin/user_activity_component.rb +1 -3
  10. data/app/components/panda/cms/code_component.rb +8 -4
  11. data/app/components/panda/cms/menu_component.rb +7 -6
  12. data/app/components/panda/cms/page_menu_component.rb +15 -17
  13. data/app/components/panda/cms/rich_text_component.rb +5 -6
  14. data/app/components/panda/cms/text_component.rb +6 -7
  15. data/app/constraints/panda/cms/admin_constraint.rb +4 -1
  16. data/app/controllers/panda/cms/admin/dashboard_controller.rb +13 -9
  17. data/app/controllers/panda/cms/admin/forms_controller.rb +0 -2
  18. data/app/controllers/panda/cms/admin/my_profile_controller.rb +2 -1
  19. data/app/controllers/panda/cms/admin/pages_controller.rb +2 -1
  20. data/app/controllers/panda/cms/admin/posts_controller.rb +1 -2
  21. data/app/controllers/panda/cms/admin/sessions_controller.rb +3 -5
  22. data/app/controllers/panda/cms/admin/settings/bulk_editor_controller.rb +32 -25
  23. data/app/controllers/panda/cms/admin/settings_controller.rb +14 -10
  24. data/app/controllers/panda/cms/application_controller.rb +7 -2
  25. data/app/controllers/panda/cms/errors_controller.rb +5 -2
  26. data/app/controllers/panda/cms/form_submissions_controller.rb +2 -0
  27. data/app/controllers/panda/cms/pages_controller.rb +32 -29
  28. data/app/controllers/panda/cms/posts_controller.rb +2 -0
  29. data/app/helpers/panda/cms/admin/files_helper.rb +5 -1
  30. data/app/helpers/panda/cms/admin/pages_helper.rb +5 -1
  31. data/app/helpers/panda/cms/asset_helper.rb +182 -0
  32. data/app/helpers/panda/cms/pages_helper.rb +2 -0
  33. data/app/helpers/panda/cms/posts_helper.rb +2 -0
  34. data/app/helpers/panda/cms/theme_helper.rb +2 -0
  35. data/app/javascript/panda/cms/controllers/editor_form_controller.js +59 -6
  36. data/app/javascript/panda/cms/controllers/index.js +3 -9
  37. data/app/javascript/panda/cms/controllers/theme_form_controller.js +16 -0
  38. data/app/javascript/panda/cms/stimulus-loading.js +39 -0
  39. data/app/javascript/panda_cms/stimulus-loading.js +39 -0
  40. data/app/jobs/panda/cms/application_job.rb +2 -0
  41. data/app/jobs/panda/cms/record_visit_job.rb +2 -0
  42. data/app/mailers/panda/cms/application_mailer.rb +2 -0
  43. data/app/mailers/panda/cms/form_mailer.rb +3 -1
  44. data/app/models/panda/cms/application_record.rb +2 -0
  45. data/app/models/panda/cms/block.rb +4 -1
  46. data/app/models/panda/cms/block_content.rb +2 -0
  47. data/app/models/panda/cms/breadcrumb.rb +2 -0
  48. data/app/models/panda/cms/current.rb +2 -0
  49. data/app/models/panda/cms/form.rb +2 -0
  50. data/app/models/panda/cms/form_submission.rb +2 -0
  51. data/app/models/panda/cms/menu.rb +12 -9
  52. data/app/models/panda/cms/menu_item.rb +10 -6
  53. data/app/models/panda/cms/page.rb +14 -12
  54. data/app/models/panda/cms/post.rb +9 -5
  55. data/app/models/panda/cms/redirect.rb +6 -3
  56. data/app/models/panda/cms/template.rb +12 -7
  57. data/app/models/panda/cms/user.rb +2 -0
  58. data/app/models/panda/cms/visit.rb +2 -0
  59. data/app/models/panda/social/instagram_post.rb +2 -0
  60. data/app/services/panda/cms/html_to_editor_js_converter.rb +4 -2
  61. data/app/services/panda/social/instagram_feed_service.rb +3 -1
  62. data/app/views/layouts/different_page.html.erb +6 -0
  63. data/app/views/layouts/homepage.html.erb +37 -0
  64. data/app/views/layouts/page.html.erb +18 -0
  65. data/app/views/layouts/panda/cms/application.html.erb +1 -0
  66. data/app/views/panda/cms/admin/pages/new.html.erb +14 -8
  67. data/app/views/panda/cms/admin/settings/index.html.erb +1 -1
  68. data/app/views/panda/cms/shared/_header.html.erb +10 -2
  69. data/app/views/panda/cms/shared/_importmap.html.erb +1 -1
  70. data/app/views/shared/_footer.html.erb +3 -0
  71. data/app/views/shared/_header.html.erb +11 -0
  72. data/config/importmap.rb +2 -0
  73. data/config/initializers/inflections.rb +2 -0
  74. data/config/initializers/panda/cms/form_errors.rb +20 -21
  75. data/config/initializers/panda/cms/healthcheck_log_silencer.rb +2 -0
  76. data/config/initializers/panda/cms.rb +2 -0
  77. data/config/initializers/zeitwork.rb +2 -0
  78. data/config/puma/test.rb +3 -1
  79. data/config/routes.rb +8 -8
  80. data/db/migrate/20240205223709_create_panda_cms_pages.rb +2 -0
  81. data/db/migrate/20240219213327_create_panda_cms_page_versions.rb +2 -0
  82. data/db/migrate/20240303002805_create_panda_cms_templates.rb +4 -1
  83. data/db/migrate/20240303003434_create_panda_cms_template_versions.rb +2 -0
  84. data/db/migrate/20240303022441_create_panda_cms_blocks.rb +4 -1
  85. data/db/migrate/20240303024256_create_panda_cms_block_contents.rb +2 -0
  86. data/db/migrate/20240303024746_create_panda_cms_block_content_versions.rb +2 -0
  87. data/db/migrate/20240303233238_add_panda_cms_menu_table.rb +2 -0
  88. data/db/migrate/20240303234724_add_panda_cms_menu_item_table.rb +2 -0
  89. data/db/migrate/20240304134343_add_parent_id_to_panda_cms_pages.rb +2 -0
  90. data/db/migrate/20240315125411_add_status_to_panda_cms_pages.rb +7 -5
  91. data/db/migrate/20240315125421_add_nested_sets_to_panda_cms_pages.rb +2 -0
  92. data/db/migrate/20240316212822_add_kind_to_panda_cms_menus.rb +3 -1
  93. data/db/migrate/20240316221425_add_start_page_to_panda_cms_menus.rb +2 -0
  94. data/db/migrate/20240316230706_add_nested_to_panda_cms_menu_items.rb +2 -0
  95. data/db/migrate/20240317010532_create_panda_cms_users.rb +2 -0
  96. data/db/migrate/20240317161534_add_max_uses_to_panda_cms_template.rb +2 -0
  97. data/db/migrate/20240317163053_reset_counter_cache_on_panda_cms_template.rb +2 -0
  98. data/db/migrate/20240317214827_create_panda_cms_redirects.rb +2 -0
  99. data/db/migrate/20240317230622_create_panda_cms_visits.rb +2 -0
  100. data/db/migrate/20240324205703_create_active_storage_tables.active_storage.rb +5 -2
  101. data/db/migrate/20240408084718_default_panda_cms_users_admin_to_false.rb +2 -0
  102. data/db/migrate/20240701225422_add_service_name_to_active_storage_blobs.active_storage.rb +8 -6
  103. data/db/migrate/20240701225423_create_active_storage_variant_records.active_storage.rb +2 -0
  104. data/db/migrate/20240701225424_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb +2 -0
  105. data/db/migrate/20240804235210_create_panda_cms_forms.rb +2 -0
  106. data/db/migrate/20240805013612_create_panda_cms_form_submissions.rb +2 -0
  107. data/db/migrate/20240805121123_create_panda_cms_posts.rb +3 -1
  108. data/db/migrate/20240805123104_create_panda_cms_post_versions.rb +2 -0
  109. data/db/migrate/20240806112735_fix_panda_cms_visits_column_names.rb +2 -0
  110. data/db/migrate/20240806204412_add_completion_path_to_panda_cms_forms.rb +2 -0
  111. data/db/migrate/20240820081917_change_form_submissions_to_submission_count.rb +2 -0
  112. data/db/migrate/20240923234535_add_depth_to_panda_cms_menus.rb +6 -4
  113. data/db/migrate/20241031205109_add_cached_content_to_panda_cms_block_contents.rb +2 -0
  114. data/db/migrate/20241119214548_convert_post_content_to_editor_js.rb +2 -0
  115. data/db/migrate/20241120000419_remove_post_tag_references.rb +2 -0
  116. data/db/migrate/20241120110943_add_editor_js_to_posts.rb +2 -0
  117. data/db/migrate/20241120113859_add_cached_content_to_panda_cms_posts.rb +2 -0
  118. data/db/migrate/20241123234140_remove_post_tag_id_from_posts.rb +2 -0
  119. data/db/migrate/20250106223303_add_author_id_to_panda_cms_posts.rb +2 -0
  120. data/db/migrate/20250120235542_remove_paper_trail.rb +5 -4
  121. data/db/migrate/20250126234001_create_panda_social_instagram_posts.rb +2 -0
  122. data/db/migrate/20250504221812_add_current_theme_to_panda_cms_users.rb +2 -0
  123. data/db/seeds.rb +2 -0
  124. data/lib/generators/panda/cms/install_generator.rb +2 -0
  125. data/lib/panda/cms/asset_loader.rb +390 -0
  126. data/lib/panda/cms/bulk_editor.rb +7 -3
  127. data/lib/panda/cms/demo_site_generator.rb +2 -0
  128. data/lib/panda/cms/editor_js/blocks/alert.rb +2 -0
  129. data/lib/panda/cms/editor_js/blocks/base.rb +2 -0
  130. data/lib/panda/cms/editor_js/blocks/header.rb +2 -0
  131. data/lib/panda/cms/editor_js/blocks/image.rb +3 -0
  132. data/lib/panda/cms/editor_js/blocks/list.rb +2 -0
  133. data/lib/panda/cms/editor_js/blocks/paragraph.rb +3 -0
  134. data/lib/panda/cms/editor_js/blocks/quote.rb +3 -0
  135. data/lib/panda/cms/editor_js/blocks/table.rb +3 -1
  136. data/lib/panda/cms/editor_js/renderer.rb +3 -0
  137. data/lib/panda/cms/editor_js.rb +2 -0
  138. data/lib/panda/cms/editor_js_content.rb +47 -41
  139. data/lib/panda/cms/engine.rb +29 -32
  140. data/lib/panda/cms/exceptions_app.rb +2 -0
  141. data/lib/panda/cms/railtie.rb +2 -0
  142. data/lib/panda/cms/slug.rb +3 -1
  143. data/lib/panda-cms/version.rb +3 -1
  144. data/lib/panda-cms.rb +4 -2
  145. data/lib/tasks/assets.rake +547 -0
  146. data/lib/tasks/panda/cms/install.rake +2 -0
  147. data/lib/tasks/panda/social/instagram.rake +2 -0
  148. data/lib/tasks/panda_cms.rake +3 -30
  149. data/public/panda-cms-assets/manifest.json +20 -0
  150. data/public/panda-cms-assets/panda-cms-0.7.4.css +26 -0
  151. data/public/panda-cms-assets/panda-cms-0.7.4.js +150 -0
  152. metadata +168 -14
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSPageVersions < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_page_versions, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSTemplates < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_templates, id: :uuid do |t|
@@ -6,6 +8,7 @@ class CreatePandaCMSTemplates < ActiveRecord::Migration[7.1]
6
8
  t.timestamps
7
9
  end
8
10
 
9
- add_reference :panda_cms_pages, :panda_cms_template, type: :uuid, foreign_key: {to_table: :panda_cms_templates}, null: false
11
+ add_reference :panda_cms_pages, :panda_cms_template, type: :uuid, foreign_key: {to_table: :panda_cms_templates},
12
+ null: false
10
13
  end
11
14
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSTemplateVersions < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_template_versions, id: :uuid do |t|
@@ -1,6 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSBlocks < ActiveRecord::Migration[7.1]
2
4
  def change
3
- create_enum :panda_cms_block_kind, ["plain_text", "rich_text", "image", "video", "audio", "file", "code", "iframe", "quote", "list", "table", "form"]
5
+ create_enum :panda_cms_block_kind,
6
+ %w[plain_text rich_text image video audio file code iframe quote list table form]
4
7
 
5
8
  create_table :panda_cms_blocks, id: :uuid do |t|
6
9
  t.enum :kind, enum_type: :panda_cms_block_kind, default: "plain_text", null: false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSBlockContents < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_block_contents, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSBlockContentVersions < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_block_content_versions, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddPandaCMSMenuTable < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_menus, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddPandaCMSMenuItemTable < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_menu_items, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddParentIdToPandaCMSPages < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  add_reference :panda_cms_pages, :parent, type: :uuid, foreign_key: {to_table: :panda_cms_pages}
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddStatusToPandaCMSPages < ActiveRecord::Migration[7.1]
2
4
  def change
3
- unless column_exists?(:panda_cms_pages, :status)
4
- create_enum :panda_cms_page_status, ["active", "draft", "hidden", "archived"]
5
- add_column :panda_cms_pages, :status, :panda_cms_page_status, default: "active", null: false
6
- add_index :panda_cms_pages, :status
7
- end
5
+ return if column_exists?(:panda_cms_pages, :status)
6
+
7
+ create_enum :panda_cms_page_status, %w[active draft hidden archived]
8
+ add_column :panda_cms_pages, :status, :panda_cms_page_status, default: "active", null: false
9
+ add_index :panda_cms_pages, :status
8
10
  end
9
11
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddNestedSetsToPandaCMSPages < ActiveRecord::Migration[7.1]
2
4
  def self.up
3
5
  Panda::CMS::Page.where(parent_id: 0).update_all(parent_id: nil)
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddKindToPandaCMSMenus < ActiveRecord::Migration[7.1]
2
4
  def change
3
- create_enum :panda_cms_menu_kind, ["static", "auto"]
5
+ create_enum :panda_cms_menu_kind, %w[static auto]
4
6
  add_column :panda_cms_menus, :kind, :enum, enum_type: :panda_cms_menu_kind, default: "static", null: false
5
7
  end
6
8
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddStartPageToPandaCMSMenus < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  add_reference :panda_cms_menus, :start_page, type: :uuid, foreign_key: {to_table: :panda_cms_pages}
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddNestedToPandaCMSMenuItems < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  add_column :panda_cms_menu_items, :parent_id, :uuid
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSUsers < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_users, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddMaxUsesToPandaCMSTemplate < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  add_column :panda_cms_templates, :max_uses, :integer, null: true, default: nil
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ResetCounterCacheOnPandaCMSTemplate < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  Panda::CMS::Template.find_each { |t| Panda::CMS::Template.reset_counters(t.id, :pages) }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSRedirects < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_redirects, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSVisits < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_visits, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This migration comes from active_storage (originally 20170806125915)
2
4
  class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
3
5
  def change
@@ -33,7 +35,8 @@ class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
33
35
  t.datetime :created_at, null: false
34
36
  end
35
37
 
36
- t.index [:record_type, :record_id, :name, :blob_id], name: :index_active_storage_attachments_uniqueness, unique: true
38
+ t.index %i[record_type record_id name blob_id], name: :index_active_storage_attachments_uniqueness,
39
+ unique: true
37
40
  t.foreign_key :active_storage_blobs, column: :blob_id
38
41
  end
39
42
 
@@ -41,7 +44,7 @@ class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
41
44
  t.belongs_to :blob, null: false, index: false, type: foreign_key_type
42
45
  t.string :variation_digest, null: false
43
46
 
44
- t.index [:blob_id, :variation_digest], name: :index_active_storage_variant_records_uniqueness, unique: true
47
+ t.index %i[blob_id variation_digest], name: :index_active_storage_variant_records_uniqueness, unique: true
45
48
  t.foreign_key :active_storage_blobs, column: :blob_id
46
49
  end
47
50
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class DefaultPandaCMSUsersAdminToFalse < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  change_column :panda_cms_users, :admin, :boolean, default: false
@@ -1,17 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This migration comes from active_storage (originally 20190112182829)
2
4
  class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
3
5
  def up
4
6
  return unless table_exists?(:active_storage_blobs)
5
7
 
6
- unless column_exists?(:active_storage_blobs, :service_name)
7
- add_column :active_storage_blobs, :service_name, :string
8
+ return if column_exists?(:active_storage_blobs, :service_name)
8
9
 
9
- if (configured_service = ActiveStorage::Blob.service.name)
10
- ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
11
- end
10
+ add_column :active_storage_blobs, :service_name, :string
12
11
 
13
- change_column :active_storage_blobs, :service_name, :string, null: false
12
+ if (configured_service = ActiveStorage::Blob.service.name)
13
+ ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
14
14
  end
15
+
16
+ change_column :active_storage_blobs, :service_name, :string, null: false
15
17
  end
16
18
 
17
19
  def down
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This migration comes from active_storage (originally 20191206030411)
2
4
  class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
3
5
  def change
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This migration comes from active_storage (originally 20211119233751)
2
4
  class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0]
3
5
  def change
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSForms < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_forms, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSFormSubmissions < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_form_submissions, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSPosts < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_post_tags, id: :uuid do |t|
@@ -20,7 +22,7 @@ class CreatePandaCMSPosts < ActiveRecord::Migration[7.1]
20
22
  t.index :slug, unique: true
21
23
  end
22
24
 
23
- create_enum :panda_cms_post_status, ["active", "draft", "hidden", "archived"]
25
+ create_enum :panda_cms_post_status, %w[active draft hidden archived]
24
26
  add_column :panda_cms_posts, :status, :panda_cms_post_status, default: "draft", null: false
25
27
  add_index :panda_cms_posts, :status
26
28
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaCMSPostVersions < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_cms_post_versions, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class FixPandaCMSVisitsColumnNames < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  change_table :panda_cms_visits do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddCompletionPathToPandaCMSForms < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  add_column :panda_cms_forms, :completion_path, :string
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ChangeFormSubmissionsToSubmissionCount < ActiveRecord::Migration[7.2]
2
4
  def change
3
5
  rename_column :panda_cms_forms, :submissions, :submission_count
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddDepthToPandaCMSMenus < ActiveRecord::Migration[7.2]
2
4
  def change
3
5
  add_column :panda_cms_menus, :depth, :integer, null: true, default: nil
4
6
 
5
7
  homepage = Panda::CMS::Page.find_by(path: "/")
6
- if homepage
7
- main_menu = Panda::CMS::Menu.find_by(start_page_id: homepage.id, kind: :auto)
8
- main_menu&.update(depth: 2)
9
- end
8
+ return unless homepage
9
+
10
+ main_menu = Panda::CMS::Menu.find_by(start_page_id: homepage.id, kind: :auto)
11
+ main_menu&.update(depth: 2)
10
12
  end
11
13
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddCachedContentToPandaCMSBlockContents < ActiveRecord::Migration[7.2]
2
4
  def change
3
5
  add_column :panda_cms_block_contents, :cached_content, :jsonb
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ConvertPostContentToEditorJs < ActiveRecord::Migration[7.1]
2
4
  def up
3
5
  Panda::CMS::Post.find_each do |post|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RemovePostTagReferences < ActiveRecord::Migration[8.0]
2
4
  def up
3
5
  remove_reference :panda_cms_posts, :post_tag, foreign_key: {to_table: :panda_cms_post_tags}, type: :uuid
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddEditorJsToPosts < ActiveRecord::Migration[7.0]
2
4
  def up
3
5
  # First, add a temporary column
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddCachedContentToPandaCMSPosts < ActiveRecord::Migration[8.0]
2
4
  def change
3
5
  add_column :panda_cms_posts, :cached_content, :text
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RemovePostTagIdFromPosts < ActiveRecord::Migration[8.0]
2
4
  def change
3
5
  remove_column :panda_cms_posts, :post_tag_id if column_exists?(:panda_cms_posts, :post_tag_id)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddAuthorIdToPandaCMSPosts < ActiveRecord::Migration[8.0]
2
4
  def change
3
5
  add_reference :panda_cms_posts, :author, type: :uuid, foreign_key: {to_table: :panda_cms_users}
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RemovePaperTrail < ActiveRecord::Migration[7.1]
2
4
  def up
3
5
  version_tables = %w[
@@ -11,9 +13,7 @@ class RemovePaperTrail < ActiveRecord::Migration[7.1]
11
13
  ]
12
14
 
13
15
  version_tables.each do |table|
14
- if table_exists?(table)
15
- drop_table table
16
- end
16
+ drop_table table if table_exists?(table)
17
17
  end
18
18
  end
19
19
 
@@ -36,7 +36,8 @@ class RemovePaperTrail < ActiveRecord::Migration[7.1]
36
36
  t.string :foreign_type
37
37
  end
38
38
  add_index :panda_cms_version_associations, [:version_id]
39
- add_index :panda_cms_version_associations, [:foreign_key_name, :foreign_key_id, :foreign_type], name: "index_version_associations_on_foreign_key"
39
+ add_index :panda_cms_version_associations, %i[foreign_key_name foreign_key_id foreign_type],
40
+ name: "index_version_associations_on_foreign_key"
40
41
 
41
42
  # Model-specific version tables
42
43
  %w[template page block_content post action_text_rich_text].each do |model|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreatePandaSocialInstagramPosts < ActiveRecord::Migration[7.1]
2
4
  def change
3
5
  create_table :panda_social_instagram_posts, id: :uuid do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddCurrentThemeToPandaCMSUsers < ActiveRecord::Migration[8.0]
2
4
  def change
3
5
  add_column :panda_cms_users, :current_theme, :string, default: "default"
data/db/seeds.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  generator = Panda::CMS::DemoSiteGenerator.new
2
4
  generator.create_templates
3
5
  generator.create_pages
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Generators
2
4
  module Panda
3
5
  module CMS