panda-cms 0.10.0 → 0.10.2

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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -11
  3. data/app/components/panda/cms/code_component.rb +45 -8
  4. data/app/components/panda/cms/menu_component.rb +9 -3
  5. data/app/components/panda/cms/page_menu_component.rb +9 -1
  6. data/app/components/panda/cms/rich_text_component.rb +49 -17
  7. data/app/components/panda/cms/text_component.rb +46 -14
  8. data/app/controllers/panda/cms/admin/menus_controller.rb +2 -2
  9. data/app/controllers/panda/cms/admin/pages_controller.rb +6 -2
  10. data/app/controllers/panda/cms/admin/posts_controller.rb +3 -1
  11. data/app/controllers/panda/cms/form_submissions_controller.rb +134 -11
  12. data/app/controllers/panda/cms/pages_controller.rb +7 -2
  13. data/app/controllers/panda/cms/posts_controller.rb +16 -0
  14. data/app/helpers/panda/cms/application_helper.rb +2 -3
  15. data/app/helpers/panda/cms/asset_helper.rb +14 -72
  16. data/app/helpers/panda/cms/forms_helper.rb +60 -0
  17. data/app/helpers/panda/cms/seo_helper.rb +85 -0
  18. data/app/javascript/panda/cms/{application_panda_cms.js → application.js} +4 -0
  19. data/app/javascript/panda/cms/controllers/editor_iframe_controller.js +31 -4
  20. data/app/javascript/panda/cms/controllers/file_upload_controller.js +165 -0
  21. data/app/javascript/panda/cms/controllers/index.js +6 -0
  22. data/app/javascript/panda/cms/controllers/menu_form_controller.js +14 -1
  23. data/app/javascript/panda/cms/controllers/page_form_controller.js +454 -0
  24. data/app/javascript/panda/cms/stimulus-loading.js +2 -1
  25. data/app/models/panda/cms/menu.rb +12 -0
  26. data/app/models/panda/cms/page.rb +106 -0
  27. data/app/models/panda/cms/post.rb +97 -0
  28. data/app/views/layouts/homepage.html.erb +1 -4
  29. data/app/views/layouts/page.html.erb +1 -4
  30. data/app/views/panda/cms/admin/dashboard/show.html.erb +1 -1
  31. data/app/views/panda/cms/admin/files/index.html.erb +1 -1
  32. data/app/views/panda/cms/admin/forms/show.html.erb +3 -3
  33. data/app/views/panda/cms/admin/menus/_menu_item_fields.html.erb +3 -3
  34. data/app/views/panda/cms/admin/menus/edit.html.erb +12 -14
  35. data/app/views/panda/cms/admin/menus/index.html.erb +1 -1
  36. data/app/views/panda/cms/admin/menus/new.html.erb +5 -7
  37. data/app/views/panda/cms/admin/pages/edit.html.erb +139 -20
  38. data/app/views/panda/cms/admin/pages/index.html.erb +6 -6
  39. data/app/views/panda/cms/admin/posts/_form.html.erb +41 -2
  40. data/app/views/panda/cms/admin/posts/edit.html.erb +1 -1
  41. data/app/views/panda/cms/admin/posts/index.html.erb +4 -4
  42. data/app/views/shared/_header.html.erb +1 -4
  43. data/config/brakeman.ignore +38 -0
  44. data/config/importmap.rb +8 -6
  45. data/config/locales/en.yml +41 -0
  46. data/config/routes.rb +1 -1
  47. data/db/migrate/20251109131150_add_seo_fields_to_pages.rb +32 -0
  48. data/db/migrate/20251109131205_add_seo_fields_to_posts.rb +27 -0
  49. data/db/migrate/20251110114258_add_spam_tracking_to_form_submissions.rb +7 -0
  50. data/db/migrate/20251110122812_add_performance_indexes_to_pages_and_redirects.rb +13 -0
  51. data/lib/panda/cms/asset_loader.rb +27 -77
  52. data/lib/panda/cms/bulk_editor.rb +288 -12
  53. data/lib/panda/cms/engine/asset_config.rb +49 -0
  54. data/lib/panda/cms/engine/autoload_config.rb +19 -0
  55. data/lib/panda/cms/engine/backtrace_config.rb +42 -0
  56. data/lib/panda/cms/engine/core_config.rb +106 -0
  57. data/lib/panda/cms/engine/helper_config.rb +20 -0
  58. data/lib/panda/cms/engine/route_config.rb +34 -0
  59. data/lib/panda/cms/engine/view_component_config.rb +31 -0
  60. data/lib/panda/cms/engine.rb +44 -221
  61. data/lib/panda/cms.rb +10 -0
  62. data/lib/panda-cms/version.rb +1 -1
  63. data/lib/panda-cms.rb +16 -2
  64. metadata +20 -22
  65. data/app/javascript/panda_cms/stimulus-loading.js +0 -39
  66. data/app/views/panda/cms/shared/_importmap.html.erb +0 -34
  67. data/config/initializers/inflections.rb +0 -5
  68. data/lib/tasks/assets.rake +0 -540
@@ -9,243 +9,55 @@ require "panda/cms/railtie"
9
9
 
10
10
  require "invisible_captcha"
11
11
 
12
+ # Load engine configuration modules
13
+ require_relative "engine/autoload_config"
14
+ require_relative "engine/asset_config"
15
+ require_relative "engine/route_config"
16
+ require_relative "engine/core_config"
17
+ require_relative "engine/helper_config"
18
+ require_relative "engine/backtrace_config"
19
+
12
20
  module Panda
13
21
  module CMS
14
22
  class Engine < ::Rails::Engine
15
23
  isolate_namespace Panda::CMS
16
24
 
17
- # Add services directory to autoload paths
18
- config.autoload_paths += %W[
19
- #{root}/app/services
20
- ]
25
+ # Include shared configuration modules from panda-core
26
+ include Panda::Core::Shared::InflectionsConfig
27
+ include Panda::Core::Shared::GeneratorConfig
28
+
29
+ # Include CMS-specific configuration modules
30
+ include AutoloadConfig
31
+ include AssetConfig
32
+ include RouteConfig
33
+ include CoreConfig
34
+ include HelperConfig
35
+ include BacktraceConfig
21
36
 
22
37
  # Session configuration is left to the consuming application
23
38
  # The CMS engine does not impose session store requirements
24
39
 
25
- config.to_prepare do
26
- ApplicationController.helper(::ApplicationHelper)
27
- ApplicationController.helper(Panda::CMS::AssetHelper)
28
- end
29
-
30
- # Set our generators
31
- config.generators do |g|
32
- g.orm :active_record, primary_key_type: :uuid
33
- g.test_framework :rspec, fixture: true
34
- g.fixture_replacement nil
35
- g.view_specs false
36
- g.templates.unshift File.expand_path("../templates", __dir__)
37
- end
38
-
39
- # Make files in public available to the main app (e.g. /panda_cms-assets/favicon.ico)
40
- config.middleware.use Rack::Static,
41
- urls: ["/panda-cms-assets"],
42
- root: Panda::CMS::Engine.root.join("public")
43
-
44
- # Make JavaScript files available for importmap
45
- # Serve from app/javascript with proper MIME types
46
- config.middleware.use Rack::Static,
47
- urls: ["/panda/cms"],
48
- root: Panda::CMS::Engine.root.join("app/javascript"),
49
- header_rules: [
50
- [:all, {"Cache-Control" => Rails.env.development? ? "no-cache, no-store, must-revalidate" : "public, max-age=31536000",
51
- "Content-Type" => "text/javascript; charset=utf-8"}]
52
- ]
53
-
54
40
  # Custom error handling
55
41
  # config.exceptions_app = Panda::CMS::ExceptionsApp.new(exceptions_app: routes)
56
42
 
57
- initializer "panda.cms.assets" do |app|
58
- if Rails.configuration.respond_to?(:assets)
59
- # Add JavaScript paths
60
- app.config.assets.paths << root.join("app/javascript")
61
- app.config.assets.paths << root.join("app/javascript/panda")
62
- app.config.assets.paths << root.join("app/javascript/panda/cms")
63
- app.config.assets.paths << root.join("app/javascript/panda/cms/controllers")
64
-
65
- # Make sure these files are precompiled
66
- app.config.assets.precompile += %w[
67
- panda_cms_manifest.js
68
- panda/cms/controllers/**/*.js
69
- panda/cms/application_panda_cms.js
70
- ]
71
- end
72
- end
73
-
74
- # Add importmap paths from the engine
75
- initializer "panda.cms.importmap", before: "importmap" do |app|
76
- if app.config.respond_to?(:importmap)
77
- # Create a new array if frozen
78
- app.config.importmap.paths = app.config.importmap.paths.dup if app.config.importmap.paths.frozen?
79
-
80
- # Add our paths
81
- app.config.importmap.paths << root.join("config/importmap.rb")
82
-
83
- # Handle cache sweepers similarly
84
- if app.config.importmap.cache_sweepers.frozen?
85
- app.config.importmap.cache_sweepers = app.config.importmap.cache_sweepers.dup
86
- end
87
- app.config.importmap.cache_sweepers << root.join("app/javascript")
88
- end
89
- end
90
-
91
- # Auto-mount CMS routes
92
- config.after_initialize do |app|
93
- # Append routes to the routes file
94
- app.routes.append do
95
- mount Panda::CMS::Engine => "/", :as => "panda_cms"
96
- post "/_forms/:id", to: "panda/cms/form_submissions#create", as: :panda_cms_form_submit
97
- get "/_maintenance", to: "panda/cms/errors#error_503", as: :panda_cms_maintenance
98
-
99
- # Catch-all route for CMS pages, but exclude admin paths and assets
100
- admin_path = Panda::Core.config.admin_path.delete_prefix("/")
101
- constraints = ->(request) {
102
- !request.path.start_with?("/#{admin_path}") &&
103
- !request.path.start_with?("/panda-cms-assets/")
104
- }
105
- get "/*path", to: "panda/cms/pages#show", as: :panda_cms_page, constraints: constraints
106
-
107
- root to: "panda/cms/pages#root"
108
- end
109
- end
110
-
111
- initializer "#{engine_name}.backtrace_cleaner" do |_app|
112
- engine_root_regex = Regexp.escape(root.to_s + File::SEPARATOR)
113
-
114
- # Clean those ERB lines, we don't need the internal autogenerated
115
- # ERB method, what we do need (line number in ERB file) is already there
116
- Rails.backtrace_cleaner.add_filter do |line|
117
- line.sub(/(\.erb:\d+):in `__.*$/, '\\1')
118
- end
119
-
120
- # Remove our own engine's path prefix, even if it's
121
- # being used from a local path rather than the gem directory.
122
- Rails.backtrace_cleaner.add_filter do |line|
123
- line.sub(/^#{engine_root_regex}/, "#{engine_name} ")
124
- end
125
-
126
- # Keep Umlaut's own stacktrace in the backtrace -- we have to remove Rails
127
- # silencers and re-add them how we want.
128
- Rails.backtrace_cleaner.remove_silencers!
43
+ # Authentication is now handled by Panda::Core::Engine
129
44
 
130
- # Silence what Rails silenced, UNLESS it looks like
131
- # it's from Umlaut engine
132
- Rails.backtrace_cleaner.add_silencer do |line|
133
- (line !~ Rails::BacktraceCleaner::APP_DIRS_PATTERN) &&
134
- (line !~ /^#{engine_root_regex}/) &&
135
- (line !~ /^#{engine_name} /)
45
+ # Load the engine's importmap
46
+ # This keeps the engine's JavaScript separate from the app's importmap
47
+ initializer "panda_cms.importmap", before: "importmap" do |app|
48
+ Panda::CMS.importmap = Importmap::Map.new.tap do |map|
49
+ map.draw(Panda::CMS::Engine.root.join("config/importmap.rb"))
136
50
  end
137
51
  end
138
52
 
139
- # Set up ViewComponent
140
- initializer "panda.cms.view_component" do |app|
141
- app.config.view_component.preview_paths ||= []
142
- app.config.view_component.preview_paths << root.join("spec/components/previews")
143
- app.config.view_component.generate.sidecar = true
144
- app.config.view_component.generate.preview = true
145
-
146
- # Add preview directories to autoload paths in development
147
- if Rails.env.development?
148
- # Handle frozen autoload_paths array
149
- if app.config.autoload_paths.frozen?
150
- app.config.autoload_paths = app.config.autoload_paths.dup
151
- end
152
- app.config.autoload_paths << root.join("spec/components/previews")
153
- end
154
- end
155
-
156
- # Authentication is now handled by Panda::Core::Engine
157
-
158
- # Configure Core for CMS (runs before app initializers so apps can override)
159
- initializer "panda.cms.configure_core", before: :load_config_initializers do |app|
160
- Panda::Core.configure do |config|
161
- # Core now provides the admin interface foundation
162
- # Apps using CMS can customize login_logo_path, login_page_title, etc. in their own initializers
163
-
164
- # Register CMS navigation items
165
- config.admin_navigation_items = ->(user) {
166
- items = []
167
-
168
- # Dashboard
169
- items << {
170
- path: "#{config.admin_path}/cms",
171
- label: "Dashboard",
172
- icon: "fa-solid fa-house"
173
- }
174
-
175
- # Pages
176
- items << {
177
- path: "#{config.admin_path}/cms/pages",
178
- label: "Pages",
179
- icon: "fa-solid fa-file"
180
- }
181
-
182
- # Collections (if enabled)
183
- if Panda::CMS::Features.enabled?(:collections)
184
- items << {
185
- path: "#{config.admin_path}/cms/collections",
186
- label: "Collections",
187
- icon: "fa-solid fa-table-cells"
188
- }
189
- end
190
-
191
- # Posts
192
- items << {
193
- path: "#{config.admin_path}/cms/posts",
194
- label: "Posts",
195
- icon: "fa-solid fa-newspaper"
196
- }
197
-
198
- # Forms
199
- items << {
200
- path: "#{config.admin_path}/cms/forms",
201
- label: "Forms",
202
- icon: "fa-solid fa-inbox"
203
- }
204
-
205
- # Files
206
- items << {
207
- path: "#{config.admin_path}/cms/files",
208
- label: "Files",
209
- icon: "fa-solid fa-image"
210
- }
211
-
212
- # Menus
213
- items << {
214
- path: "#{config.admin_path}/cms/menus",
215
- label: "Menus",
216
- icon: "fa-solid fa-bars"
217
- }
218
-
219
- # Settings
220
- items << {
221
- path: "#{config.admin_path}/cms/settings",
222
- label: "Settings",
223
- icon: "fa-solid fa-gear"
224
- }
225
-
226
- items
227
- }
228
-
229
- # Redirect to CMS dashboard after login
230
- # Apps can override this if they want different behavior
231
- config.dashboard_redirect_path = -> { "#{Panda::Core.config.admin_path}/cms" }
232
-
233
- # Customize initial breadcrumb
234
- config.initial_admin_breadcrumb = ->(controller) {
235
- # Use CMS dashboard path - just use the string path
236
- ["Admin", "#{config.admin_path}/cms"]
237
- }
238
-
239
- # Dashboard widgets
240
- config.admin_dashboard_widgets = ->(user) {
241
- widgets = []
242
-
243
- # TODO: Add CMS statistics widgets when StatisticsComponent is implemented
244
- # This was removed along with Pro code migration
245
-
246
- widgets
247
- }
248
- end
53
+ # Static asset middleware for serving public files
54
+ # JavaScript serving is handled by Panda::Core::ModuleRegistry::JavaScriptMiddleware
55
+ initializer "panda.cms.static_assets" do |app|
56
+ # Serve public assets (CSS, images, etc.)
57
+ # JavaScript is served by ModuleRegistry's JavaScriptMiddleware in panda-core
58
+ app.config.middleware.use Rack::Static,
59
+ urls: ["/panda-cms-assets"],
60
+ root: Panda::CMS::Engine.root.join("public")
249
61
  end
250
62
  end
251
63
 
@@ -254,3 +66,14 @@ module Panda
254
66
  class BlockError < StandardError; end
255
67
  end
256
68
  end
69
+
70
+ # Register CMS module with ModuleRegistry for JavaScript serving
71
+ Panda::Core::ModuleRegistry.register(
72
+ gem_name: "panda-cms",
73
+ engine: "Panda::CMS::Engine",
74
+ paths: {
75
+ views: "app/views/panda/cms/**/*.erb",
76
+ components: "app/components/panda/cms/**/*.rb"
77
+ # JavaScript paths are auto-discovered from config/importmap.rb
78
+ }
79
+ )
data/lib/panda/cms.rb CHANGED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "panda/cms/engine"
4
+
5
+ module Panda
6
+ module CMS
7
+ # Store the engine's importmap separately from the app's
8
+ mattr_accessor :importmap
9
+ end
10
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Panda
4
4
  module CMS
5
- VERSION = "0.10.0"
5
+ VERSION = "0.10.2"
6
6
  end
7
7
  end
data/lib/panda-cms.rb CHANGED
@@ -3,13 +3,12 @@
3
3
  require "rubygems"
4
4
  require "panda/core"
5
5
  require "panda/cms/railtie"
6
- require "view_component"
7
6
 
8
7
  module Panda
9
8
  module CMS
10
9
  class Configuration
11
10
  attr_accessor :title, :require_login_to_view, :authentication,
12
- :posts, :url, :instagram, :analytics
11
+ :posts, :url, :instagram, :analytics, :performance
13
12
 
14
13
  def initialize
15
14
  @title = "Demo Site"
@@ -28,6 +27,21 @@ module Panda
28
27
  tracking_id: nil
29
28
  }
30
29
  }
30
+ @performance = {
31
+ http_caching: {
32
+ enabled: true,
33
+ public: true
34
+ },
35
+ fragment_caching: {
36
+ enabled: true,
37
+ expires_in: 1.hour
38
+ },
39
+ cache_store: {
40
+ type: :memory_store, # :memory_store, :redis_cache_store, :file_store
41
+ redis_url: ENV.fetch("REDIS_URL", "redis://localhost:6379/0"),
42
+ namespace: "panda_cms"
43
+ }
44
+ }
31
45
  end
32
46
  end
33
47
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Otaina Limited
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 3.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 3.8.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: down
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -248,20 +248,6 @@ dependencies:
248
248
  - - ">="
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
- - !ruby/object:Gem::Dependency
252
- name: view_component
253
- requirement: !ruby/object:Gem::Requirement
254
- requirements:
255
- - - ">="
256
- - !ruby/object:Gem::Version
257
- version: '0'
258
- type: :runtime
259
- prerelease: false
260
- version_requirements: !ruby/object:Gem::Requirement
261
- requirements:
262
- - - ">="
263
- - !ruby/object:Gem::Version
264
- version: '0'
265
251
  email:
266
252
  - james@otaina.co.uk
267
253
  executables: []
@@ -302,28 +288,31 @@ files:
302
288
  - app/helpers/panda/cms/admin/posts_helper.rb
303
289
  - app/helpers/panda/cms/application_helper.rb
304
290
  - app/helpers/panda/cms/asset_helper.rb
291
+ - app/helpers/panda/cms/forms_helper.rb
305
292
  - app/helpers/panda/cms/pages_helper.rb
306
293
  - app/helpers/panda/cms/posts_helper.rb
294
+ - app/helpers/panda/cms/seo_helper.rb
307
295
  - app/helpers/panda/cms/theme_helper.rb
308
296
  - app/javascript/panda/cms/@editorjs--editorjs.js
309
297
  - app/javascript/panda/cms/@hotwired--stimulus.js
310
298
  - app/javascript/panda/cms/@hotwired--turbo.js
311
299
  - app/javascript/panda/cms/@rails--actioncable--src.js
312
- - app/javascript/panda/cms/application_panda_cms.js
300
+ - app/javascript/panda/cms/application.js
313
301
  - app/javascript/panda/cms/controllers/code_editor_controller.js
314
302
  - app/javascript/panda/cms/controllers/dashboard_controller.js
315
303
  - app/javascript/panda/cms/controllers/editor_form_controller.js
316
304
  - app/javascript/panda/cms/controllers/editor_iframe_controller.js
317
305
  - app/javascript/panda/cms/controllers/file_gallery_controller.js
306
+ - app/javascript/panda/cms/controllers/file_upload_controller.js
318
307
  - app/javascript/panda/cms/controllers/index.js
319
308
  - app/javascript/panda/cms/controllers/inline_code_editor_controller.js
320
309
  - app/javascript/panda/cms/controllers/menu_form_controller.js
321
310
  - app/javascript/panda/cms/controllers/nested_form_controller.js
311
+ - app/javascript/panda/cms/controllers/page_form_controller.js
322
312
  - app/javascript/panda/cms/controllers/slug_controller.js
323
313
  - app/javascript/panda/cms/controllers/tree_controller.js
324
314
  - app/javascript/panda/cms/stimulus-loading.js
325
315
  - app/javascript/panda/cms/tailwindcss-stimulus-components.js
326
- - app/javascript/panda_cms/stimulus-loading.js
327
316
  - app/jobs/panda/cms/application_job.rb
328
317
  - app/jobs/panda/cms/record_visit_job.rb
329
318
  - app/mailers/panda/cms/application_mailer.rb
@@ -375,11 +364,10 @@ files:
375
364
  - app/views/panda/cms/form_mailer/notification_email.html.erb
376
365
  - app/views/panda/cms/shared/_editor.html.erb
377
366
  - app/views/panda/cms/shared/_favicons.html.erb
378
- - app/views/panda/cms/shared/_importmap.html.erb
379
367
  - app/views/shared/_footer.html.erb
380
368
  - app/views/shared/_header.html.erb
369
+ - config/brakeman.ignore
381
370
  - config/importmap.rb
382
- - config/initializers/inflections.rb
383
371
  - config/initializers/panda/cms.rb
384
372
  - config/initializers/panda/cms/form_errors.rb
385
373
  - config/initializers/panda/cms/healthcheck_log_silencer.rb.disabled
@@ -437,6 +425,10 @@ files:
437
425
  - db/migrate/20251104172242_add_page_type_to_panda_cms_pages.rb
438
426
  - db/migrate/20251104172638_set_page_types_for_existing_pages.rb
439
427
  - db/migrate/20251105000001_add_pending_review_status_to_pages_and_posts.panda_cms.rb
428
+ - db/migrate/20251109131150_add_seo_fields_to_pages.rb
429
+ - db/migrate/20251109131205_add_seo_fields_to_posts.rb
430
+ - db/migrate/20251110114258_add_spam_tracking_to_form_submissions.rb
431
+ - db/migrate/20251110122812_add_performance_indexes_to_pages_and_redirects.rb
440
432
  - db/migrate/migrate
441
433
  - db/seeds.rb
442
434
  - lib/generators/panda/cms/install_generator.rb
@@ -448,11 +440,17 @@ files:
448
440
  - lib/panda/cms/debug.rb
449
441
  - lib/panda/cms/demo_site_generator.rb
450
442
  - lib/panda/cms/engine.rb
443
+ - lib/panda/cms/engine/asset_config.rb
444
+ - lib/panda/cms/engine/autoload_config.rb
445
+ - lib/panda/cms/engine/backtrace_config.rb
446
+ - lib/panda/cms/engine/core_config.rb
447
+ - lib/panda/cms/engine/helper_config.rb
448
+ - lib/panda/cms/engine/route_config.rb
449
+ - lib/panda/cms/engine/view_component_config.rb
451
450
  - lib/panda/cms/exceptions_app.rb
452
451
  - lib/panda/cms/features.rb
453
452
  - lib/panda/cms/railtie.rb
454
453
  - lib/panda/cms/slug.rb
455
- - lib/tasks/assets.rake
456
454
  - lib/tasks/panda/cms/install.rake
457
455
  - lib/tasks/panda/cms/migrations.rake
458
456
  - lib/tasks/panda/social/instagram.rake
@@ -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