comfy_middle_seat 3.2.1 → 4.0.1

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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -4
  3. data/CONTRIBUTING.md +8 -5
  4. data/Gemfile +1 -1
  5. data/README.md +60 -20
  6. data/Rakefile +3 -3
  7. data/app/assets/javascripts/comfy/admin/cms/application.js +1 -0
  8. data/app/assets/javascripts/comfy/admin/cms/base.js +4 -1
  9. data/app/assets/javascripts/comfy/admin/cms/codemirror.js +17 -0
  10. data/app/assets/javascripts/comfy/admin/cms/draft_forms.js +468 -0
  11. data/app/assets/javascripts/comfy/admin/cms/page_fragments.js +393 -22
  12. data/app/assets/javascripts/comfy/admin/cms/wysiwyg.js +21 -0
  13. data/app/assets/javascripts/comfy/vendor/redactor/filemanager.js +48 -30
  14. data/app/assets/javascripts/comfy/vendor/redactor/imagemanager.js +43 -25
  15. data/app/assets/stylesheets/comfy/admin/cms/base.sass +23 -0
  16. data/app/controllers/comfy/admin/base_controller.rb +3 -3
  17. data/app/controllers/comfy/admin/cms/base_controller.rb +12 -7
  18. data/app/controllers/comfy/admin/cms/files_controller.rb +1 -1
  19. data/app/controllers/comfy/admin/cms/pages_controller.rb +76 -16
  20. data/app/controllers/comfy/admin/cms/revisions/base_controller.rb +39 -1
  21. data/app/controllers/comfy/admin/cms/revisions/page_controller.rb +9 -8
  22. data/app/controllers/comfy/admin/cms/revisions/translation_controller.rb +14 -8
  23. data/app/controllers/comfy/admin/cms/sites_controller.rb +1 -1
  24. data/app/controllers/comfy/admin/cms/translations_controller.rb +3 -1
  25. data/app/controllers/comfy/cms/base_controller.rb +1 -1
  26. data/app/controllers/comfy/cms/content_controller.rb +5 -5
  27. data/app/controllers/concerns/comfy/reorder_action.rb +24 -4
  28. data/app/helpers/comfy/admin/cms_helper.rb +24 -3
  29. data/app/helpers/comfy/cms_helper.rb +1 -1
  30. data/app/models/comfy/cms/file.rb +25 -3
  31. data/app/models/comfy/cms/layout.rb +8 -6
  32. data/app/models/comfy/cms/page.rb +22 -0
  33. data/app/models/comfy/cms/site.rb +3 -3
  34. data/app/models/comfy/cms/snippet.rb +8 -3
  35. data/app/models/concerns/comfy/cms/with_fragments.rb +2 -2
  36. data/app/views/comfy/admin/cms/categories/_index.html.haml +1 -1
  37. data/app/views/comfy/admin/cms/categories/_show.html.haml +1 -1
  38. data/app/views/comfy/admin/cms/files/_file.html.haml +1 -1
  39. data/app/views/comfy/admin/cms/files/index.html.haml +9 -2
  40. data/app/views/comfy/admin/cms/fragments/_form_fragments.html.haml +2 -2
  41. data/app/views/comfy/admin/cms/pages/_form.html.haml +2 -1
  42. data/app/views/comfy/admin/cms/pages/_index_branch.html.haml +11 -10
  43. data/app/views/comfy/admin/cms/pages/edit.html.haml +3 -1
  44. data/app/views/comfy/admin/cms/pages/index.html.haml +9 -2
  45. data/app/views/comfy/admin/cms/pages/new.html.haml +3 -1
  46. data/app/views/comfy/admin/cms/pages/toggle_branch.js.erb +2 -2
  47. data/app/views/comfy/admin/cms/revisions/show.html.haml +25 -7
  48. data/app/views/comfy/admin/cms/shared/_search.html.haml +9 -0
  49. data/app/views/comfy/admin/cms/sites/_form.html.haml +1 -1
  50. data/app/views/comfy/admin/cms/translations/_form.html.haml +2 -1
  51. data/app/views/comfy/admin/cms/translations/edit.html.haml +3 -1
  52. data/app/views/comfy/admin/cms/translations/new.html.haml +3 -1
  53. data/app/views/layouts/comfy/admin/cms/_flash.html.haml +1 -1
  54. data/app/views/layouts/comfy/admin/cms/_head.html.haml +3 -1
  55. data/app/views/layouts/comfy/admin/cms/_left.html.haml +1 -1
  56. data/comfy_middle_seat.gemspec +10 -5
  57. data/config/application.rb +2 -2
  58. data/config/cms_routes.rb +1 -1
  59. data/config/environment.rb +1 -1
  60. data/config/environments/development.rb +1 -1
  61. data/config/environments/production.rb +1 -1
  62. data/config/environments/test.rb +1 -1
  63. data/config/initializers/{comfortable_media_surfer.rb → comfy_middle_seat.rb} +4 -4
  64. data/config/locales/ar.yml +12 -0
  65. data/config/locales/ca.yml +12 -0
  66. data/config/locales/cs.yml +12 -0
  67. data/config/locales/da.yml +12 -0
  68. data/config/locales/de.yml +12 -0
  69. data/config/locales/en.yml +12 -0
  70. data/config/locales/es.yml +12 -0
  71. data/config/locales/fi.yml +12 -0
  72. data/config/locales/fr.yml +12 -0
  73. data/config/locales/gr.yml +12 -0
  74. data/config/locales/hr.yml +12 -0
  75. data/config/locales/it.yml +12 -0
  76. data/config/locales/ja.yml +12 -0
  77. data/config/locales/nb.yml +12 -0
  78. data/config/locales/nl.yml +12 -0
  79. data/config/locales/pl.yml +12 -0
  80. data/config/locales/pt-BR.yml +12 -0
  81. data/config/locales/ru.yml +12 -0
  82. data/config/locales/sk.yml +12 -0
  83. data/config/locales/sv.yml +12 -0
  84. data/config/locales/tr.yml +12 -0
  85. data/config/locales/uk.yml +12 -0
  86. data/config/locales/zh-CN.yml +12 -0
  87. data/config/locales/zh-TW.yml +12 -0
  88. data/config.ru +1 -1
  89. data/exe/comfy-middle-seat-upgrade +34 -0
  90. data/lib/{comfortable_media_surfer → comfy_middle_seat}/access_control/admin_authentication.rb +4 -4
  91. data/lib/{comfortable_media_surfer → comfy_middle_seat}/access_control/admin_authorization.rb +1 -1
  92. data/lib/{comfortable_media_surfer → comfy_middle_seat}/access_control/public_authentication.rb +1 -1
  93. data/lib/{comfortable_media_surfer → comfy_middle_seat}/access_control/public_authorization.rb +1 -1
  94. data/lib/{comfortable_media_surfer → comfy_middle_seat}/configuration.rb +7 -7
  95. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/block.rb +1 -1
  96. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/params_parser.rb +1 -1
  97. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/renderer.rb +10 -10
  98. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tag.rb +4 -4
  99. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/asset.rb +4 -4
  100. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/audio.rb +3 -3
  101. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/breadcrumbs.rb +3 -3
  102. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/checkbox.rb +3 -3
  103. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/children.rb +3 -3
  104. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/date.rb +3 -3
  105. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/datetime.rb +3 -3
  106. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/file.rb +5 -5
  107. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/file_link.rb +4 -4
  108. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/files.rb +3 -3
  109. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/fragment.rb +2 -2
  110. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/helper.rb +4 -4
  111. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/image.rb +4 -4
  112. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/markdown.rb +3 -3
  113. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/mixins/file_content.rb +1 -1
  114. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/number.rb +3 -3
  115. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/page_file_link.rb +5 -5
  116. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/partial.rb +4 -4
  117. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/siblings.rb +3 -3
  118. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/snippet.rb +3 -3
  119. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/template.rb +4 -4
  120. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/text.rb +3 -3
  121. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/textarea.rb +3 -3
  122. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/wysiwyg.rb +3 -3
  123. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags.rb +1 -1
  124. data/lib/{comfortable_media_surfer → comfy_middle_seat}/content.rb +1 -1
  125. data/lib/{comfortable_media_surfer → comfy_middle_seat}/engine.rb +4 -4
  126. data/lib/{comfortable_media_surfer → comfy_middle_seat}/error.rb +4 -4
  127. data/lib/{comfortable_media_surfer → comfy_middle_seat}/extensions/acts_as_tree.rb +3 -3
  128. data/lib/{comfortable_media_surfer → comfy_middle_seat}/extensions/has_revisions.rb +4 -4
  129. data/lib/{comfortable_media_surfer → comfy_middle_seat}/extensions.rb +1 -1
  130. data/lib/{comfortable_media_surfer → comfy_middle_seat}/form_builder.rb +2 -2
  131. data/lib/comfy_middle_seat/initializer_upgrader.rb +115 -0
  132. data/lib/{comfortable_media_surfer → comfy_middle_seat}/render_methods.rb +7 -7
  133. data/lib/{comfortable_media_surfer → comfy_middle_seat}/routing.rb +3 -2
  134. data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/file/exporter.rb +5 -5
  135. data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/file/importer.rb +5 -5
  136. data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/layout/exporter.rb +4 -4
  137. data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/layout/importer.rb +5 -5
  138. data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/page/exporter.rb +5 -5
  139. data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/page/importer.rb +7 -7
  140. data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/snippet/exporter.rb +4 -4
  141. data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/snippet/importer.rb +5 -5
  142. data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds.rb +4 -4
  143. data/lib/comfy_middle_seat/version.rb +2 -2
  144. data/lib/{comfortable_media_surfer → comfy_middle_seat}/view_hooks.rb +2 -2
  145. data/lib/comfy_middle_seat.rb +54 -1
  146. data/lib/generators/comfy/cms/README +3 -11
  147. data/lib/generators/comfy/cms/cms_generator.rb +2 -2
  148. data/lib/generators/comfy/scaffold/templates/tests/controller.rb.tt +2 -2
  149. data/lib/tasks/cms_seeds.rake +8 -8
  150. data/package-lock.json +2 -2
  151. data/package.json +1 -1
  152. metadata +67 -62
  153. data/lib/comfortable_media_surfer/version.rb +0 -3
  154. data/lib/comfortable_media_surfer.rb +0 -56
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4b2154b0c5ddc39354f9407955841c380dd85c70f4f3cbcddcf3e11fbefa352
4
- data.tar.gz: '06858e762e783ff3862dd9400acc853f8e1481e6fc52098294ba40f2afeea65c'
3
+ metadata.gz: c2b743bb8f3cdbae17801963c031a890072c7b4694336e155dd0d381a49ec2ff
4
+ data.tar.gz: c73a92f4aa40a06760914731d40cd0c9f7471b5abf20aa3710f522d300353f84
5
5
  SHA512:
6
- metadata.gz: c892bc46404adb3d6573811baf8a7406dfe85bb8251a6954b2a5ecec043872bc818aa4cc2c67ab925bf3f0170cc8afc8a112d0341ea64a8f4e623a5f993b7fd2
7
- data.tar.gz: 1e1be00b0b164a6e0120694508752af5cf1d0cc4d60acf8e2c1b099229274a40a82968e94076b7535e86008e167ac581da32354e5400320804036ecbcef719bc
6
+ metadata.gz: edd044c383fafb4c9c310df6c83e35f365fa5aeac4052f844f0fd8051a89b1b63564af6ad6ddc5a12637a866b700f34ce3342d077ca9e54dacf20b35a3ccec2a
7
+ data.tar.gz: 204fac7b1e4c2b3bfc3677529fede906334ffe97cdda1180a24c19a40c6b8175b0a13e6635b2d5d1ad78cb87e9fdd1c62c604f057f28193ca23065d6375b3374
data/CHANGELOG.md CHANGED
@@ -12,10 +12,26 @@ This changelog follows the project's lineage: **Comfortable Mexican Sofa → Com
12
12
 
13
13
  ## [Unreleased]
14
14
 
15
+ ### Changed
16
+
17
+ - Complete the implementation namespace and internal-path decoupling from Comfortable Media Surfer: current Ruby APIs now use `ComfyMiddleSeat`, library files live under `comfy_middle_seat`, and generated configuration belongs at `config/initializers/comfy_middle_seat.rb`.
18
+ - Require applications upgrading from `comfortable_media_surfer` to rename the initializer and replace Ruby configuration or integration references from `ComfortableMediaSurfer` to `ComfyMiddleSeat`. The existing `comfy_cms_*` database tables, schema, and stored data remain unchanged, so no database migration is required.
19
+ - Add the standalone `comfy-middle-seat-upgrade` executable to safely preview and convert a legacy initializer without booting Rails, preserving the original as a backup and refusing ambiguous or destructive changes.
20
+ - Preserve Comfortable Media Surfer names and URLs where they describe project history, acknowledgements, inherited release notes, or upstream resources rather than the current API.
21
+
22
+ ## [v3.2.1] - 2026-09-17
23
+
15
24
  ### Fixed
16
25
 
17
26
  - Fix CI eager loading after the gem rename by excluding the explicitly required `comfy_middle_seat` entrypoint and version directory from Zeitwerk autoloading. Add a regression test that also checks eager loading outside CI.
18
27
 
28
+ ### Changed
29
+
30
+ - At the time of this release, update the admin footer branding and repository link to Comfy Middle Seat while retaining the then-current `ComfortableMediaSurfer::VERSION` compatibility constant.
31
+ - Check that `COVERALLS_REPO_TOKEN` is configured before running the coverage job, with a clear error when it is missing.
32
+ - Document asset compilation and explicit test database setup, along with commands for running the main and browser/system test suites.
33
+ - Update README badges and release documentation, preserving the distinction between Seat releases and inherited Surfer history.
34
+
19
35
  ## [v3.2.0] - 2026-09-17
20
36
 
21
37
  **First Comfy Middle Seat release.** Forked from [Comfortable Media Surfer](https://github.com/shakacode/comfortable-media-surfer), itself a revival of [Comfortable Mexican Sofa](https://github.com/comfy/comfortable-mexican-sofa). The new name keeps the C.M.S. initials and pays homage to the original.
@@ -23,7 +39,7 @@ This changelog follows the project's lineage: **Comfortable Mexican Sofa → Com
23
39
  ### Changed
24
40
 
25
41
  - Publish the gem as `comfy_middle_seat` and rename the gemspec to `comfy_middle_seat.gemspec`.
26
- - Preserve the `ComfortableMediaSurfer` Ruby namespace, configuration, routes, and database tables. Existing Surfer applications do not need a namespace or schema migration for the rename.
42
+ - At the time of v3.2.0, preserve the `ComfortableMediaSurfer` Ruby namespace and configuration while retaining the existing routes and database tables. The Unreleased namespace decoupling supersedes the Ruby compatibility behavior; the database compatibility remains unchanged.
27
43
  - Move the version definition to `lib/comfy_middle_seat/version.rb` for release tooling, retaining a compatibility loader at the old path.
28
44
  - Run the main test suite in six isolated processes by default, with merged coverage and a separate `test:serial` task for Coveralls.
29
45
  - Update CI coverage to Rails 7.2, 8.0, and 8.1, with a separate browser/system test job.
@@ -39,9 +55,9 @@ This changelog follows the project's lineage: **Comfortable Mexican Sofa → Com
39
55
  - Fix file modal cleanup and reinitialization, and expose jQuery for Bootstrap integration.
40
56
  - Remove the unsupported `:escape` option before JSON parsing while preserving other parser options.
41
57
 
42
- ### Upgrading from Surfer
58
+ ### Historical v3.2.0 upgrade behavior
43
59
 
44
- Replace `comfortable_media_surfer` with `comfy_middle_seat` in your Gemfile and run `bundle install`. Do not include both gems. Keep existing `ComfortableMediaSurfer` configuration and initializer names.
60
+ For v3.2.0, users replaced `comfortable_media_surfer` with `comfy_middle_seat` in the Gemfile while keeping the former Ruby namespace and initializer name. That release-specific compatibility guidance is preserved for history but is superseded by the Unreleased change: current upgrades must rename the initializer to `config/initializers/comfy_middle_seat.rb` and replace `ComfortableMediaSurfer` Ruby references with `ComfyMiddleSeat`. Neither stage changes the database schema.
45
61
 
46
62
  ## Comfortable Media Surfer — inherited releases
47
63
 
@@ -170,7 +186,8 @@ First release of `comfortable_media_surfer`. This new gem is a revival of [Comfo
170
186
 
171
187
  - Rebranded **ComfortableMexicanSofa** as **ComfortableMediaSurfer** in order to publish new gem (database table names and schema have not changed).
172
188
 
173
- [Unreleased]: https://github.com/avonderluft/comfy-middle-seat/compare/v3.2.0...master
189
+ [Unreleased]: https://github.com/avonderluft/comfy-middle-seat/compare/v3.2.1...master
190
+ [v3.2.1]: https://github.com/avonderluft/comfy-middle-seat/compare/v3.2.0...v3.2.1
174
191
  [v3.2.0]: https://github.com/avonderluft/comfy-middle-seat/compare/eeb5d590f47b5d6bb70191fb81c781540753fa97...v3.2.0
175
192
  [v3.1.7]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.6...v3.1.7
176
193
  [v3.1.6]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.5...v3.1.6
data/CONTRIBUTING.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Contributing
2
2
 
3
- Contribute your code to ComfortableMediaSurfer in 5 easy steps:
3
+ Contribute to [Comfy Middle Seat](https://github.com/avonderluft/comfy-middle-seat) in five steps:
4
4
 
5
5
  ### 1. Fork it
6
6
 
7
- Fork the project. Optionally, create a branch you want to work on.
7
+ Fork the [current repository](https://github.com/avonderluft/comfy-middle-seat). Optionally, create a branch for your work.
8
8
 
9
9
  ### 2. Get it running locally
10
10
 
@@ -25,9 +25,12 @@ Fork the project. Optionally, create a branch you want to work on.
25
25
 
26
26
  ### 3. Hack away
27
27
 
28
- - Create a few small pull requests instead of a humoungous one. I can merge small stuff faster.
29
- - When adding new code just make sure it follows the same style as the existing code.
30
- - Avoid adding 3rd party dependencies if you can.
28
+ - Use the current `ComfyMiddleSeat` Ruby namespace and `comfy_middle_seat` internal paths. New configuration examples and generated initializers belong in `config/initializers/comfy_middle_seat.rb`; do not reintroduce `ComfortableMediaSurfer` as a current API.
29
+ - Keep the existing `comfy_cms_*` database tables and schema stable. The namespace and internal-path decoupling does not require a database migration.
30
+ - Historical release notes, acknowledgements, and upstream links may intentionally retain the Comfortable Media Surfer name.
31
+ - Create a few small pull requests instead of one huge pull request. Smaller changes can be reviewed and merged faster.
32
+ - When adding new code, make sure it follows the same style as the existing code.
33
+ - Avoid adding third-party dependencies if you can.
31
34
  - Tests please, but nothing complicated. UnitTest / Fixtures all the way. Make sure all tests pass.
32
35
  - Run `bundle exec rubocop` and fix any issues raised.
33
36
 
data/Gemfile CHANGED
@@ -26,7 +26,7 @@ end
26
26
  group :test do
27
27
  gem 'brakeman'
28
28
  gem 'bundler-audit', '~> 0.9.1'
29
- gem 'coveralls_reborn', '~> 0.29.0', require: false
29
+ gem 'coveralls_reborn', require: false
30
30
  gem 'cuprite', '>= 0.15'
31
31
  gem 'diffy'
32
32
  gem 'equivalent-xml', '~> 0.6.0'
data/README.md CHANGED
@@ -1,17 +1,19 @@
1
- [![Rails CI](https://github.com/avonderluft/comfortable-media-surfer/actions/workflows/rubyonrails.yml/badge.svg)](https://github.com/avonderluft/comfortable-media-surfer/actions/workflows/rubyonrails.yml) [![Test Coverage](https://img.shields.io/coverallsCoverage/github/avonderluft/comfy-middle-seat?branch=master&cacheSeconds=300)](https://coveralls.io/github/avonderluft/comfy-middle-seat?branch=master) [![Gem Version](https://img.shields.io/gem/v/comfy_middle_seat.svg?style=flat)](https://rubygems.org/gems/comfy_middle_seat) [![Gem Downloads](https://img.shields.io/gem/dt/comfy_middle_seat.svg?style=flat)](https://rubygems.org/gems/comfy_middle_seat) [![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/avonderluft/comfy-middle-seat?label=last%20release&color=seagreen)](https://github.com/avonderluft/comfortable-media-surfer/releases)
1
+ [![Rails CI](https://github.com/avonderluft/comfy-middle-seat/actions/workflows/rubyonrails.yml/badge.svg)](https://github.com/avonderluft/comfy-middle-seat/actions/workflows/rubyonrails.yml) [![Test Coverage](https://img.shields.io/coverallsCoverage/github/avonderluft/comfy-middle-seat?branch=master&cacheSeconds=300)](https://coveralls.io/github/avonderluft/comfy-middle-seat?branch=master) [![Gem Version](https://img.shields.io/gem/v/comfy_middle_seat.svg?style=flat)](https://rubygems.org/gems/comfy_middle_seat) [![Gem Downloads](https://img.shields.io/gem/dt/comfy_middle_seat.svg?style=flat)](https://rubygems.org/gems/comfy_middle_seat) [![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/avonderluft/comfy-middle-seat?label=last%20release&color=seagreen)](https://github.com/avonderluft/comfy-middle-seat/releases)
2
2
 
3
3
  # Comfy Middle Seat
4
4
 
5
- Comfy Middle Seat is a Rails CMS (Content Management System) engine, published as gem `comfy_middle_seat`. It retains the Comfortable Media Surfer implementation and pays homage to the original Comfortable Mexican Sofa—with the same C.M.S. initials and a new place to sit.
5
+ It all depends on who is sitting on your left and on your right.
6
6
 
7
- The `ComfortableMediaSurfer` Ruby namespace, configuration, and internal paths remain unchanged. Only the gem's public name changes; there is no need to rename existing Surfer initializers or database tables.
7
+ Comfy Middle Seat is a Rails CMS (Content Management System) engine, published as the `comfy_middle_seat` gem. It is descended from Comfortable Media Surfer and pays homage to the original Comfortable Mexican Sofa—with the same C.M.S. initials with a new place to sit.
8
+
9
+ The current implementation uses the `ComfyMiddleSeat` Ruby namespace, `comfy_middle_seat` internal paths, and the initializer `config/initializers/comfy_middle_seat.rb`. Database storage remains compatible: the existing `comfy_cms_*` tables and schema are unchanged, so this namespace change requires no database migration.
8
10
 
9
11
  ## Project History
10
12
 
11
13
  - **[Comfortable Mexican Sofa](https://github.com/comfy/comfortable-mexican-sofa)**, created by Oleg Khabarov, is the original Rails CMS on which this project is built. Oleg deserves the lion's share of kudos.
12
- - **[Occams](https://github.com/avonderluft/occams)** was an attempted revival of Sofa. Andrew vonderLuft was a contributor to [RadiantCMS](https://github.com/radiant/radiant) back in the day, but that project became inactive. He found Sofa and liked it even better than Radiant, but sadly it too became inactive. Hence Occams.
13
- - **[Comfortable Media Surfer](https://github.com/shakacode/comfortable-media-surfer)** revived Sofa under the sponsor ship of ShakaCode, continuing its development for modern Rails applications.
14
- - **Comfy Middle Seat** is a fork of Comfortable Media Surfer, published with a new gem name while retaining the Surfer implementation and API.
14
+ - **[oCcaMS](https://github.com/avonderluft/occams)** was an attempted revival of Sofa. Andrew vonderLuft was a contributor to [RadiantCMS](https://github.com/radiant/radiant) back in the day, but that project became inactive. He found Sofa and liked it even better than Radiant, but sadly it too became inactive. Hence Occams.
15
+ - **[Comfortable Media Surfer](https://github.com/shakacode/comfortable-media-surfer)** revived Sofa under the sponsorship of ShakaCode, continuing its development for modern Rails applications.
16
+ - **[Comfy Middle Seat](https://github.com/avonderluft/comfy-middle-seat)** began as a fork of Comfortable Media Surfer and is now implemented under its own `ComfyMiddleSeat` namespace and `comfy_middle_seat` paths.
15
17
 
16
18
  See the [CHANGELOG](CHANGELOG.md) for the inherited development history, and the original [Sofa releases](https://github.com/comfy/comfortable-mexican-sofa/releases) and [Surfer releases](https://github.com/shakacode/comfortable-media-surfer/releases) for earlier releases.
17
19
 
@@ -44,15 +46,17 @@ Add gem definition to your Gemfile:
44
46
  gem "comfy_middle_seat", "~> 3.2.0"
45
47
  ```
46
48
 
47
- Then from the Rails project's root run:
49
+ Then, for a new installation, run these commands from the Rails project's root:
48
50
 
49
- ```
50
- bundle install
51
- rails generate comfy:cms
52
- rails db:migrate
53
- rails comfy:compile_assets
51
+ ```sh
52
+ bundle install
53
+ rails generate comfy:cms
54
+ rails db:migrate
55
+ rails comfy:compile_assets
54
56
  ```
55
57
 
58
+ `rails db:migrate` is part of a new installation. Applications upgrading from Comfortable Media Surfer already have the same tables and schema and do not need a database migration for the gem, namespace, or internal-path rename.
59
+
56
60
  Now take a look inside your `config/routes.rb` file. You'll see where routes attach for the admin area and content serving. Make sure that content serving route appears as a very last item or it will make all other routes to be inaccessible.
57
61
 
58
62
  ```ruby
@@ -60,24 +64,60 @@ comfy_route :cms_admin, path: "/admin"
60
64
  comfy_route :cms, path: "/"
61
65
  ```
62
66
 
67
+ The generator creates `config/initializers/comfy_middle_seat.rb`. Use `ComfyMiddleSeat` for configuration and other library API references:
68
+
69
+ ```ruby
70
+ ComfyMiddleSeat.configure do |config|
71
+ config.cms_title = "My CMS"
72
+ config.admin_base_controller = "ApplicationController"
73
+ end
74
+
75
+ ComfyMiddleSeat::AccessControl::AdminAuthentication.username = "user"
76
+ ComfyMiddleSeat::AccessControl::AdminAuthentication.password = "change-me"
77
+ ```
78
+
63
79
  ## Converting from Comfortable Media Surfer, Comfortable Mexican Sofa, or Occams
64
80
 
65
81
  ### From Surfer to Middle Seat
66
82
 
67
- Replace `comfortable_media_surfer` in your Gemfile with `comfy_middle_seat` and run `bundle install`. Do not include both gems. Existing `ComfortableMediaSurfer` configuration and database tables remain unchanged.
83
+ 1. Replace `comfortable_media_surfer` in your Gemfile with `comfy_middle_seat` and run `bundle install`. Do not include both gems.
84
+ 2. From the Rails application root, preview and run the standalone initializer upgrader. It does not boot Rails:
85
+
86
+ ```sh
87
+ bundle exec comfy-middle-seat-upgrade --dry-run
88
+ bundle exec comfy-middle-seat-upgrade
89
+ ```
90
+
91
+ It renames `config/initializers/comfortable_media_surfer.rb` to `config/initializers/comfy_middle_seat.rb`, updates the project namespace references inside it, and preserves the original as `config/initializers/comfortable_media_surfer.rb.bak`. It refuses to overwrite an existing initializer or backup.
92
+ 3. In any other application integrations, replace Ruby references to `ComfortableMediaSurfer` with `ComfyMiddleSeat`.
93
+
94
+ For example:
95
+
96
+ ```ruby
97
+ # Before
98
+ ComfortableMediaSurfer.configure do |config|
99
+ config.cms_title = "My CMS"
100
+ end
101
+
102
+ # After
103
+ ComfyMiddleSeat.configure do |config|
104
+ config.cms_title = "My CMS"
105
+ end
106
+ ```
107
+
108
+ Review the converted initializer and remove its `.bak` file when satisfied. The database tables, schema, and stored records remain unchanged; existing `comfy_cms_*` tables are used as-is, and **no database migration is required** for this upgrade.
68
109
 
69
110
  ### From Sofa to Middle Seat
70
111
 
71
- The database structure is the same. Your Sofa project will also need to be upgraded to >= Rails 7.2
72
- Then you should simply be able to update your Gemfile thus, and run bundle
112
+ The database structure is the same, so no database migration is required for the CMS tables. Your Sofa project must first be upgraded to Rails 7.2 or newer. Then update the Gemfile, run `bundle install`, use `config/initializers/comfy_middle_seat.rb`, and update CMS library references in application code to `ComfyMiddleSeat`:
73
113
 
74
114
  ```ruby
75
- gem 'comfy_middle_seat', '~> 3.2.0'
115
+ gem "comfy_middle_seat", "~> 3.2.0"
76
116
  ```
77
117
 
78
118
  ### From Occams to Middle Seat
79
119
 
80
- Again the project must be >= Rails 7.2. Since the schema is different, executing this SQL should get you set for Middle Seat
120
+ The project must be on Rails 7.2 or newer. Unlike Surfer and Sofa, Occams used different table names, so converting an Occams database requires the following SQL. This is an Occams data conversion, not a migration caused by the current `ComfyMiddleSeat` namespace or internal-path change.
81
121
 
82
122
  ```sql
83
123
  ALTER TABLE occams_cms_categories RENAME TO comfy_cms_categories;
@@ -105,7 +145,7 @@ UPDATE active_storage_attachments SET record_type = 'Comfy::Cms::File' WHERE rec
105
145
 
106
146
  After finishing installation you should be able to navigate to http://localhost:3000/admin
107
147
 
108
- Default username and password is 'user' and 'pass'. You probably want to change it right away. Admin credentials (among other things) can be found and changed in your app's CMS initializer: `config/initializers/comfortable_media_surfer.rb`. The initializer retains its Surfer name for compatibility.
148
+ The default username and password are `user` and `pass`. Change them before exposing the application. Admin credentials and other CMS settings are configured in `config/initializers/comfy_middle_seat.rb` through the `ComfyMiddleSeat` namespace.
109
149
 
110
150
  Before creating pages and populating them with content we need to create a Site. Site defines a hostname, content path and its language.
111
151
 
@@ -124,7 +164,7 @@ Once you have a layout, you may start creating pages and populating content. It'
124
164
 
125
165
  ## Documentation
126
166
 
127
- The [Comfortable Media Surfer Wiki](https://github.com/shakacode/comfortable-media-surfer/wiki) remains the upstream reference for the inherited CMS features, including [Content Tags](https://github.com/shakacode/comfortable-media-surfer/wiki/Docs:-Content-Tags). The feature links above also point to that wiki. When following its installation instructions, use the `comfy_middle_seat` gem; Ruby examples using `ComfortableMediaSurfer` retain that namespace.
167
+ The [Comfortable Media Surfer Wiki](https://github.com/shakacode/comfortable-media-surfer/wiki) remains an upstream reference for inherited CMS features, including [Content Tags](https://github.com/shakacode/comfortable-media-surfer/wiki/Docs:-Content-Tags). These historical upstream links are intentionally preserved. When adapting its examples, use the `comfy_middle_seat` gem, `config/initializers/comfy_middle_seat.rb`, and the `ComfyMiddleSeat` Ruby namespace; upstream examples that use `ComfortableMediaSurfer` show the former API and must be updated.
128
168
 
129
169
  ## Add-ons
130
170
 
@@ -136,7 +176,7 @@ If you want to add a Blog functionality to your app take a look at
136
176
 
137
177
  #### Contributing
138
178
 
139
- Comfy Middle Seat can run like any Rails application in development. It's as easy to work on as any other Rails app. For more detail see [CONTRIBUTING](CONTRIBUTING.md). The inherited development instructions may still refer to Comfortable Media Surfer.
179
+ Comfy Middle Seat can run like any Rails application in development. It's as easy to work on as any other Rails app. For more detail, see [CONTRIBUTING](CONTRIBUTING.md).
140
180
 
141
181
  #### Testing
142
182
 
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ require 'stringio'
8
8
 
9
9
  Rails.application.load_tasks
10
10
 
11
- module ComfortableMediaSurferTestOutput
11
+ module ComfyMiddleSeatTestOutput
12
12
  SUMMARY = %r{(?<assertions>\d+) assertions, (?<errors>\d+) errors, (?<failures>\d+) failures, (?<skips>\d+) skips?, (?<tests>\d+) tests}
13
13
  COLORS = { green: 32, yellow: 33, red: 31, cyan: 36 }.freeze
14
14
 
@@ -71,7 +71,7 @@ module ComfortableMediaSurferTestOutput
71
71
  def flush
72
72
  return if @pending.empty?
73
73
 
74
- @io.print ComfortableMediaSurferTestOutput.progress_color(@pending)
74
+ @io.print ComfyMiddleSeatTestOutput.progress_color(@pending)
75
75
  @io.flush
76
76
  @pending.clear
77
77
  end
@@ -197,7 +197,7 @@ namespace :test do
197
197
  Rake::Task['test:serial'].enhance(['test:prepare_serial'])
198
198
 
199
199
  desc 'Run tests in isolated processes'
200
- task(:parallel) { ComfortableMediaSurferTestOutput.run_parallel }
200
+ task(:parallel) { ComfyMiddleSeatTestOutput.run_parallel }
201
201
  end
202
202
 
203
203
  Rake::Task[:test].clear
@@ -15,6 +15,7 @@ import "./base";
15
15
  import "./categories";
16
16
  import "./codemirror";
17
17
  import "./diff";
18
+ import "./draft_forms";
18
19
  import "./file_link";
19
20
  import "./file_upload";
20
21
  import "./files_modal";
@@ -25,15 +25,18 @@
25
25
  CMS.wysiwyg.init();
26
26
  CMS.sortableList.init();
27
27
  CMS.timepicker.init();
28
- CMS.pageFragments();
28
+ CMS.pageFragments.init();
29
29
  CMS.categories();
30
30
  CMS.files.init();
31
31
  CMS.fileLinks();
32
32
  CMS.fileUpload.init();
33
33
  CMS.diff();
34
+ CMS.draftForms.init();
34
35
  };
35
36
 
36
37
  CMS.dispose = () => {
38
+ CMS.pageFragments.dispose();
39
+ CMS.draftForms.dispose();
37
40
  CMS.codemirror.dispose();
38
41
  CMS.wysiwyg.dispose();
39
42
  CMS.files.dispose();
@@ -18,6 +18,9 @@ import "codemirror/mode/htmlmixed/htmlmixed";
18
18
  lineNumbers: true,
19
19
  viewportMargin: Infinity,
20
20
  });
21
+ codemirror.on("change", () => {
22
+ textarea.dispatchEvent(new Event("input", { bubbles: true }));
23
+ });
21
24
  codeMirrorInstances.push(codemirror);
22
25
  }
23
26
 
@@ -33,6 +36,20 @@ import "codemirror/mode/htmlmixed/htmlmixed";
33
36
  }
34
37
  });
35
38
  },
39
+ sync(root = document) {
40
+ for (const codemirror of codeMirrorInstances) {
41
+ if (root.contains(codemirror.getTextArea())) codemirror.save();
42
+ }
43
+ },
44
+ restore(root = document) {
45
+ for (const codemirror of codeMirrorInstances) {
46
+ const textarea = codemirror.getTextArea();
47
+ if (!root.contains(textarea)) continue;
48
+
49
+ codemirror.setValue(textarea.value);
50
+ codemirror.refresh();
51
+ }
52
+ },
36
53
  dispose() {
37
54
  for (const codemirror of codeMirrorInstances) {
38
55
  codemirror.toTextArea();