occams 1.0.7.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/coveralls.yml +11 -9
- data/.github/workflows/rubyonrails.yml +18 -15
- data/.gitignore +19 -16
- data/CHANGELOG.md +29 -12
- data/CONTRIBUTING.md +3 -4
- data/Gemfile +8 -6
- data/README.md +4 -5
- data/app/controllers/concerns/occams/reorder_action.rb +3 -0
- data/app/controllers/occams/admin/cms/pages_controller.rb +8 -0
- data/app/models/concerns/occams/cms/with_fragments.rb +1 -1
- data/app/models/occams/cms/fragment.rb +1 -1
- data/app/models/occams/cms/layout.rb +3 -1
- data/app/models/occams/cms/revision.rb +1 -1
- data/app/views/layouts/occams/admin/cms/_left.html.haml +1 -1
- data/bin/rails +3 -3
- data/bin/rake +2 -2
- data/bin/setup +11 -11
- data/config/application.rb +23 -6
- data/config/boot.rb +1 -4
- data/config/database.yml +30 -1
- data/config/environments/development.rb +9 -11
- data/config/environments/production.rb +26 -22
- data/config/environments/test.rb +18 -7
- data/config/initializers/content_security_policy.rb +2 -3
- data/config/initializers/filter_parameter_logging.rb +3 -3
- data/config/initializers/inflections.rb +0 -1
- data/config/initializers/new_framework_defaults_7_1.rb +224 -0
- data/config/initializers/permissions_policy.rb +10 -9
- data/config/locales/en.yml +3 -3
- data/gemfiles/6.1.gemfile +7 -4
- data/gemfiles/7.0.gemfile +6 -4
- data/gemfiles/7.1.gemfile +37 -0
- data/lib/generators/occams/cms/README +10 -2
- data/lib/occams/configuration.rb +1 -1
- data/lib/occams/content/tags/asset.rb +2 -2
- data/lib/occams/content/tags/audio.rb +2 -2
- data/lib/occams/content/tags/breadcrumbs.rb +2 -2
- data/lib/occams/content/tags/checkbox.rb +2 -2
- data/lib/occams/content/tags/children.rb +2 -2
- data/lib/occams/content/tags/date.rb +2 -2
- data/lib/occams/content/tags/datetime.rb +2 -2
- data/lib/occams/content/tags/file.rb +3 -3
- data/lib/occams/content/tags/file_link.rb +3 -3
- data/lib/occams/content/tags/files.rb +2 -2
- data/lib/occams/content/tags/fragment.rb +2 -2
- data/lib/occams/content/tags/helper.rb +2 -2
- data/lib/occams/content/tags/markdown.rb +2 -2
- data/lib/occams/content/tags/mixins/file_content.rb +1 -1
- data/lib/occams/content/tags/number.rb +2 -2
- data/lib/occams/content/tags/page_file_link.rb +3 -3
- data/lib/occams/content/tags/partial.rb +2 -2
- data/lib/occams/content/tags/siblings.rb +5 -2
- data/lib/occams/content/tags/snippet.rb +2 -2
- data/lib/occams/content/tags/template.rb +2 -2
- data/lib/occams/content/tags/text.rb +2 -2
- data/lib/occams/content/tags/textarea.rb +3 -2
- data/lib/occams/content/tags/wysiwyg.rb +2 -2
- data/lib/occams/content/tags.rb +28 -0
- data/lib/occams/content.rb +1 -26
- data/lib/occams/extensions/acts_as_tree.rb +3 -3
- data/lib/occams/extensions/has_revisions.rb +3 -3
- data/lib/occams/extensions.rb +8 -0
- data/lib/occams/routing.rb +74 -5
- data/lib/occams/version.rb +1 -1
- data/lib/occams.rb +3 -3
- data/occams.gemspec +13 -13
- metadata +9 -7
- data/lib/occams/routes/cms.rb +0 -16
- data/lib/occams/routes/cms_admin.rb +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a97f751e8ded8222b0ef73e6f06b6633bdc5a2cef1858872d0e4ccbcdbc56c8
|
4
|
+
data.tar.gz: 1c1b034bc1599c94a72e99bf67b5eecb45cdffc35d4bccd2aa1c906780e760a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2da69ad3d5a308ddc27208fba96417b6156029702f24337a76d43711ed9925cfe62b07cf52f413742aca58d0f01bc73391a3d59409936e904d88ab4b95cfe0a3
|
7
|
+
data.tar.gz: 9ed1193e3ba2976446bba4c04092b9af3ec39430a54b75db05a4d0f26466b2de8fef6b6725d30e565ec7a82dde7f428c014cf60d9456922b46a414362b0cac4d
|
@@ -13,7 +13,7 @@ jobs:
|
|
13
13
|
- "3.2"
|
14
14
|
rails-version:
|
15
15
|
- "7.0"
|
16
|
-
continue-on-error: [
|
16
|
+
continue-on-error: [true]
|
17
17
|
name: ${{ format('Coverage (Ruby {0}, Rails {1})', matrix.ruby-version, matrix.rails-version) }}
|
18
18
|
runs-on: ubuntu-latest
|
19
19
|
continue-on-error: ${{ matrix.continue-on-error }}
|
@@ -23,16 +23,18 @@ jobs:
|
|
23
23
|
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
24
24
|
|
25
25
|
steps:
|
26
|
-
-
|
26
|
+
- name: Checkout source
|
27
|
+
uses: actions/checkout@v2
|
27
28
|
|
28
|
-
- name: Install Ruby
|
29
|
+
- name: Install Ruby ${{ matrix.ruby-version }}
|
29
30
|
uses: ruby/setup-ruby@v1
|
30
31
|
with:
|
31
32
|
ruby-version: ${{ matrix.ruby-version }}
|
32
|
-
bundler-cache: true
|
33
|
-
|
34
|
-
- name: Set up Test DB
|
35
|
-
run: bin/rails db:migrate RAILS_ENV=test
|
36
|
-
- name: Run tests
|
37
|
-
run: bin/rake test
|
38
33
|
|
34
|
+
- name: Run tests, report coverage
|
35
|
+
run: |
|
36
|
+
bin/bundle install --retry 3 --quiet
|
37
|
+
bin/bundle exec rails db:drop
|
38
|
+
bin/bundle exec rails db:create
|
39
|
+
bin/bundle exec rails db:migrate
|
40
|
+
bin/bundle exec rails test:db
|
@@ -6,17 +6,19 @@ on:
|
|
6
6
|
pull_request:
|
7
7
|
|
8
8
|
jobs:
|
9
|
-
|
9
|
+
build_test_lint_audit:
|
10
10
|
strategy:
|
11
11
|
matrix:
|
12
12
|
ruby-version:
|
13
13
|
- "2.7"
|
14
14
|
- "3.1"
|
15
15
|
- "3.2"
|
16
|
+
- "3.3"
|
16
17
|
rails-version:
|
17
18
|
- "6.1"
|
18
19
|
- "7.0"
|
19
|
-
|
20
|
+
- "7.1"
|
21
|
+
continue-on-error: [true]
|
20
22
|
name: ${{ format('Tests (Ruby {0}, Rails {1})', matrix.ruby-version, matrix.rails-version) }}
|
21
23
|
runs-on: ubuntu-latest
|
22
24
|
continue-on-error: ${{ matrix.continue-on-error }}
|
@@ -24,26 +26,27 @@ jobs:
|
|
24
26
|
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails-version }}.gemfile
|
25
27
|
RAILS_ENV: test
|
26
28
|
SKIP_COV: true
|
27
|
-
|
28
29
|
steps:
|
29
|
-
-
|
30
|
+
- name: Checkout source
|
31
|
+
uses: actions/checkout@v2
|
30
32
|
|
31
|
-
- name: Install Ruby
|
33
|
+
- name: Install Ruby ${{ matrix.ruby-version }}
|
32
34
|
uses: ruby/setup-ruby@v1
|
33
35
|
with:
|
34
36
|
ruby-version: ${{ matrix.ruby-version }}
|
35
|
-
bundler-cache: true
|
36
37
|
|
37
|
-
- name: Set up Test DB
|
38
|
-
run: bin/rails db:migrate RAILS_ENV=test
|
39
38
|
- name: Run tests
|
40
|
-
run:
|
39
|
+
run: |
|
40
|
+
bin/bundle install --retry 3 --quiet
|
41
|
+
bin/bundle exec rails db:drop
|
42
|
+
bin/bundle exec rails db:create
|
43
|
+
bin/bundle exec rails db:migrate
|
44
|
+
bin/bundle exec rails test:db
|
41
45
|
|
42
|
-
- name:
|
46
|
+
- name: Lint the code
|
43
47
|
run: bin/bundle exec rubocop --parallel
|
44
48
|
|
45
|
-
- name:
|
46
|
-
run:
|
47
|
-
|
48
|
-
|
49
|
-
run: bin/bundle exec bundler-audit --update --gemfile-lock gemfiles/${{ matrix.rails-version }}.gemfile.lock
|
49
|
+
- name: Audit for security
|
50
|
+
run: |
|
51
|
+
bin/bundle exec brakeman -q -w3
|
52
|
+
bin/bundle exec bundler-audit --update --gemfile-lock gemfiles/${{ matrix.rails-version }}.gemfile.lock
|
data/.gitignore
CHANGED
@@ -1,22 +1,25 @@
|
|
1
1
|
.bundle
|
2
|
-
db/*.sqlite3
|
3
|
-
log/*.log
|
4
|
-
tmp/**/*
|
5
2
|
.DS_Store
|
6
|
-
|
7
|
-
db/development_structure.sql
|
8
|
-
db/test.sqlite3*
|
9
|
-
pkg
|
10
|
-
rdoc
|
11
|
-
/tmp
|
12
|
-
public/system/
|
13
|
-
Gemfile.lock
|
14
|
-
gemfiles/*.gemfile.lock
|
15
|
-
.rvmrc
|
16
|
-
.ruby-version
|
3
|
+
.idea
|
17
4
|
.ruby-gemset
|
5
|
+
.ruby-version
|
6
|
+
.rvmrc
|
7
|
+
.vscode
|
18
8
|
/.sass-cache
|
19
|
-
coverage/
|
20
9
|
/storage
|
10
|
+
/tmp
|
11
|
+
coverage/
|
12
|
+
db/*.sqlite3
|
21
13
|
db/cms_fixtures/test-site/
|
22
|
-
.
|
14
|
+
db/development_structure.sql
|
15
|
+
db/development.sqlite3*
|
16
|
+
db/schema.rb
|
17
|
+
db/test.sqlite3*
|
18
|
+
Gemfile.lock
|
19
|
+
gemfiles/*.gemfile.lock
|
20
|
+
log/
|
21
|
+
pkg
|
22
|
+
public/system/
|
23
|
+
rdoc
|
24
|
+
tmp/**/*
|
25
|
+
vendor/bundle/
|
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,37 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## v.1.1.0 13 May 2024
|
4
|
+
|
5
|
+
- Rails 7.1 compatibility, all tests passing
|
6
|
+
- corrected bug in siblings tag to not display links to unpublished pages
|
7
|
+
- children lists and sibling navs are updated after page create, update, delete
|
8
|
+
- fixed zeitwerk check failures
|
9
|
+
- updated README
|
10
|
+
|
11
|
+
## v1.0.8 - 29 December 2023
|
12
|
+
|
13
|
+
- Updated configs, et al. in pursuit of Rails 7.1 compatibility
|
14
|
+
- Added explicit coder for serialize commands
|
15
|
+
- Added ActiveRecord Adapter (database) info to admin footer
|
16
|
+
- Added commented defaults for MySQL and Postgres to database.yml
|
17
|
+
- Updated documentation
|
18
|
+
- Refactored lib files for better test coverage awareness
|
19
|
+
|
20
|
+
## v1.0.7.3 - 7 October 2023
|
4
21
|
|
5
22
|
- Fixed edge case with siblings tag when current page is excluded
|
6
23
|
- Git ignore all sqlite* files for testing
|
7
24
|
- Small testing refinements
|
8
25
|
- Prep for Rails 7.1 compatibility
|
9
26
|
|
10
|
-
## v1.0.7.2 -
|
27
|
+
## v1.0.7.2 - 27 September 2023
|
11
28
|
|
12
29
|
- Pulled will_paginate option out in favor of Kaminari
|
13
30
|
- Switched CI from Buildkite to [Github actions](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml)
|
14
31
|
- Improved test coverage to 99+
|
15
32
|
- Removed backward compatibility to Rails prior to 6.x
|
16
33
|
|
17
|
-
## v1.0.7.1 -
|
34
|
+
## v1.0.7.1 - 22 September 2023
|
18
35
|
|
19
36
|
- Addressed deprecations for file type 'image/jpg'
|
20
37
|
- Added github workflow for tests, lints and audits
|
@@ -22,7 +39,7 @@
|
|
22
39
|
- Bumped rubocop version to latest
|
23
40
|
- Updated some testing parameters
|
24
41
|
|
25
|
-
## v1.0.7 -
|
42
|
+
## v1.0.7 - 12 September 2023
|
26
43
|
|
27
44
|
- Updated coveralls Coverage reporting
|
28
45
|
- Added minitest-reporters for test output
|
@@ -31,33 +48,33 @@
|
|
31
48
|
- Lints and 1 typo
|
32
49
|
- Added Build Status and Coveralls Coverage Status to README
|
33
50
|
|
34
|
-
## v1.0.6.1 -
|
51
|
+
## v1.0.6.1 - 5 September 2023
|
35
52
|
|
36
53
|
- Fixed siblings and children nav tags which as written had problems creating child pages in the admin panel
|
37
54
|
|
38
|
-
## v1.0.6 -
|
55
|
+
## v1.0.6 - 5 September 2023
|
39
56
|
|
40
57
|
- Fixed [cms:siblings Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#siblings) to handle edge case when page(s) are excluded by the `exclude` parameter
|
41
58
|
- Added [cms:children Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#children) to render unordered list of links for children of current page
|
42
59
|
|
43
|
-
## v1.0.5 -
|
60
|
+
## v1.0.5 - 31 August 2023
|
44
61
|
|
45
62
|
- All tests now green on Rails 6.1 and 7.0, each tested with rubies 2.7.8, 3.1.4 and 3.2.2.
|
46
63
|
- Tests added for new tags
|
47
64
|
- TODO: set up CI pipeline
|
48
65
|
|
49
|
-
## v1.0.4 -
|
66
|
+
## v1.0.4 - 26 August 2023
|
50
67
|
|
51
68
|
- Added [cms:breadcrumbs Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#breadcrumbs)
|
52
69
|
- Added [cms:siblings Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#siblings)
|
53
70
|
- Updated [wiki documentation](https://github.com/avonderluft/occams/wiki)
|
54
71
|
|
55
|
-
## v1.0.3 -
|
72
|
+
## v1.0.3 - 15 August 2023
|
56
73
|
|
57
74
|
- Added a [cms:audio tag](https://github.com/avonderluft/occams/wiki/Content-Tags#audio) for an embedded audio player
|
58
75
|
- Some formatting of admin menu footer
|
59
76
|
|
60
|
-
## v1.0.2 -
|
77
|
+
## v1.0.2 - 14 August 2023
|
61
78
|
|
62
79
|
- Fixed image rendering which rubocop broke in v1.0.1
|
63
80
|
- Show unpublished pages in Rails development mode
|
@@ -65,14 +82,14 @@
|
|
65
82
|
- Updated documentation at [Occams Wiki](https://github.com/avonderluft/occams/wiki)
|
66
83
|
- Comprehensive rubocop linting
|
67
84
|
|
68
|
-
## v1.0.1 -
|
85
|
+
## v1.0.1 - 7 August 2023
|
69
86
|
|
70
87
|
- Fixed image thumbnail hover for Rails 7
|
71
88
|
- Added display of Rails and Ruby versions along with Occams version at foot of Admin menu
|
72
89
|
- Refined gemspec dependencies
|
73
90
|
- Tweaked with a bunch of rubocop linting
|
74
91
|
|
75
|
-
## v1.0.0 -
|
92
|
+
## v1.0.0 - 5 August 2023
|
76
93
|
|
77
94
|
- Copied the original [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa)
|
78
95
|
- Added the changes from [Restarone's fork](https://github.com/restarone/comfortable-mexican-sofa) (23 commits)
|
data/CONTRIBUTING.md
CHANGED
@@ -24,12 +24,11 @@ Fork the project. Optionally, create a branch you want to work on.
|
|
24
24
|
- Tests please, but nothing complicated. UnitTest / Fixtures all the way. Make sure all tests pass.
|
25
25
|
- Run `bundle exec rubocop` and fix any issues raised.
|
26
26
|
|
27
|
-
### 4.
|
27
|
+
### 4. Create a pull request
|
28
28
|
|
29
29
|
- If you never done it before read this: https://help.github.com/articles/using-pull-requests
|
30
|
-
- When PR is submitted check if
|
30
|
+
- When PR is submitted check if [Github Actions](https://github.com/avonderluft/occams/actions) ran all tests successfully and Rubocop didn't raise any issues
|
31
31
|
|
32
32
|
### 5. Done!
|
33
33
|
|
34
|
-
If everything
|
35
|
-
a new version of gem will be published.
|
34
|
+
If everything looks good, we will review your changes to be merged into the main branch, and publish a new version of the gem.
|
data/Gemfile
CHANGED
@@ -5,16 +5,15 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
5
5
|
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem 'rails', '~> 7.
|
8
|
+
gem 'rails', '~> 7.1.2'
|
9
9
|
|
10
10
|
group :development, :test do
|
11
11
|
gem 'autoprefixer-rails', '~> 8.1.0'
|
12
|
-
gem 'byebug', '~>
|
13
|
-
gem 'capybara', '~> 3.39.0'
|
12
|
+
gem 'byebug', '~> 11.1.0', platforms: %i[mri mingw x64_mingw]
|
14
13
|
gem 'image_processing', '>= 1.2'
|
15
|
-
gem '
|
16
|
-
gem '
|
17
|
-
gem '
|
14
|
+
gem 'sqlite3', '~> 1.6.7'
|
15
|
+
# gem 'mysql2', '~> 0.5'
|
16
|
+
# gem 'pg', '~> 1.5.4'
|
18
17
|
end
|
19
18
|
|
20
19
|
group :development do
|
@@ -25,12 +24,15 @@ end
|
|
25
24
|
group :test do
|
26
25
|
gem 'brakeman', '~> 5.4.1'
|
27
26
|
gem 'bundler-audit', '~> 0.9.1'
|
27
|
+
gem 'capybara', '~> 3.39.0'
|
28
28
|
gem 'coveralls_reborn', '~> 0.28.0', require: false
|
29
|
+
gem 'cuprite', '~> 0.14.3'
|
29
30
|
gem 'diffy', '~> 3.4.2'
|
30
31
|
gem 'equivalent-xml', '~> 0.6.0'
|
31
32
|
gem 'minitest', '~> 5.20.0'
|
32
33
|
gem 'minitest-reporters', '~> 1.6.1'
|
33
34
|
gem 'mocha', '~> 2.1.0', require: false
|
35
|
+
gem 'puma', '~> 6.4.0'
|
34
36
|
gem 'rails-controller-testing', '~> 1.0.5'
|
35
37
|
gem 'rubocop', '~> 1.56.0', require: false
|
36
38
|
gem 'simplecov', '~> 0.22.0', require: false
|
data/README.md
CHANGED
@@ -47,8 +47,9 @@ ocCaM'S, pronounced "AH-kums" is a nod to [Occam's Razor](https://en.wikipedia.o
|
|
47
47
|
|
48
48
|
## Compatibility
|
49
49
|
|
50
|
-
- [Test suite](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml) on Ruby 2.7
|
51
|
-
- On Ruby 3.2, Rails 7+ is recommended, since performance is noticably better than 6
|
50
|
+
- [Test suite](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml) on Ruby >= 2.7 with Rails >= 6.1
|
51
|
+
- On Ruby 3.2, Rails 7.x + is recommended, since performance is noticably better than on 6.x
|
52
|
+
- Sites do run on Rails 7.1, e.g. [GKNT](https://gknt.org/), but some tests fail in [Github Actions](https://github.com/avonderluft/occams/actions). Your mileage may vary.
|
52
53
|
|
53
54
|
## Installation
|
54
55
|
|
@@ -97,8 +98,6 @@ Once you have a layout, you may start creating pages and populating content. It'
|
|
97
98
|
|
98
99
|
## Documentation
|
99
100
|
|
100
|
-
[Occams](https://github.com/avonderluft/occams)
|
101
|
-
|
102
101
|
For more information on how to use this CMS please refer to the [Wiki](https://github.com/avonderluft/occams/wiki). Section that might be of interest is the entry
|
103
102
|
on [Content Tags](https://github.com/comfy/avonderluft/occams/Content-Tags).
|
104
103
|
|
@@ -119,5 +118,5 @@ For more detail see [CONTRIBUTING](CONTRIBUTING.md)
|
|
119
118
|
- Thanks to [Roman Almeida](https://github.com/nasmorn) for contributing OEM License for [Redactor Text Editor](http://imperavi.com/redactor)
|
120
119
|
|
121
120
|
---
|
122
|
-
- [Occams](https://github.com/avonderluft/occams) Copyright 2023 Andrew vonderLuft, following Comfy, released under the [MIT license](LICENSE)
|
121
|
+
- [Occams](https://github.com/avonderluft/occams) Copyright 2023-2024 Andrew vonderLuft, following Comfy, released under the [MIT license](LICENSE)
|
123
122
|
- [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) Copyright 2010-2019 Oleg Khabarov. Released under the [MIT license](LICENSE)
|
@@ -12,6 +12,9 @@ module Occams::ReorderAction
|
|
12
12
|
(params.permit(order: [])[:order] || []).each_with_index do |id, index|
|
13
13
|
resource_class.where(id: id).update_all(position: index)
|
14
14
|
end
|
15
|
+
if resource_class == ::Occams::Cms::Page
|
16
|
+
Occams::Cms::Page.all.each(&:save!)
|
17
|
+
end
|
15
18
|
head :ok
|
16
19
|
end
|
17
20
|
end
|
@@ -35,8 +35,14 @@ class Occams::Admin::Cms::PagesController < Occams::Admin::Cms::BaseController
|
|
35
35
|
render
|
36
36
|
end
|
37
37
|
|
38
|
+
def update_family
|
39
|
+
@page.siblings.each(&:save!) if @page.siblings
|
40
|
+
@page.parent.save! if @page.parent
|
41
|
+
end
|
42
|
+
|
38
43
|
def create
|
39
44
|
@page.save!
|
45
|
+
update_family
|
40
46
|
flash[:success] = I18n.t('occams.admin.cms.pages.created')
|
41
47
|
redirect_to action: :edit, id: @page
|
42
48
|
rescue ActiveRecord::RecordInvalid
|
@@ -46,6 +52,7 @@ class Occams::Admin::Cms::PagesController < Occams::Admin::Cms::BaseController
|
|
46
52
|
|
47
53
|
def update
|
48
54
|
@page.save!
|
55
|
+
update_family
|
49
56
|
flash[:success] = I18n.t('occams.admin.cms.pages.updated')
|
50
57
|
redirect_to action: :edit, id: @page
|
51
58
|
rescue ActiveRecord::RecordInvalid
|
@@ -55,6 +62,7 @@ class Occams::Admin::Cms::PagesController < Occams::Admin::Cms::BaseController
|
|
55
62
|
|
56
63
|
def destroy
|
57
64
|
@page.destroy
|
65
|
+
update_family
|
58
66
|
flash[:success] = I18n.t('occams.admin.cms.pages.deleted')
|
59
67
|
redirect_to action: :index
|
60
68
|
end
|
@@ -77,7 +77,7 @@ module Occams::Cms::WithFragments
|
|
77
77
|
# duplicate tags on the layout. That's wierd (but still works).
|
78
78
|
def fragment_nodes
|
79
79
|
nodes
|
80
|
-
.select { |n| n.is_a?(Occams::Content::
|
80
|
+
.select { |n| n.is_a?(Occams::Content::Tags::Fragment) }
|
81
81
|
.uniq(&:identifier)
|
82
82
|
end
|
83
83
|
|
@@ -3,6 +3,8 @@
|
|
3
3
|
class Occams::Cms::Layout < ActiveRecord::Base
|
4
4
|
self.table_name = 'occams_cms_layouts'
|
5
5
|
|
6
|
+
require_relative '../../../../lib/occams/extensions/acts_as_tree'
|
7
|
+
|
6
8
|
cms_acts_as_tree
|
7
9
|
cms_has_revisions_for :content, :css, :js
|
8
10
|
|
@@ -67,7 +69,7 @@ class Occams::Cms::Layout < ActiveRecord::Base
|
|
67
69
|
tokens = renderer.tokenize(content)
|
68
70
|
|
69
71
|
if parent
|
70
|
-
fragment_tags = Occams::Content::
|
72
|
+
fragment_tags = Occams::Content::Tags::Fragment.subclasses.map do |c|
|
71
73
|
Occams::Content::Renderer.tags.key(c)
|
72
74
|
end
|
73
75
|
|
data/bin/rails
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
APP_PATH = File.expand_path(
|
3
|
-
require_relative
|
4
|
-
require
|
2
|
+
APP_PATH = File.expand_path("../config/application", __dir__)
|
3
|
+
require_relative "../config/boot"
|
4
|
+
require "rails/commands"
|
data/bin/rake
CHANGED
data/bin/setup
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
2
|
+
require "fileutils"
|
3
3
|
|
4
4
|
# path to your application root.
|
5
|
-
APP_ROOT = File.expand_path(
|
5
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
6
6
|
|
7
7
|
def system!(*args)
|
8
|
-
system(*args
|
8
|
+
system(*args, exception: true)
|
9
9
|
end
|
10
10
|
|
11
11
|
FileUtils.chdir APP_ROOT do
|
@@ -13,21 +13,21 @@ FileUtils.chdir APP_ROOT do
|
|
13
13
|
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
14
14
|
# Add necessary setup steps to this file.
|
15
15
|
|
16
|
-
puts
|
17
|
-
system!
|
18
|
-
system(
|
16
|
+
puts "== Installing dependencies =="
|
17
|
+
system! "gem install bundler --conservative"
|
18
|
+
system("bundle check") || system!("bundle install")
|
19
19
|
|
20
20
|
# puts "\n== Copying sample files =="
|
21
|
-
# unless File.exist?(
|
22
|
-
# FileUtils.cp
|
21
|
+
# unless File.exist?("config/database.yml")
|
22
|
+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
23
23
|
# end
|
24
24
|
|
25
25
|
puts "\n== Preparing database =="
|
26
|
-
system!
|
26
|
+
system! "bin/rails db:prepare"
|
27
27
|
|
28
28
|
puts "\n== Removing old logs and tempfiles =="
|
29
|
-
system!
|
29
|
+
system! "bin/rails log:clear tmp:clear"
|
30
30
|
|
31
31
|
puts "\n== Restarting application server =="
|
32
|
-
system!
|
32
|
+
system! "bin/rails restart"
|
33
33
|
end
|
data/config/application.rb
CHANGED
@@ -10,10 +10,30 @@ Bundler.require(*Rails.groups)
|
|
10
10
|
|
11
11
|
module Occams
|
12
12
|
class Application < Rails::Application
|
13
|
-
|
13
|
+
# Load defaults based on Rails major/minor version
|
14
|
+
config.load_defaults Rails.version.scan(%r{^\d+\.\d+}).first.to_f
|
15
|
+
|
16
|
+
# Rails 7.1 compatibility - See config/initializers/new_framework_defaults_7_1.rb
|
17
|
+
if Gem::Version.new(Rails.version) >= Gem::Version.new('7.1.0')
|
18
|
+
config.active_record.default_column_serializer = YAML
|
19
|
+
config.active_record.before_committed_on_all_records = false
|
20
|
+
config.active_record.commit_transaction_on_non_local_return = false
|
21
|
+
config.active_record.run_after_transaction_callbacks_in_order_defined = false
|
22
|
+
config.active_support.message_serializer = :json
|
23
|
+
config.active_record.run_commit_callbacks_on_first_saved_instances_in_transaction = true
|
24
|
+
# config.active_record.allow_deprecated_singular_associations_name = true
|
25
|
+
# config.active_support.raise_on_invalid_cache_expiration_time = false
|
26
|
+
# config.active_record.sqlite3_adapter_strict_strings_by_default = false
|
27
|
+
# config.active_support.cache_format_version = 7.0
|
28
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
29
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
30
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
31
|
+
config.add_autoload_paths_to_load_path = false
|
32
|
+
config.autoload_lib(ignore: %w[generators])
|
33
|
+
end
|
14
34
|
|
15
|
-
#
|
16
|
-
config.
|
35
|
+
# Making sure we don't load our dev routes as part of the engine
|
36
|
+
config.paths['config/routes.rb'] << 'config/cms_routes.rb'
|
17
37
|
|
18
38
|
# Configuration for the application, engines, and railties goes here.
|
19
39
|
#
|
@@ -25,9 +45,6 @@ module Occams
|
|
25
45
|
# Ensuring that all ActiveStorage routes are loaded before out globbing route.
|
26
46
|
config.railties_order = [ActiveStorage::Engine, :main_app, :all]
|
27
47
|
|
28
|
-
# Making sure we don't load our dev routes as part of the engine
|
29
|
-
config.paths['config/routes.rb'] << 'config/cms_routes.rb'
|
30
|
-
|
31
48
|
config.i18n.enforce_available_locales = true
|
32
49
|
|
33
50
|
config.active_record.yaml_column_permitted_classes = [
|
data/config/boot.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Set up gems listed in the Gemfile.
|
4
3
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
5
4
|
|
6
|
-
require 'bundler/setup'
|
7
|
-
|
8
|
-
File.exist? ENV.fetch('BUNDLE_GEMFILE')
|
5
|
+
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
data/config/database.yml
CHANGED
@@ -8,4 +8,33 @@ test:
|
|
8
8
|
adapter: sqlite3
|
9
9
|
database: db/test.sqlite3
|
10
10
|
pool: 5
|
11
|
-
timeout: 10000
|
11
|
+
timeout: 10000
|
12
|
+
|
13
|
+
# default: &default
|
14
|
+
# adapter: mysql2
|
15
|
+
# encoding: utf8mb4
|
16
|
+
# pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
17
|
+
# username: root
|
18
|
+
# password:
|
19
|
+
# socket: /tmp/mysql.sock
|
20
|
+
#
|
21
|
+
# development:
|
22
|
+
# <<: *default
|
23
|
+
# database: occams_dev
|
24
|
+
#
|
25
|
+
# test:
|
26
|
+
# <<: *default
|
27
|
+
# database: occams_test
|
28
|
+
|
29
|
+
# default: &default
|
30
|
+
# adapter: postgresql
|
31
|
+
# encoding: unicode
|
32
|
+
# pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
33
|
+
#
|
34
|
+
# development:
|
35
|
+
# <<: *default
|
36
|
+
# database: occams_dev
|
37
|
+
#
|
38
|
+
# test:
|
39
|
+
# <<: *default
|
40
|
+
# database: occams_test
|
@@ -8,7 +8,7 @@ defined?(Occams::Application) && Occams::Application.configure do
|
|
8
8
|
# In the development environment your application's code is reloaded any time
|
9
9
|
# it changes. This slows down response time but is perfect for development
|
10
10
|
# since you don't have to restart the web server when you make code changes.
|
11
|
-
config.
|
11
|
+
config.enable_reloading = true
|
12
12
|
|
13
13
|
# Do not eager load code on boot.
|
14
14
|
config.eager_load = false
|
@@ -55,22 +55,15 @@ defined?(Occams::Application) && Occams::Application.configure do
|
|
55
55
|
# Raise an error on page load if there are pending migrations.
|
56
56
|
config.active_record.migration_error = :page_load
|
57
57
|
|
58
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
59
|
-
# This option may cause significant delays in view rendering with a large
|
60
|
-
# number of complex assets.
|
61
|
-
config.assets.debug = true
|
62
|
-
|
63
58
|
# Highlight code that triggered database queries in logs.
|
64
59
|
config.active_record.verbose_query_logs = true
|
65
60
|
|
61
|
+
# Highlight code that enqueued background job in logs.
|
62
|
+
config.active_job.verbose_enqueue_logs = true
|
63
|
+
|
66
64
|
# Suppress logger output for asset requests.
|
67
65
|
config.assets.quiet = true
|
68
66
|
|
69
|
-
# Use an evented file watcher to asynchronously detect changes in source code,
|
70
|
-
# routes, locales, etc. This feature depends on the listen gem.
|
71
|
-
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
72
|
-
|
73
|
-
config.active_job.queue_adapter = :inline
|
74
67
|
# Raises error for missing translations.
|
75
68
|
# config.i18n.raise_on_missing_translations = true
|
76
69
|
|
@@ -79,4 +72,9 @@ defined?(Occams::Application) && Occams::Application.configure do
|
|
79
72
|
|
80
73
|
# Uncomment if you wish to allow Action Cable access from any origin.
|
81
74
|
# config.action_cable.disable_request_forgery_protection = true
|
75
|
+
|
76
|
+
if Gem::Version.new(Rails.version) >= Gem::Version.new('7.1.0')
|
77
|
+
# Raise error when a before_action's only/except options reference missing actions
|
78
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
79
|
+
end
|
82
80
|
end
|