panda-cms 0.10.2 → 0.10.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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +77 -0
  3. data/app/assets/tailwind/panda/cms/_application.css +1 -0
  4. data/app/components/panda/cms/admin/popular_pages_component.rb +62 -0
  5. data/app/components/panda/cms/code_component.rb +2 -2
  6. data/app/components/panda/cms/menu_component.rb +9 -2
  7. data/app/components/panda/cms/rich_text_component.rb +1 -1
  8. data/app/components/panda/cms/text_component.rb +1 -1
  9. data/app/javascript/panda/cms/controllers/editor_form_controller.js +3 -3
  10. data/app/javascript/panda/cms/controllers/editor_iframe_controller.js +4 -4
  11. data/app/jobs/panda/cms/record_visit_job.rb +2 -1
  12. data/app/models/panda/cms/visit.rb +16 -1
  13. data/app/services/panda/social/instagram_feed_service.rb +54 -54
  14. data/app/views/panda/cms/admin/dashboard/show.html.erb +10 -3
  15. data/app/views/panda/cms/admin/forms/new.html.erb +1 -1
  16. data/app/views/panda/cms/admin/menus/edit.html.erb +1 -1
  17. data/app/views/panda/cms/admin/menus/new.html.erb +1 -1
  18. data/app/views/panda/cms/admin/pages/edit.html.erb +77 -3
  19. data/app/views/panda/cms/admin/posts/_form.html.erb +6 -6
  20. data/app/views/panda/cms/shared/_favicons.html.erb +7 -7
  21. data/config/importmap.rb +0 -1
  22. data/config/initializers/groupdate.rb +5 -0
  23. data/config/locales/en.yml +1 -2
  24. data/db/migrate/20240315125421_add_nested_sets_to_panda_cms_pages.rb +0 -10
  25. data/db/migrate/20240316230706_add_nested_to_panda_cms_menu_items.rb +0 -6
  26. data/db/migrate/20240317230622_create_panda_cms_visits.rb +1 -1
  27. data/db/migrate/20240805121123_create_panda_cms_posts.rb +1 -1
  28. data/db/migrate/20240806112735_fix_panda_cms_visits_column_names.rb +1 -1
  29. data/db/migrate/20240923234535_add_depth_to_panda_cms_menus.rb +0 -6
  30. data/db/migrate/20250106223303_add_author_id_to_panda_cms_posts.rb +1 -3
  31. data/db/migrate/20251117234530_add_index_to_visited_at_on_panda_cms_visits.rb +7 -0
  32. data/db/migrate/20251118015100_backfill_visited_at_for_existing_visits.rb +17 -0
  33. data/db/seeds.rb +5 -0
  34. data/lib/panda/cms/asset_loader.rb +18 -4
  35. data/lib/panda/cms/engine/autoload_config.rb +18 -0
  36. data/lib/panda/cms/engine/route_config.rb +1 -2
  37. data/lib/panda/cms/engine.rb +4 -23
  38. data/lib/{panda-cms → panda/cms}/version.rb +1 -1
  39. data/lib/panda/cms.rb +3 -1
  40. data/lib/panda-cms.rb +8 -1
  41. data/lib/tasks/ci.rake +0 -0
  42. metadata +13 -46
  43. data/app/assets/builds/panda.cms.css +0 -2754
  44. data/app/assets/stylesheets/panda/cms/application.tailwind.css +0 -162
  45. data/app/assets/stylesheets/panda/cms/editor.css +0 -120
  46. data/app/assets/tailwind/application.css +0 -178
  47. data/app/assets/tailwind/tailwind.config.js +0 -15
  48. data/config/initializers/panda/cms/healthcheck_log_silencer.rb.disabled +0 -31
  49. data/db/migrate/20240317010532_create_panda_cms_users.rb +0 -14
  50. data/db/migrate/20240324205703_create_active_storage_tables.active_storage.rb +0 -61
  51. data/db/migrate/20240408084718_default_panda_cms_users_admin_to_false.rb +0 -7
  52. data/db/migrate/20240701225422_add_service_name_to_active_storage_blobs.active_storage.rb +0 -24
  53. data/db/migrate/20240701225423_create_active_storage_variant_records.active_storage.rb +0 -30
  54. data/db/migrate/20240701225424_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb +0 -10
  55. data/db/migrate/20241119214548_convert_post_content_to_editor_js.rb +0 -37
  56. data/db/migrate/20250809231125_migrate_users_to_panda_core.rb +0 -113
  57. data/lib/generators/panda/cms/install_generator.rb +0 -28
  58. data/public/panda-cms-assets/editor-js/core/editorjs.min.js +0 -83
  59. data/public/panda-cms-assets/editor-js/plugins/embed.min.js +0 -2
  60. data/public/panda-cms-assets/editor-js/plugins/header.min.js +0 -9
  61. data/public/panda-cms-assets/editor-js/plugins/nested-list.min.js +0 -2
  62. data/public/panda-cms-assets/editor-js/plugins/paragraph.min.js +0 -9
  63. data/public/panda-cms-assets/editor-js/plugins/quote.min.js +0 -2
  64. data/public/panda-cms-assets/editor-js/plugins/simple-image.min.js +0 -2
  65. data/public/panda-cms-assets/editor-js/plugins/table.min.js +0 -2
  66. data/public/panda-cms-assets/favicons/android-chrome-192x192.png +0 -0
  67. data/public/panda-cms-assets/favicons/android-chrome-512x512.png +0 -0
  68. data/public/panda-cms-assets/favicons/apple-touch-icon.png +0 -0
  69. data/public/panda-cms-assets/favicons/browserconfig.xml +0 -9
  70. data/public/panda-cms-assets/favicons/favicon-16x16.png +0 -0
  71. data/public/panda-cms-assets/favicons/favicon-32x32.png +0 -0
  72. data/public/panda-cms-assets/favicons/favicon.ico +0 -0
  73. data/public/panda-cms-assets/favicons/mstile-150x150.png +0 -0
  74. data/public/panda-cms-assets/favicons/safari-pinned-tab.svg +0 -61
  75. data/public/panda-cms-assets/favicons/site.webmanifest +0 -14
  76. data/public/panda-cms-assets/manifest.json +0 -20
  77. data/public/panda-cms-assets/panda-cms-0.7.4.css +0 -26
  78. data/public/panda-cms-assets/panda-cms-0.7.4.js +0 -150
  79. data/public/panda-cms-assets/panda-logo-screenprint.png +0 -0
  80. data/public/panda-cms-assets/panda-nav.png +0 -0
  81. data/public/panda-cms-assets/rich_text_editor.css +0 -568
  82. /data/db/migrate/{20251105000001_add_pending_review_status_to_pages_and_posts.panda_cms.rb → 20251105000001_add_pending_review_status_to_pages_and_posts.rb} +0 -0
@@ -1,162 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- @layer base {
6
- html[data-theme="default"] {
7
- --color-white: 249 249 249; /* #F9F9F9 */
8
- --color-black: 26 22 29; /* #1A161D */
9
-
10
- --color-light: 238 206 230; /* #EECEE6 */
11
- --color-mid: 141 94 183; /* #8D5EB7 */
12
- --color-dark: 33 29 73; /* #211D49 */
13
-
14
- --color-highlight: 208 64 20; /* #D04014 */
15
-
16
- --color-active: 0 135 85; /* #008755 */
17
- --color-warning: 250 207 142; /* #FACF8E */
18
- --color-inactive: 216 247 245; /* #d6e4f7 */
19
- --color-error: 245 129 129; /* #F58181 */
20
- }
21
-
22
- html[data-theme="sky"] {
23
- --color-white: 249 249 249; /* #F9F9F9 */
24
- --color-black: 26 22 29; /* #1A161D */
25
- --color-light: 204 238 242; /* #CCEEF2 */
26
- --color-mid: 42 102 159; /* #2A669F */
27
- --color-dark: 20 32 74; /* #14204A */
28
- --color-highlight: 208 64 20; /* #D04014 */
29
-
30
- --color-active: 166 211 129; /* #A6D381 */
31
- --color-warning: 244 190 102; /* #F4BE66 */
32
- --color-inactive: 216 247 245; /* #d6e4f7 */
33
- --color-error: 208 64 20; /* #D04014 */
34
- }
35
-
36
- a.block-link:after {
37
- position: absolute;
38
- content: "";
39
- inset: 0;
40
- }
41
- }
42
-
43
- /* Default editor styles */
44
- @layer components {
45
- .codex-editor__redactor .ce-block .ce-block__content {
46
- @apply text-base font-normal font-sans text-dark leading-[1.6] space-y-[1.6rem];
47
-
48
- h1.ce-header {
49
- @apply text-3xl md:text-4xl font-semibold font-sans leading-[1.2];
50
- }
51
-
52
- h2.ce-header {
53
- @apply text-2xl font-medium font-sans leading-[1.3] mb-4 mt-8;
54
- }
55
-
56
- h3.ce-header {
57
- @apply text-xl font-normal font-sans leading-[1.3] mb-4 mt-6;
58
- }
59
-
60
- p,
61
- li {
62
- @apply leading-[1.6] tracking-wide max-w-[85ch];
63
-
64
- a {
65
- @apply text-[#1A9597] underline underline-offset-2 hover:text-[#158486] focus:outline-2 focus:outline-offset-2 focus:outline-[#1A9597];
66
- }
67
-
68
- strong,
69
- b {
70
- @apply font-semibold;
71
- }
72
- }
73
-
74
- p {
75
- @apply mb-4;
76
- }
77
-
78
- .cdx-quote {
79
- @apply bg-[#eef0f3] border-l-inactive border-l-8 p-6 mb-4;
80
-
81
- .cdx-quote__caption {
82
- @apply block ml-6 mt-2 text-sm text-dark;
83
- }
84
-
85
- .cdx-quote__text {
86
- quotes: "\201C""\201D""\2018""\2019";
87
- @apply pl-6;
88
-
89
- &:before {
90
- @apply -ml-8 mr-2 text-dark text-6xl leading-4 align-text-bottom font-serif;
91
- content: open-quote;
92
- }
93
-
94
- p {
95
- @apply inline italic text-lg;
96
- }
97
- }
98
- }
99
-
100
- .cdx-list {
101
- @apply mb-4 pl-6;
102
-
103
- &--ordered {
104
- @apply list-decimal;
105
- }
106
-
107
- &--unordered {
108
- @apply list-disc;
109
- }
110
-
111
- .cdx-list {
112
- @apply mt-2 mb-0;
113
- }
114
-
115
- .cdx-list__item {
116
- @apply mb-2 pl-2;
117
- }
118
- }
119
-
120
- .cdx-nested-list {
121
- @apply mb-4 pl-6;
122
-
123
- &--ordered {
124
- @apply list-decimal;
125
- }
126
-
127
- &--unordered {
128
- @apply list-disc;
129
- }
130
-
131
- .cdx-nested-list {
132
- @apply mt-2 mb-0;
133
- }
134
-
135
- .cdx-nested-list__item {
136
- @apply mb-2 pl-2;
137
- }
138
- }
139
-
140
- .cdx-table {
141
- @apply w-full border-collapse border-2 border-dark my-6;
142
-
143
- &__head {
144
- @apply font-semibold border-dark border-r-2 p-3 bg-light;
145
- }
146
-
147
- &__row {
148
- @apply border-dark border-b-2;
149
- }
150
-
151
- &__cell {
152
- @apply border-dark border-r-2 p-3;
153
- }
154
- }
155
-
156
- .cdx-embed {
157
- iframe {
158
- @apply w-full border-none;
159
- }
160
- }
161
- }
162
- }
@@ -1,120 +0,0 @@
1
- /* Base content styles, where .codex-editor applies them to the Panda editor too */
2
- @layer components {
3
- .codex-editor__redactor .ce-block .ce-block__content {
4
- @apply text-base font-normal font-sans text-dark leading-[1.6] space-y-[1.6rem];
5
-
6
- h1.ce-header {
7
- @apply text-3xl md:text-4xl font-semibold font-sans text-[#104071] leading-[1.2] max-w-[85ch];
8
- }
9
-
10
- h2.ce-header {
11
- @apply text-2xl font-medium font-sans text-[#104071] leading-[1.3] mb-4 mt-8 max-w-[85ch];
12
- }
13
-
14
- h3.ce-header {
15
- @apply text-xl font-normal font-sans text-[#104071] leading-[1.3] mb-4 mt-6 max-w-[85ch];
16
- }
17
-
18
- p,
19
- li {
20
- @apply leading-[1.6] tracking-wide max-w-[85ch];
21
-
22
- a {
23
- @apply text-[#1A9597] underline underline-offset-2 hover:text-[#158486] focus:outline-2 focus:outline-offset-2 focus:outline-[#1A9597];
24
- }
25
-
26
- strong,
27
- b {
28
- @apply font-semibold;
29
- }
30
- }
31
-
32
- p {
33
- @apply mb-4;
34
- }
35
-
36
- .cdx-quote {
37
- @apply bg-[#eef0f3] border-l-inactive border-l-8 p-6 mb-4;
38
-
39
- .cdx-quote__caption {
40
- @apply block ml-6 mt-2 text-sm text-dark;
41
- }
42
-
43
- .cdx-quote__text {
44
- quotes: "\201C" "\201D" "\2018" "\2019";
45
- @apply pl-6;
46
-
47
- &:before {
48
- @apply -ml-8 mr-2 text-dark text-6xl leading-4 align-text-bottom font-serif;
49
- content: open-quote;
50
- }
51
-
52
- p {
53
- @apply inline italic text-lg;
54
- }
55
- }
56
- }
57
-
58
- .cdx-list {
59
- @apply mb-4 pl-6;
60
-
61
- &--ordered {
62
- @apply list-decimal;
63
- }
64
-
65
- &--unordered {
66
- @apply list-disc;
67
- }
68
-
69
- .cdx-list {
70
- @apply mt-2 mb-0;
71
- }
72
-
73
- .cdx-list__item {
74
- @apply mb-2 pl-2;
75
- }
76
- }
77
-
78
- .cdx-nested-list {
79
- @apply mb-4 pl-6;
80
-
81
- &--ordered {
82
- @apply list-decimal;
83
- }
84
-
85
- &--unordered {
86
- @apply list-disc;
87
- }
88
-
89
- .cdx-nested-list {
90
- @apply mt-2 mb-0;
91
- }
92
-
93
- .cdx-nested-list__item {
94
- @apply mb-2 pl-2;
95
- }
96
- }
97
-
98
- .cdx-table {
99
- @apply w-full border-collapse border-2 border-dark my-6;
100
-
101
- &__head {
102
- @apply font-semibold border-dark border-r-2 p-3 bg-light;
103
- }
104
-
105
- &__row {
106
- @apply border-dark border-b-2;
107
- }
108
-
109
- &__cell {
110
- @apply border-dark border-r-2 p-3;
111
- }
112
- }
113
-
114
- .cdx-embed {
115
- iframe {
116
- @apply w-full border-none;
117
- }
118
- }
119
- }
120
- }
@@ -1,178 +0,0 @@
1
- @import "tailwindcss";
2
-
3
- @config "tailwind.config.js";
4
-
5
- @theme {
6
- --color-white: var(--color-white);
7
- --color-black: var(--color-black);
8
- --color-light: var(--color-light);
9
- --color-mid: var(--color-mid);
10
- --color-dark: var(--color-dark);
11
- --color-highlight: var(--color-highlight);
12
- --color-active: var(--color-active);
13
- --color-inactive: var(--color-active);
14
- --color-warning: var(--color-warning);
15
- --color-error: var(--color-error);
16
- }
17
-
18
- @plugin "tailwindcss/typography";
19
- @plugin "tailwindcss/forms";
20
-
21
- @layer base {
22
- html[data-theme="default"] {
23
- --color-white: 249 249 249; /* #F9F9F9 */
24
- --color-black: 26 22 29; /* #1A161D */
25
-
26
- --color-light: 238 206 230; /* #EECEE6 */
27
- --color-mid: 141 94 183; /* #8D5EB7 */
28
- --color-dark: 33 29 73; /* #211D49 */
29
-
30
- --color-highlight: 208 64 20; /* #D04014 */
31
-
32
- --color-active: 0 135 85; /* #008755 */
33
- --color-warning: 250 207 142; /* #FACF8E */
34
- --color-inactive: 216 247 245; /* #d6e4f7 */
35
- --color-error: 245 129 129; /* #F58181 */
36
- }
37
-
38
- html[data-theme="sky"] {
39
- --color-white: 249 249 249; /* #F9F9F9 */
40
- --color-black: 26 22 29; /* #1A161D */
41
- --color-light: 204 238 242; /* #CCEEF2 */
42
- --color-mid: 42 102 159; /* #2A669F */
43
- --color-dark: 20 32 74; /* #14204A */
44
- --color-highlight: 208 64 20; /* #D04014 */
45
-
46
- --color-active: 69 154 89; /* #459A59 - darker green with better contrast */
47
- --color-warning: 244 190 102; /* #F4BE66 */
48
- --color-inactive: 216 247 245; /* #d6e4f7 */
49
- --color-error: 208 64 20; /* #D04014 */
50
- }
51
-
52
- a.block-link:after {
53
- position: absolute;
54
- content: "";
55
- inset: 0;
56
- }
57
- }
58
-
59
- /* Default editor styles */
60
- @layer components {
61
- .codex-editor__redactor .ce-block .ce-block__content {
62
- @apply text-base font-normal font-sans text-dark leading-[1.6] space-y-[1.6rem];
63
-
64
- h1.ce-header {
65
- @apply text-3xl md:text-4xl font-semibold font-sans leading-[1.2];
66
- }
67
-
68
- h2.ce-header {
69
- @apply text-2xl font-medium font-sans leading-[1.3] mb-4 mt-8;
70
- }
71
-
72
- h3.ce-header {
73
- @apply text-xl font-normal font-sans leading-[1.3] mb-4 mt-6;
74
- }
75
-
76
- p,
77
- li {
78
- @apply leading-[1.6] tracking-wide max-w-[85ch];
79
-
80
- a {
81
- @apply text-[#1A9597] underline underline-offset-2 hover:text-[#158486] focus:outline-2 focus:outline-offset-2 focus:outline-[#1A9597];
82
- }
83
-
84
- strong,
85
- b {
86
- @apply font-semibold;
87
- }
88
- }
89
-
90
- p {
91
- @apply mb-4;
92
- }
93
-
94
- .cdx-quote {
95
- @apply bg-[#eef0f3] border-l-inactive border-l-8 p-6 mb-4;
96
-
97
- .cdx-quote__caption {
98
- @apply block ml-6 mt-2 text-sm text-dark;
99
- }
100
-
101
- .cdx-quote__text {
102
- quotes: "\201C" "\201D" "\2018" "\2019";
103
- @apply pl-6;
104
-
105
- &:before {
106
- @apply -ml-8 mr-2 text-dark text-6xl leading-4 align-text-bottom font-serif;
107
- content: open-quote;
108
- }
109
-
110
- p {
111
- @apply inline italic text-lg;
112
- }
113
- }
114
- }
115
-
116
- .cdx-list {
117
- @apply mb-4 pl-6;
118
-
119
- &--ordered {
120
- @apply list-decimal;
121
- }
122
-
123
- &--unordered {
124
- @apply list-disc;
125
- }
126
-
127
- .cdx-list {
128
- @apply mt-2 mb-0;
129
- }
130
-
131
- .cdx-list__item {
132
- @apply mb-2 pl-2;
133
- }
134
- }
135
-
136
- .cdx-nested-list {
137
- @apply mb-4 pl-6;
138
-
139
- &--ordered {
140
- @apply list-decimal;
141
- }
142
-
143
- &--unordered {
144
- @apply list-disc;
145
- }
146
-
147
- .cdx-nested-list {
148
- @apply mt-2 mb-0;
149
- }
150
-
151
- .cdx-nested-list__item {
152
- @apply mb-2 pl-2;
153
- }
154
- }
155
-
156
- .cdx-table {
157
- @apply w-full border-collapse border-2 border-dark my-6;
158
-
159
- &__head {
160
- @apply font-semibold border-dark border-r-2 p-3 bg-light;
161
- }
162
-
163
- &__row {
164
- @apply border-dark border-b-2;
165
- }
166
-
167
- &__cell {
168
- @apply border-dark border-r-2 p-3;
169
- }
170
- }
171
-
172
- .cdx-embed {
173
- iframe {
174
- @apply w-full border-none;
175
- }
176
- }
177
- }
178
- }
@@ -1,15 +0,0 @@
1
- module.exports = {
2
- content: {
3
- relative: true,
4
- files: [
5
- "../../public/*.html",
6
- "../../app/views/**/*.html.erb",
7
- "../../app/builders/panda/cms/**/*.rb",
8
- "../../app/components/panda/cms/**/*.html.erb",
9
- "../../app/components/panda/cms/**/*.rb",
10
- "../../app/helpers/panda/cms/**/*.rb",
11
- "../../app/javascript/panda/cms/**/*.js",
12
- "../../vendor/javascript/**/*.js",
13
- ],
14
- },
15
- };
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "silencer/rails/logger"
4
-
5
- # Don't log requests to the healthcheck endpoint
6
- Rails.application.configure do
7
- # Rails 8 renamed Rails::Rack::Logger to ActionDispatch::Request::Logger
8
- # Determine which logger middleware class to use
9
- logger_class = if Object.const_defined?("ActionDispatch::Request::Logger")
10
- ActionDispatch::Request::Logger
11
- elsif Object.const_defined?("Rails::Rack::Logger")
12
- Rails::Rack::Logger
13
- else
14
- # If neither exists, skip the middleware swap
15
- nil
16
- end
17
-
18
- if logger_class
19
- begin
20
- config.middleware.swap(
21
- logger_class,
22
- Silencer::Logger,
23
- config.log_tags,
24
- silence: ["/up"]
25
- )
26
- rescue RuntimeError => e
27
- # Silently fail if middleware doesn't exist in stack
28
- raise unless e.message.include?("No such middleware")
29
- end
30
- end
31
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CreatePandaCMSUsers < ActiveRecord::Migration[7.1]
4
- def change
5
- create_table :panda_cms_users, id: :uuid do |t|
6
- t.string :firstname
7
- t.string :lastname
8
- t.string :email
9
- t.string :image_url
10
- t.boolean :admin
11
- t.timestamps
12
- end
13
- end
14
- end
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This migration comes from active_storage (originally 20170806125915)
4
- class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
5
- def change
6
- # Use Active Record's configured type for primary and foreign keys
7
- primary_key_type, foreign_key_type = primary_and_foreign_key_types
8
-
9
- create_table :active_storage_blobs, id: primary_key_type do |t|
10
- t.string :key, null: false
11
- t.string :filename, null: false
12
- t.string :content_type
13
- t.text :metadata
14
- t.string :service_name, null: false
15
- t.bigint :byte_size, null: false
16
- t.string :checksum
17
-
18
- if connection.supports_datetime_with_precision?
19
- t.datetime :created_at, precision: 6, null: false
20
- else
21
- t.datetime :created_at, null: false
22
- end
23
-
24
- t.index [:key], unique: true
25
- end
26
-
27
- create_table :active_storage_attachments, id: primary_key_type do |t|
28
- t.string :name, null: false
29
- t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
30
- t.references :blob, null: false, type: foreign_key_type
31
-
32
- if connection.supports_datetime_with_precision?
33
- t.datetime :created_at, precision: 6, null: false
34
- else
35
- t.datetime :created_at, null: false
36
- end
37
-
38
- t.index %i[record_type record_id name blob_id], name: :index_active_storage_attachments_uniqueness,
39
- unique: true
40
- t.foreign_key :active_storage_blobs, column: :blob_id
41
- end
42
-
43
- create_table :active_storage_variant_records, id: primary_key_type do |t|
44
- t.belongs_to :blob, null: false, index: false, type: foreign_key_type
45
- t.string :variation_digest, null: false
46
-
47
- t.index %i[blob_id variation_digest], name: :index_active_storage_variant_records_uniqueness, unique: true
48
- t.foreign_key :active_storage_blobs, column: :blob_id
49
- end
50
- end
51
-
52
- private
53
-
54
- def primary_and_foreign_key_types
55
- config = Rails.configuration.generators
56
- setting = config.options[config.orm][:primary_key_type]
57
- primary_key_type = setting || :primary_key
58
- foreign_key_type = setting || :bigint
59
- [primary_key_type, foreign_key_type]
60
- end
61
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class DefaultPandaCMSUsersAdminToFalse < ActiveRecord::Migration[7.1]
4
- def change
5
- change_column :panda_cms_users, :admin, :boolean, default: false
6
- end
7
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This migration comes from active_storage (originally 20190112182829)
4
- class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
5
- def up
6
- return unless table_exists?(:active_storage_blobs)
7
-
8
- return if column_exists?(:active_storage_blobs, :service_name)
9
-
10
- add_column :active_storage_blobs, :service_name, :string
11
-
12
- if (configured_service = ActiveStorage::Blob.service.name)
13
- ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
14
- end
15
-
16
- change_column :active_storage_blobs, :service_name, :string, null: false
17
- end
18
-
19
- def down
20
- return unless table_exists?(:active_storage_blobs)
21
-
22
- remove_column :active_storage_blobs, :service_name
23
- end
24
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This migration comes from active_storage (originally 20191206030411)
4
- class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
5
- def change
6
- return unless table_exists?(:active_storage_blobs)
7
-
8
- # Use Active Record's configured type for primary key
9
- create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t|
10
- t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type
11
- t.string :variation_digest, null: false
12
-
13
- t.index %i[blob_id variation_digest], name: "index_active_storage_variant_records_uniqueness", unique: true
14
- t.foreign_key :active_storage_blobs, column: :blob_id
15
- end
16
- end
17
-
18
- private
19
-
20
- def primary_key_type
21
- config = Rails.configuration.generators
22
- config.options[config.orm][:primary_key_type] || :primary_key
23
- end
24
-
25
- def blobs_primary_key_type
26
- pkey_name = connection.primary_key(:active_storage_blobs)
27
- pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
28
- pkey_column.bigint? ? :bigint : pkey_column.type
29
- end
30
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This migration comes from active_storage (originally 20211119233751)
4
- class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0]
5
- def change
6
- return unless table_exists?(:active_storage_blobs)
7
-
8
- change_column_null(:active_storage_blobs, :checksum, true)
9
- end
10
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ConvertPostContentToEditorJs < ActiveRecord::Migration[7.1]
4
- def up
5
- Panda::CMS::Post.find_each do |post|
6
- next if post.post_content.blank?
7
-
8
- editor_content = {
9
- time: Time.current.to_i,
10
- version: "2.28.2",
11
- blocks: [
12
- {
13
- type: "paragraph",
14
- data: {
15
- text: post.post_content.to_plain_text
16
- }
17
- }
18
- ]
19
- }
20
-
21
- post.update_column(:content, editor_content)
22
- end
23
- end
24
-
25
- def down
26
- Panda::CMS::Post.find_each do |post|
27
- next if post.content.blank?
28
-
29
- # Extract plain text from EditorJS format
30
- plain_text = post.content["blocks"]
31
- &.map { |block| block["data"]["text"] }
32
- &.join("\n")
33
-
34
- post.update_column(:content, plain_text)
35
- end
36
- end
37
- end