panda-cms 0.10.0 → 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 (128) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +79 -11
  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 +46 -9
  6. data/app/components/panda/cms/menu_component.rb +18 -5
  7. data/app/components/panda/cms/page_menu_component.rb +9 -1
  8. data/app/components/panda/cms/rich_text_component.rb +49 -17
  9. data/app/components/panda/cms/text_component.rb +46 -14
  10. data/app/controllers/panda/cms/admin/menus_controller.rb +2 -2
  11. data/app/controllers/panda/cms/admin/pages_controller.rb +6 -2
  12. data/app/controllers/panda/cms/admin/posts_controller.rb +3 -1
  13. data/app/controllers/panda/cms/form_submissions_controller.rb +134 -11
  14. data/app/controllers/panda/cms/pages_controller.rb +7 -2
  15. data/app/controllers/panda/cms/posts_controller.rb +16 -0
  16. data/app/helpers/panda/cms/application_helper.rb +2 -3
  17. data/app/helpers/panda/cms/asset_helper.rb +14 -72
  18. data/app/helpers/panda/cms/forms_helper.rb +60 -0
  19. data/app/helpers/panda/cms/seo_helper.rb +85 -0
  20. data/app/javascript/panda/cms/{application_panda_cms.js → application.js} +4 -0
  21. data/app/javascript/panda/cms/controllers/editor_form_controller.js +3 -3
  22. data/app/javascript/panda/cms/controllers/editor_iframe_controller.js +35 -8
  23. data/app/javascript/panda/cms/controllers/file_upload_controller.js +165 -0
  24. data/app/javascript/panda/cms/controllers/index.js +6 -0
  25. data/app/javascript/panda/cms/controllers/menu_form_controller.js +14 -1
  26. data/app/javascript/panda/cms/controllers/page_form_controller.js +454 -0
  27. data/app/javascript/panda/cms/stimulus-loading.js +2 -1
  28. data/app/jobs/panda/cms/record_visit_job.rb +2 -1
  29. data/app/models/panda/cms/menu.rb +12 -0
  30. data/app/models/panda/cms/page.rb +106 -0
  31. data/app/models/panda/cms/post.rb +97 -0
  32. data/app/models/panda/cms/visit.rb +16 -1
  33. data/app/services/panda/social/instagram_feed_service.rb +54 -54
  34. data/app/views/layouts/homepage.html.erb +1 -4
  35. data/app/views/layouts/page.html.erb +1 -4
  36. data/app/views/panda/cms/admin/dashboard/show.html.erb +11 -4
  37. data/app/views/panda/cms/admin/files/index.html.erb +1 -1
  38. data/app/views/panda/cms/admin/forms/new.html.erb +1 -1
  39. data/app/views/panda/cms/admin/forms/show.html.erb +3 -3
  40. data/app/views/panda/cms/admin/menus/_menu_item_fields.html.erb +3 -3
  41. data/app/views/panda/cms/admin/menus/edit.html.erb +12 -14
  42. data/app/views/panda/cms/admin/menus/index.html.erb +1 -1
  43. data/app/views/panda/cms/admin/menus/new.html.erb +6 -8
  44. data/app/views/panda/cms/admin/pages/edit.html.erb +213 -20
  45. data/app/views/panda/cms/admin/pages/index.html.erb +6 -6
  46. data/app/views/panda/cms/admin/posts/_form.html.erb +47 -8
  47. data/app/views/panda/cms/admin/posts/edit.html.erb +1 -1
  48. data/app/views/panda/cms/admin/posts/index.html.erb +4 -4
  49. data/app/views/panda/cms/shared/_favicons.html.erb +7 -7
  50. data/app/views/shared/_header.html.erb +1 -4
  51. data/config/brakeman.ignore +38 -0
  52. data/config/importmap.rb +7 -6
  53. data/config/initializers/groupdate.rb +5 -0
  54. data/config/locales/en.yml +42 -2
  55. data/config/routes.rb +1 -1
  56. data/db/migrate/20240315125421_add_nested_sets_to_panda_cms_pages.rb +0 -10
  57. data/db/migrate/20240316230706_add_nested_to_panda_cms_menu_items.rb +0 -6
  58. data/db/migrate/20240317230622_create_panda_cms_visits.rb +1 -1
  59. data/db/migrate/20240805121123_create_panda_cms_posts.rb +1 -1
  60. data/db/migrate/20240806112735_fix_panda_cms_visits_column_names.rb +1 -1
  61. data/db/migrate/20240923234535_add_depth_to_panda_cms_menus.rb +0 -6
  62. data/db/migrate/20250106223303_add_author_id_to_panda_cms_posts.rb +1 -3
  63. data/db/migrate/20251109131150_add_seo_fields_to_pages.rb +32 -0
  64. data/db/migrate/20251109131205_add_seo_fields_to_posts.rb +27 -0
  65. data/db/migrate/20251110114258_add_spam_tracking_to_form_submissions.rb +7 -0
  66. data/db/migrate/20251110122812_add_performance_indexes_to_pages_and_redirects.rb +13 -0
  67. data/db/migrate/20251117234530_add_index_to_visited_at_on_panda_cms_visits.rb +7 -0
  68. data/db/migrate/20251118015100_backfill_visited_at_for_existing_visits.rb +17 -0
  69. data/db/seeds.rb +5 -0
  70. data/lib/panda/cms/asset_loader.rb +42 -78
  71. data/lib/panda/cms/bulk_editor.rb +288 -12
  72. data/lib/panda/cms/engine/asset_config.rb +49 -0
  73. data/lib/panda/cms/engine/autoload_config.rb +37 -0
  74. data/lib/panda/cms/engine/backtrace_config.rb +42 -0
  75. data/lib/panda/cms/engine/core_config.rb +106 -0
  76. data/lib/panda/cms/engine/helper_config.rb +20 -0
  77. data/lib/panda/cms/engine/route_config.rb +33 -0
  78. data/lib/panda/cms/engine/view_component_config.rb +31 -0
  79. data/lib/panda/cms/engine.rb +32 -228
  80. data/lib/{panda-cms → panda/cms}/version.rb +1 -1
  81. data/lib/panda/cms.rb +12 -0
  82. data/lib/panda-cms.rb +24 -3
  83. data/lib/tasks/ci.rake +0 -0
  84. metadata +32 -67
  85. data/app/assets/builds/panda.cms.css +0 -2754
  86. data/app/assets/stylesheets/panda/cms/application.tailwind.css +0 -162
  87. data/app/assets/stylesheets/panda/cms/editor.css +0 -120
  88. data/app/assets/tailwind/application.css +0 -178
  89. data/app/assets/tailwind/tailwind.config.js +0 -15
  90. data/app/javascript/panda_cms/stimulus-loading.js +0 -39
  91. data/app/views/panda/cms/shared/_importmap.html.erb +0 -34
  92. data/config/initializers/inflections.rb +0 -5
  93. data/config/initializers/panda/cms/healthcheck_log_silencer.rb.disabled +0 -31
  94. data/db/migrate/20240317010532_create_panda_cms_users.rb +0 -14
  95. data/db/migrate/20240324205703_create_active_storage_tables.active_storage.rb +0 -61
  96. data/db/migrate/20240408084718_default_panda_cms_users_admin_to_false.rb +0 -7
  97. data/db/migrate/20240701225422_add_service_name_to_active_storage_blobs.active_storage.rb +0 -24
  98. data/db/migrate/20240701225423_create_active_storage_variant_records.active_storage.rb +0 -30
  99. data/db/migrate/20240701225424_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb +0 -10
  100. data/db/migrate/20241119214548_convert_post_content_to_editor_js.rb +0 -37
  101. data/db/migrate/20250809231125_migrate_users_to_panda_core.rb +0 -113
  102. data/lib/generators/panda/cms/install_generator.rb +0 -28
  103. data/lib/tasks/assets.rake +0 -540
  104. data/public/panda-cms-assets/editor-js/core/editorjs.min.js +0 -83
  105. data/public/panda-cms-assets/editor-js/plugins/embed.min.js +0 -2
  106. data/public/panda-cms-assets/editor-js/plugins/header.min.js +0 -9
  107. data/public/panda-cms-assets/editor-js/plugins/nested-list.min.js +0 -2
  108. data/public/panda-cms-assets/editor-js/plugins/paragraph.min.js +0 -9
  109. data/public/panda-cms-assets/editor-js/plugins/quote.min.js +0 -2
  110. data/public/panda-cms-assets/editor-js/plugins/simple-image.min.js +0 -2
  111. data/public/panda-cms-assets/editor-js/plugins/table.min.js +0 -2
  112. data/public/panda-cms-assets/favicons/android-chrome-192x192.png +0 -0
  113. data/public/panda-cms-assets/favicons/android-chrome-512x512.png +0 -0
  114. data/public/panda-cms-assets/favicons/apple-touch-icon.png +0 -0
  115. data/public/panda-cms-assets/favicons/browserconfig.xml +0 -9
  116. data/public/panda-cms-assets/favicons/favicon-16x16.png +0 -0
  117. data/public/panda-cms-assets/favicons/favicon-32x32.png +0 -0
  118. data/public/panda-cms-assets/favicons/favicon.ico +0 -0
  119. data/public/panda-cms-assets/favicons/mstile-150x150.png +0 -0
  120. data/public/panda-cms-assets/favicons/safari-pinned-tab.svg +0 -61
  121. data/public/panda-cms-assets/favicons/site.webmanifest +0 -14
  122. data/public/panda-cms-assets/manifest.json +0 -20
  123. data/public/panda-cms-assets/panda-cms-0.7.4.css +0 -26
  124. data/public/panda-cms-assets/panda-cms-0.7.4.js +0 -150
  125. data/public/panda-cms-assets/panda-logo-screenprint.png +0 -0
  126. data/public/panda-cms-assets/panda-nav.png +0 -0
  127. data/public/panda-cms-assets/rich_text_editor.css +0 -568
  128. /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,39 +0,0 @@
1
- // Stimulus loading utilities for Panda CMS
2
- // This provides the loading functionality that would normally come from stimulus-rails
3
-
4
- import { Application } from "@hotwired/stimulus"
5
-
6
- const application = Application.start()
7
-
8
- // Configure debug mode based on environment
9
- const railsEnv = document.body?.dataset?.environment || "production";
10
- application.debug = railsEnv === "development"
11
- window.Stimulus = application
12
-
13
- // Auto-registration functionality
14
- function eagerLoadControllersFrom(context) {
15
- const definitions = []
16
- for (const path of context.keys()) {
17
- const module = context(path)
18
- const controller = module.default
19
- if (controller && path.match(/[_-]controller\.(js|ts)$/)) {
20
- const name = path
21
- .replace(/^.*\//, "")
22
- .replace(/[_-]controller\.(js|ts)$/, "")
23
- .replace(/_/g, "-")
24
- definitions.push({ name, module: controller, filename: path })
25
- }
26
- }
27
- return definitions
28
- }
29
-
30
- function lazyLoadControllersFrom(context) {
31
- return eagerLoadControllersFrom(context)
32
- }
33
-
34
- // Export the functions that stimulus-loading typically provides
35
- export {
36
- application,
37
- eagerLoadControllersFrom,
38
- lazyLoadControllersFrom
39
- }
@@ -1,34 +0,0 @@
1
- <script type="importmap" data-turbo-track="reload">
2
- <%=
3
- # This ended up being the best solution to not drag in the importmap from the host app when we're editing the site
4
- JSON.pretty_generate({
5
- imports: {
6
- # Main loader
7
- "application_panda_cms": asset_path("panda/cms/application_panda_cms.js"),
8
- # Vendored
9
- "@hotwired/turbo": asset_path("panda/cms/@hotwired--turbo.js"),
10
- "@hotwired/stimulus": asset_path("panda/cms/@hotwired--stimulus.js"),
11
- "@hotwired/stimulus-loading": asset_path("panda_cms/stimulus-loading.js"),
12
- "@editorjs/editorjs": asset_path("panda/cms/@editorjs--editorjs.js"),
13
- "tailwindcss-stimulus-components": asset_path("panda/cms/tailwindcss-stimulus-components.js"),
14
- # Our page editor
15
- "panda/cms/editor/plain_text_editor": asset_path("panda/cms/editor/plain_text_editor.js"),
16
- "panda/cms/editor/resource_loader": asset_path("panda/cms/editor/resource_loader.js"),
17
- "panda/cms/editor/editor_js_initializer": asset_path("panda/cms/editor/editor_js_initializer.js"),
18
- "panda/cms/editor/editor_js_config": asset_path("panda/cms/editor/editor_js_config.js"),
19
- "panda/cms/editor/css_extractor": asset_path("panda/cms/editor/css_extractor.js"),
20
- # Our controllers
21
- "panda/cms/controllers/dashboard_controller": asset_path("panda/cms/controllers/dashboard_controller.js"),
22
- "panda/cms/controllers/slug_controller": asset_path("panda/cms/controllers/slug_controller.js"),
23
- "panda/cms/controllers/editor_form_controller": asset_path("panda/cms/controllers/editor_form_controller.js"),
24
- "panda/cms/controllers/editor_iframe_controller": asset_path("panda/cms/controllers/editor_iframe_controller.js"),
25
- "panda/cms/controllers/theme_form_controller": asset_path("panda/cms/controllers/theme_form_controller.js"),
26
- # Main controller loader
27
- "controllers": asset_path("panda/cms/controllers/index.js"),
28
- }
29
- }).html_safe
30
- %>
31
- </script>
32
- <script type="module">
33
- import "application_panda_cms"
34
- </script>
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ActiveSupport::Inflector.inflections(:en) do |inflect|
4
- inflect.acronym "CMS"
5
- end
@@ -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