comfortable_media_surfer 3.1.1 → 3.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e13956535a432a90cf4905da00b95ed763fcf7045666eb2951fa0e61cda1687
4
- data.tar.gz: ffb8456f3b63e657765e1f99f3063cd10e4358fb1ffb8edf889d2d51858618c9
3
+ metadata.gz: df84d4de2393538c878591357b75bd7cc61cb27a3e4eea90acb44ce21579dca1
4
+ data.tar.gz: abef451e22b1a95f3d49ca1dc28ec3d1a4c31034e2f1eda54d88f212e3c78cba
5
5
  SHA512:
6
- metadata.gz: b457c2eaad7e7f76d3f8ae944d9f7dc7f28dbb1a4892e08f4ba3369f4037ab8818c26084abaf84d0e5aee897f9a723d9c5d84616031fb8ad4b70cdf338a29a80
7
- data.tar.gz: bd40c8934a344398aaa8d89be7191ca5d7d0391f1ad544cc9c3faa5e26c91db0dc86f9314cc356b2095ad1e1c474bbb479795dbe348e864e957af79537a8db04
6
+ metadata.gz: 89445969fe9fa29f82adb27e4fe91d07270fc1a9b12eac200daa3a64fd6554acb2213ac27bb9f59215f9e978228b537181265f9c7a3089339bc1f3eea861cdc2
7
+ data.tar.gz: 0a70882548a1298e1406f46828d96f07ab90c53348e2af489bd7998d9f23ba720d563c0072df583a39898918a9301d161245d3d356703b44bbb453643ca06d50
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ # Enable version updates for npm
4
+ - package-ecosystem: "bundler"
5
+ directory: "/" # The root directory where your Gemfile is located
6
+ schedule:
7
+ interval: "monthly" # Options: "daily", "weekly", "monthly"
data/CHANGELOG.md CHANGED
@@ -12,6 +12,34 @@ For all changes prior to the inception of this project, see the [Release History
12
12
 
13
13
  ## [Unreleased]
14
14
 
15
+ ## [v3.1.2] - 2025-05-26
16
+
17
+ ### Fixed
18
+
19
+ - Fixed Expand/Collapse error in Admin/Pages.
20
+ - Include sassc-rails to gemspec, since it is deprecated after rails 7.0.8
21
+ - Update documentation to reflect recent changes
22
+
23
+ ### Added
24
+
25
+ - added migration for Markdown snippets
26
+
27
+ ## [v3.1.1] - 2025-02-08
28
+
29
+ ### Fixed
30
+
31
+ - Fixed scss: use scss imports, not css ones that cannot be resolved by the browser
32
+
33
+ ### Added
34
+
35
+ - Added rake task to compile assets, corresponding post install message
36
+ - Added import Rails from UJS
37
+ - Added missing jQuery import
38
+
39
+ ### Removed
40
+
41
+ - Removed yarn, as not needed
42
+
15
43
  ## [v3.1.0] - 2024-12-31 (gem yanked, pending resolution of [Issue 8](https://github.com/shakacode/comfortable-media-surfer/issues/8)
16
44
 
17
45
  ### Added
@@ -54,6 +82,8 @@ First release of `comfortable_media_surfer`. This new gem is a revival of [Comfo
54
82
 
55
83
  - Rebranded **ComfortableMexicanSofa** as **ComfortableMediaSurfer** in order to publish new gem (database table names and schema have not changed).
56
84
 
57
- [Unreleased]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.0...master
85
+ [Unreleased]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.2...master
86
+ [v3.1.2]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.1...v3.1.2
87
+ [v3.1.1]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.0...v3.1.1
58
88
  [v3.1.0]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.0.0...v3.1.0
59
89
  [v3.0.0]: https://github.com/shakacode/comfortable-media-surfer/compare/v2.0.19...v3.0.0
data/CONTRIBUTING.md CHANGED
@@ -8,15 +8,16 @@ Fork the project. Optionally, create a branch you want to work on.
8
8
 
9
9
  ### 2. Get it running locally
10
10
 
11
- - Install NodeJS and yarn
12
- - Install JS dependencies with `yarn`
13
11
  - Install gem dependencies with `bundle install`
14
12
  - There's nothing to configure, by default database is SQLite so it will be
15
13
  created for you. Just run `bundle exec rake db:migrate`
14
+ - Prepare the environment by running `rails comfy:compile_assets`, and
15
+ `rake db:test:prepare`
16
16
  - Make sure that existing tests are passing by running `bundle exec rake test`
17
17
  - There are system tests that can be run with `bundle exec rake test:system`.
18
18
  You need to have `chromedriver` installed for that.
19
19
  - You should be able to start the app via `bin/rails s` and navigate to http://localhost:3000/admin
20
+ and log in with username 'user' and password 'pass'
20
21
 
21
22
  ### 3. Hack away
22
23
 
data/Gemfile CHANGED
@@ -8,8 +8,8 @@ gemspec
8
8
  gem 'rails', '~> 8.0'
9
9
 
10
10
  group :development, :test do
11
- gem 'autoprefixer-rails', '~> 10.4.16.0'
12
- gem 'byebug', '~> 11.1.0', platforms: %i[mri mingw x64_mingw]
11
+ gem 'autoprefixer-rails', '~> 10.4.21.0'
12
+ gem 'byebug', '~> 12.0.0', platforms: %i[mri mingw x64_mingw]
13
13
  gem 'gem-release'
14
14
  gem 'image_processing', '>= 1.12.0'
15
15
  gem 'propshaft', '~> 1.1.0'
@@ -24,7 +24,7 @@ group :development do
24
24
  end
25
25
 
26
26
  group :test do
27
- gem 'brakeman', '~> 6.1.2'
27
+ gem 'brakeman', '~> 7.0.2'
28
28
  gem 'bundler-audit', '~> 0.9.1'
29
29
  gem 'coveralls_reborn', '~> 0.28.0', require: false
30
30
  gem 'cuprite', '>= 0.15'
@@ -35,7 +35,7 @@ group :test do
35
35
  gem 'ostruct'
36
36
  gem 'puma'
37
37
  gem 'rails-controller-testing', '~> 1.0.5'
38
- gem 'rubocop', '~> 1.63.0', require: false
38
+ gem 'rubocop', '~> 1.75.7', require: false
39
39
  gem 'rubocop-minitest'
40
40
  gem 'rubocop-rails'
41
41
  gem 'simplecov', '~> 0.22.0', require: false
data/README.md CHANGED
@@ -42,7 +42,8 @@ Then from the Rails project's root run:
42
42
  ```
43
43
  bundle install
44
44
  rails generate comfy:cms
45
- rake db:migrate
45
+ rails db:migrate
46
+ rails comfy:compile_assets
46
47
  ```
47
48
 
48
49
  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.
@@ -84,6 +85,7 @@ UPDATE comfy_cms_fragments SET record_type = 'Comfy::Cms::Snippet' WHERE record_
84
85
  UPDATE comfy_cms_revisions SET record_type = 'Comfy::Cms::Page' WHERE record_type = 'Occams::Cms::Page';
85
86
  UPDATE comfy_cms_revisions SET record_type = 'Comfy::Cms::Layout' WHERE record_type = 'Occams::Cms::Layout';
86
87
  UPDATE comfy_cms_revisions SET record_type = 'Comfy::Cms::Snippet' WHERE record_type = 'Occams::Cms::Snippet';
88
+ UPDATE active_storage_attachments SET record_type = 'Comfy::Cms::File' WHERE record_type = 'Occams::Cms::File';
87
89
  ```
88
90
 
89
91
  ## Quick Start Guide
@@ -140,5 +142,5 @@ ComfortableMediaSurfer can run like any Rails application in development. It's a
140
142
 
141
143
  ---
142
144
 
143
- Copyright 2010-2019 Oleg Khabarov, 2024 ShakaCode LLC
145
+ Copyright 2010-2019 Oleg Khabarov, 2024-2025 ShakaCode LLC
144
146
  Released under the [MIT license](LICENSE)
@@ -1,13 +1,19 @@
1
1
  // TODO: Extract this so the server only renders the HTML.
2
- var li = $('li#comfy_cms_page_<%=@page.id%>');
3
- li.find('.item .toggle').first().toggleClass('open');
4
-
2
+ var li = document.querySelector('li#comfy_cms_page_<%=@page.id%>');
3
+ var toggle = li.querySelector('.item .toggle');
4
+ toggle.classList.toggle('open');
5
5
  <% if session[:cms_page_tree].member?(@page.id.to_s) %>
6
- if(!li.find('ul.children')[0]) {
7
- li.append('<ul class="children sortable pl-md-3"><%= escape_javascript(render partial: "index_branch", collection: @page.children) %></ul>');
8
- CMS.sortableList.dispose();
9
- CMS.sortableList.init();
6
+ if(!li.querySelector('ul.children')) {
7
+ var childrenList = document.createElement('ul');
8
+ childrenList.className = 'children sortable pl-md-3';
9
+ childrenList.innerHTML = '<%= escape_javascript(render partial: "index_branch", collection: @page.children) %>';
10
+ li.appendChild(childrenList);
11
+ CMS.sortableList.dispose();
12
+ CMS.sortableList.init();
10
13
  }
11
14
  <% else %>
12
- li.find('ul.children').remove();
15
+ var childrenList = li.querySelector('ul.children');
16
+ if (childrenList) {
17
+ childrenList.remove();
18
+ }
13
19
  <% end %>
@@ -29,7 +29,8 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency 'kaminari', '~> 1.2', '>= 1.2.2'
30
30
  spec.add_dependency 'kramdown', '~> 2.4', '>= 2.4.0'
31
31
  spec.add_dependency 'mimemagic', '~> 0.4', '>= 0.4.3'
32
- spec.add_dependency 'mini_magick', '~> 4.12', '>= 4.12.0'
32
+ spec.add_dependency 'mini_magick', '>= 4.12', '< 6.0'
33
33
  spec.add_dependency 'rails', '>= 7.0.0'
34
34
  spec.add_dependency 'rails-i18n', '>= 6.0.0'
35
+ spec.add_dependency 'sassc-rails', '>= 2.1.2'
35
36
  end
@@ -10,6 +10,9 @@ Bundler.require(*Rails.groups)
10
10
 
11
11
  module ComfortableMediaSurfer
12
12
  class Application < Rails::Application
13
+ # Ensuring that ActiveStorage routes are loaded before Comfy's globbing
14
+ # route. Without this file serving routes are inaccessible.
15
+ config.railties_order = [ActiveStorage::Engine, :main_app, :all]
13
16
  # Load defaults based on Rails major/minor version
14
17
  config.load_defaults Rails.version.scan(%r{^\d+\.\d+}).first.to_f
15
18
 
@@ -0,0 +1,6 @@
1
+ [attributes]
2
+ label: Child of Child Seed Page
3
+ layout: nested
4
+
5
+ [textares content]
6
+ Child A of Child B Page Seed Content
@@ -88,7 +88,6 @@ class CreateCms < ActiveRecord::Migration[5.2]
88
88
  t.integer :site_id, null: false
89
89
  t.string :label, null: false
90
90
  t.string :identifier, null: false
91
- t.boolean :markdown
92
91
  t.text :content, limit: LIMIT
93
92
  t.integer :position, null: false, default: 0
94
93
  t.timestamps
@@ -0,0 +1,5 @@
1
+ class AddMarkdownToSnippets < ActiveRecord::Migration[7.1]
2
+ def change
3
+ add_column :comfy_cms_snippets, :markdown, :boolean, default: false
4
+ end
5
+ end
@@ -39,15 +39,15 @@ class ComfortableMediaSurfer::Content::Renderer
39
39
  # @param [Comfy::Cms::WithFragments, nil] context
40
40
  def initialize(context)
41
41
  @context = context
42
- @depth = 0
43
42
  end
44
43
 
45
44
  # This is how we render content out. Takes context (cms page) and content
46
45
  # nodes
47
46
  # @param [Array<String, ComfortableMediaSurfer::Content::Tag>]
48
47
  # @param [Boolean] allow_erb
49
- def render(nodes, allow_erb = ComfortableMediaSurfer.config.allow_erb)
50
- if (@depth += 1) > MAX_DEPTH
48
+ # @param [Integer] depth current tag nesting position
49
+ def render(nodes, allow_erb = ComfortableMediaSurfer.config.allow_erb, depth = 0)
50
+ if depth >= MAX_DEPTH
51
51
  raise Error, 'Deep tag nesting or recursive nesting detected'
52
52
  end
53
53
 
@@ -58,7 +58,7 @@ class ComfortableMediaSurfer::Content::Renderer
58
58
  else
59
59
  tokens = tokenize(node.render)
60
60
  nodes = nodes(tokens)
61
- render(nodes, allow_erb || node.allow_erb?)
61
+ render(nodes, allow_erb || node.allow_erb?, depth.next)
62
62
  end
63
63
  end.flatten.join
64
64
  end
@@ -30,7 +30,7 @@ class ComfortableMediaSurfer::Content::Tags::Audio < ComfortableMediaSurfer::Con
30
30
  end
31
31
 
32
32
  def content
33
- format("#{@style}<audio controls class=\"audioplayer\" src=#{@path}></audio>")
33
+ "#{@style}<audio controls class=\"audioplayer\" src=#{@path}></audio>"
34
34
  end
35
35
  end
36
36
 
@@ -34,7 +34,7 @@ class ComfortableMediaSurfer::Content::Tags::Breadcrumbs < ComfortableMediaSurfe
34
34
  end
35
35
 
36
36
  def content
37
- format("#{@style}#{@links}")
37
+ "#{@style}#{@links}"
38
38
  end
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class ComfortableMediaSurfer::Content::Tags::Children < ComfortableMediaSurfer::
43
43
  end
44
44
  @list += '</ul>'
45
45
  end
46
- format("#{@style}#{@list}")
46
+ "#{@style}#{@list}"
47
47
  end
48
48
  end
49
49
 
@@ -57,7 +57,7 @@ class ComfortableMediaSurfer::Content::Tags::Siblings < ComfortableMediaSurfer::
57
57
  end
58
58
  @links += '</div>'
59
59
  end
60
- format("#{@style}#{@links}")
60
+ "#{@style}#{@links}"
61
61
  end
62
62
  end
63
63
 
@@ -15,37 +15,23 @@ module ComfortableMediaSurfer::Seeds::File
15
15
  .where('active_storage_blobs.filename' => filename).references(:blob).first ||
16
16
  site.files.new
17
17
 
18
- # We need to track actual file and its attributes
19
- fresh_file = false
20
-
21
18
  if File.exist?(attrs_path = File.join(path, "_#{filename}.yml")) && fresh_seed?(file, attrs_path)
22
- fresh_file = true
23
-
24
19
  attrs = YAML.safe_load_file(attrs_path)
25
20
  category_ids = category_names_to_ids(file, attrs.delete('categories'))
26
21
  file.attributes = attrs.merge(
27
22
  category_ids: category_ids
28
23
  )
24
+ save(file, file_path)
29
25
  end
30
26
 
31
27
  if fresh_seed?(file, file_path)
32
- fresh_file = true
33
-
34
- file_handler = File.open(file_path)
35
- file.file = {
36
- io: file_handler,
37
- filename: filename,
38
- content_type: MimeMagic.by_magic(file_handler)
39
- }
40
- end
41
-
42
- if fresh_file
43
- if file.save
44
- message = "[CMS SEEDS] Imported File \t #{file_path}"
45
- ComfortableMediaSurfer.logger.info(message)
46
- else
47
- message = "[CMS SEEDS] Failed to import File \n#{file.errors.inspect}"
48
- ComfortableMediaSurfer.logger.warn(message)
28
+ File.open(file_path) do |file_handler|
29
+ file.file = {
30
+ io: file_handler,
31
+ filename: filename,
32
+ content_type: MimeMagic.by_magic(file_handler)
33
+ }
34
+ save(file, file_path)
49
35
  end
50
36
  end
51
37
 
@@ -55,5 +41,15 @@ module ComfortableMediaSurfer::Seeds::File
55
41
  # cleaning up
56
42
  site.files.where('id NOT IN (?)', seed_ids).destroy_all
57
43
  end
44
+
45
+ private
46
+
47
+ def save(file, path)
48
+ if file.save
49
+ ComfortableMediaSurfer.logger.info("[CMS SEEDS] Imported File \t #{path}")
50
+ else
51
+ ComfortableMediaSurfer.logger.warn("[CMS SEEDS] Failed to import File \n#{file.errors.inspect}")
52
+ end
53
+ end
58
54
  end
59
55
  end
@@ -29,7 +29,7 @@ module ComfortableMediaSurfer::Seeds::Page
29
29
  # setting page record
30
30
  page =
31
31
  if parent.present?
32
- child = site.pages.where(slug: slug).first_or_initialize
32
+ child = site.pages.where(slug: slug, parent_id: parent.id).first_or_initialize
33
33
  child.parent = parent
34
34
  child
35
35
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ComfortableMediaSurfer
4
- VERSION = '3.1.1'
4
+ VERSION = '3.1.3'
5
5
  end
@@ -13,16 +13,9 @@ You are almost done. Don't forget to:
13
13
 
14
14
  [Optional] - If you want to store files in your CMS with ActiveStorage: `rails active_storage:install`
15
15
  [Mandatory] - Create the tables in your database: `rails db:migrate`
16
+ [Mandatory] - Run `rails comfy:compile_assets`
16
17
 
17
18
  Then go to http://your-rails-app/admin to start adding content.
18
19
 
19
20
  Default username and password are: user / pass
20
- Change these defaults in config/initializers/occams.rb
21
-
22
- ----------------------------
23
- IF YOU ARE ON RAILS 6.x
24
- ----------------------------
25
- and encounter errors referencing webpacker:
26
- ensure that you have nvm installed, and then run
27
- - nvm install 13.7 && nvm use 13.7
28
- - rails webpacker:install
21
+ Change these defaults in config/initializers/comfortable_media_surfer.rb
@@ -11,14 +11,16 @@ module Comfy
11
11
  source_root File.expand_path('../../../..', __dir__)
12
12
 
13
13
  def generate_migration
14
- destination = File.expand_path('db/migrate/01_create_cms.rb', destination_root)
15
- migration_dir = File.dirname(destination)
16
- destination = self.class.migration_exists?(migration_dir, 'create_cms')
14
+ %w[01_create_cms 02_add_markdown_to_snippets].each do |migration|
15
+ destination = File.expand_path("db/migrate/#{migration}.rb", destination_root)
16
+ migration_dir = File.dirname(destination)
17
+ destination = self.class.migration_exists?(migration_dir, migration)
17
18
 
18
- if destination
19
- puts "\e[0m\e[31mFound existing cms_create.rb migration. Remove it if you want to regenerate.\e[0m"
20
- else
21
- migration_template 'db/migrate/01_create_cms.rb', 'db/migrate/create_cms.rb'
19
+ if destination
20
+ puts "\e[0m\e[31mFound existing #{migration}.rb migration. Remove it if you want to regenerate.\e[0m"
21
+ else
22
+ migration_template "db/migrate/#{migration}.rb", "db/migrate/#{migration[3..]}.rb"
23
+ end
22
24
  end
23
25
  end
24
26
 
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfortable_media_surfer
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Khabarov
8
8
  - Andrew vonderLuft
9
9
  - ShakaCode
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2025-02-10 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: active_link_to
@@ -156,22 +155,22 @@ dependencies:
156
155
  name: mini_magick
157
156
  requirement: !ruby/object:Gem::Requirement
158
157
  requirements:
159
- - - "~>"
158
+ - - ">="
160
159
  - !ruby/object:Gem::Version
161
160
  version: '4.12'
162
- - - ">="
161
+ - - "<"
163
162
  - !ruby/object:Gem::Version
164
- version: 4.12.0
163
+ version: '6.0'
165
164
  type: :runtime
166
165
  prerelease: false
167
166
  version_requirements: !ruby/object:Gem::Requirement
168
167
  requirements:
169
- - - "~>"
168
+ - - ">="
170
169
  - !ruby/object:Gem::Version
171
170
  version: '4.12'
172
- - - ">="
171
+ - - "<"
173
172
  - !ruby/object:Gem::Version
174
- version: 4.12.0
173
+ version: '6.0'
175
174
  - !ruby/object:Gem::Dependency
176
175
  name: rails
177
176
  requirement: !ruby/object:Gem::Requirement
@@ -200,6 +199,20 @@ dependencies:
200
199
  - - ">="
201
200
  - !ruby/object:Gem::Version
202
201
  version: 6.0.0
202
+ - !ruby/object:Gem::Dependency
203
+ name: sassc-rails
204
+ requirement: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: 2.1.2
209
+ type: :runtime
210
+ prerelease: false
211
+ version_requirements: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: 2.1.2
203
216
  description: ComfortableMediaSurfer is a powerful Rails 7.0+ CMS Engine
204
217
  email:
205
218
  - justin@shakacode.com
@@ -209,6 +222,7 @@ extra_rdoc_files: []
209
222
  files:
210
223
  - ".codeclimate.yml"
211
224
  - ".gitattributes"
225
+ - ".github/dependabot.yml"
212
226
  - ".github/issue_template.md"
213
227
  - ".github/pull_request_template.md"
214
228
  - ".github/workflows/coveralls.yml"
@@ -542,6 +556,7 @@ files:
542
556
  - db/cms_seeds/sample-site/layouts/default/content.html
543
557
  - db/cms_seeds/sample-site/layouts/default/nested/content.html
544
558
  - db/cms_seeds/sample-site/pages/index/child_a/content.html
559
+ - db/cms_seeds/sample-site/pages/index/child_b/child_a/content.html
545
560
  - db/cms_seeds/sample-site/pages/index/child_b/content.html
546
561
  - db/cms_seeds/sample-site/pages/index/cms logo.png
547
562
  - db/cms_seeds/sample-site/pages/index/content.es.html
@@ -552,6 +567,7 @@ files:
552
567
  - db/cms_seeds/sample-site/snippets/default.html
553
568
  - db/migrate/00_create_active_storage_tables.active_storage.rb
554
569
  - db/migrate/01_create_cms.rb
570
+ - db/migrate/02_add_markdown_to_snippets.rb
555
571
  - gemfiles/7.1.gemfile
556
572
  - gemfiles/7.2.gemfile
557
573
  - gemfiles/8.0.gemfile
@@ -654,8 +670,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
654
670
  - !ruby/object:Gem::Version
655
671
  version: '0'
656
672
  requirements: []
657
- rubygems_version: 3.5.11
658
- signing_key:
673
+ rubygems_version: 3.6.9
659
674
  specification_version: 4
660
675
  summary: Rails 7.0+ CMS Engine
661
676
  test_files: []