occams 1.0.7.2 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/coveralls.yml +11 -9
  3. data/.github/workflows/rubyonrails.yml +17 -15
  4. data/.gitignore +18 -16
  5. data/CHANGELOG.md +27 -11
  6. data/CONTRIBUTING.md +3 -4
  7. data/Gemfile +7 -5
  8. data/README.md +4 -3
  9. data/app/models/concerns/occams/cms/with_fragments.rb +1 -1
  10. data/app/models/occams/cms/fragment.rb +1 -1
  11. data/app/models/occams/cms/layout.rb +3 -1
  12. data/app/models/occams/cms/revision.rb +1 -1
  13. data/app/views/layouts/occams/admin/cms/_left.html.haml +1 -1
  14. data/bin/rails +3 -3
  15. data/bin/rake +2 -2
  16. data/bin/setup +11 -11
  17. data/config/application.rb +32 -7
  18. data/config/boot.rb +1 -4
  19. data/config/database.yml +30 -1
  20. data/config/environments/development.rb +9 -11
  21. data/config/environments/production.rb +26 -22
  22. data/config/environments/test.rb +16 -7
  23. data/config/initializers/content_security_policy.rb +2 -3
  24. data/config/initializers/filter_parameter_logging.rb +3 -3
  25. data/config/initializers/inflections.rb +0 -1
  26. data/config/initializers/new_framework_defaults_7_1.rb +224 -0
  27. data/config/initializers/permissions_policy.rb +10 -9
  28. data/gemfiles/6.1.gemfile +8 -5
  29. data/gemfiles/7.0.gemfile +7 -5
  30. data/gemfiles/7.1.gemfile +37 -0
  31. data/lib/generators/occams/cms/README +10 -2
  32. data/lib/occams/configuration.rb +1 -1
  33. data/lib/occams/content/tags/asset.rb +2 -2
  34. data/lib/occams/content/tags/audio.rb +2 -2
  35. data/lib/occams/content/tags/breadcrumbs.rb +2 -2
  36. data/lib/occams/content/tags/checkbox.rb +2 -2
  37. data/lib/occams/content/tags/children.rb +2 -2
  38. data/lib/occams/content/tags/date.rb +2 -2
  39. data/lib/occams/content/tags/datetime.rb +2 -2
  40. data/lib/occams/content/tags/file.rb +3 -3
  41. data/lib/occams/content/tags/file_link.rb +3 -3
  42. data/lib/occams/content/tags/files.rb +2 -2
  43. data/lib/occams/content/tags/fragment.rb +2 -2
  44. data/lib/occams/content/tags/helper.rb +2 -2
  45. data/lib/occams/content/tags/markdown.rb +2 -2
  46. data/lib/occams/content/tags/mixins/file_content.rb +1 -1
  47. data/lib/occams/content/tags/number.rb +2 -2
  48. data/lib/occams/content/tags/page_file_link.rb +3 -3
  49. data/lib/occams/content/tags/partial.rb +2 -2
  50. data/lib/occams/content/tags/siblings.rb +3 -2
  51. data/lib/occams/content/tags/snippet.rb +2 -2
  52. data/lib/occams/content/tags/template.rb +2 -2
  53. data/lib/occams/content/tags/text.rb +2 -2
  54. data/lib/occams/content/tags/textarea.rb +3 -2
  55. data/lib/occams/content/tags/wysiwyg.rb +2 -2
  56. data/lib/occams/content/tags.rb +28 -0
  57. data/lib/occams/content.rb +1 -26
  58. data/lib/occams/extensions/acts_as_tree.rb +3 -3
  59. data/lib/occams/extensions/has_revisions.rb +3 -3
  60. data/lib/occams/extensions.rb +8 -0
  61. data/lib/occams/routing.rb +74 -5
  62. data/lib/occams/version.rb +1 -1
  63. data/lib/occams.rb +3 -3
  64. data/occams.gemspec +13 -13
  65. metadata +8 -4
@@ -3,7 +3,7 @@
3
3
  # Tag for text content that is going to be rendered using text input with date widget
4
4
  # {{ cms:date identifier }}
5
5
  #
6
- class Occams::Content::Tag::Date < Occams::Content::Tag::Datetime
6
+ class Occams::Content::Tags::Date < Occams::Content::Tags::Datetime
7
7
  def form_field(object_name, view, index)
8
8
  name = "#{object_name}[fragments_attributes][#{index}][datetime]"
9
9
  options = { id: form_field_id, class: 'form-control', data: { 'cms-date' => true } }
@@ -15,5 +15,5 @@ class Occams::Content::Tag::Date < Occams::Content::Tag::Datetime
15
15
  end
16
16
 
17
17
  Occams::Content::Renderer.register_tag(
18
- :date, Occams::Content::Tag::Date
18
+ :date, Occams::Content::Tags::Date
19
19
  )
@@ -5,7 +5,7 @@
5
5
  #
6
6
  # `strftime` - Format datetime string during rendering
7
7
  #
8
- class Occams::Content::Tag::Datetime < Occams::Content::Tag::Fragment
8
+ class Occams::Content::Tags::Datetime < Occams::Content::Tags::Fragment
9
9
  attr_reader :strftime
10
10
 
11
11
  def initialize(context:, params: [], source: nil)
@@ -38,5 +38,5 @@ class Occams::Content::Tag::Datetime < Occams::Content::Tag::Fragment
38
38
  end
39
39
 
40
40
  Occams::Content::Renderer.register_tag(
41
- :datetime, Occams::Content::Tag::Datetime
41
+ :datetime, Occams::Content::Tags::Datetime
42
42
  )
@@ -13,8 +13,8 @@ require_relative 'mixins/file_content'
13
13
  # `crop` - imagemagic option. For example: "100x50+0+0"
14
14
  # `class` - any html classes that you want on the result link or image tag. For example "class1 class2"
15
15
  #
16
- class Occams::Content::Tag::File < Occams::Content::Tag::Fragment
17
- include Occams::Content::Tag::Mixins::FileContent
16
+ class Occams::Content::Tags::File < Occams::Content::Tags::Fragment
17
+ include Occams::Content::Tags::Mixins::FileContent
18
18
 
19
19
  # @type ["url", "link", "image"]
20
20
  attr_reader :as
@@ -66,5 +66,5 @@ protected
66
66
  end
67
67
 
68
68
  Occams::Content::Renderer.register_tag(
69
- :file, Occams::Content::Tag::File
69
+ :file, Occams::Content::Tags::File
70
70
  )
@@ -13,8 +13,8 @@ require_relative 'mixins/file_content'
13
13
  # `crop` - imagemagic option. For example: "100x50+0+0"
14
14
  # `class` - any html classes that you want on the result link or image tag. For example "class1 class2"
15
15
  #
16
- class Occams::Content::Tag::FileLink < Occams::Content::Tag
17
- include Occams::Content::Tag::Mixins::FileContent
16
+ class Occams::Content::Tags::FileLink < Occams::Content::Tag
17
+ include Occams::Content::Tags::Mixins::FileContent
18
18
 
19
19
  # @return [String] A {Occams::Cms::Site#files} ID.
20
20
  attr_reader :identifier
@@ -58,5 +58,5 @@ class Occams::Content::Tag::FileLink < Occams::Content::Tag
58
58
  end
59
59
 
60
60
  Occams::Content::Renderer.register_tag(
61
- :file_link, Occams::Content::Tag::FileLink
61
+ :file_link, Occams::Content::Tags::FileLink
62
62
  )
@@ -5,7 +5,7 @@
5
5
  # Example tag:
6
6
  # {{ cms:files identifier }}
7
7
  #
8
- class Occams::Content::Tag::Files < Occams::Content::Tag::File
8
+ class Occams::Content::Tags::Files < Occams::Content::Tags::File
9
9
  def content
10
10
  return '' if fragment.attachments.blank?
11
11
 
@@ -37,5 +37,5 @@ class Occams::Content::Tag::Files < Occams::Content::Tag::File
37
37
  end
38
38
 
39
39
  Occams::Content::Renderer.register_tag(
40
- :files, Occams::Content::Tag::Files
40
+ :files, Occams::Content::Tags::Files
41
41
  )
@@ -8,7 +8,7 @@
8
8
  # `namespace`:
9
9
  # Just a string that allows grouping of form elements in the admin area
10
10
  #
11
- class Occams::Content::Tag::Fragment < Occams::Content::Tag
11
+ class Occams::Content::Tags::Fragment < Occams::Content::Tag
12
12
  attr_accessor :renderable
13
13
  attr_reader :identifier, :namespace
14
14
 
@@ -48,7 +48,7 @@ class Occams::Content::Tag::Fragment < Occams::Content::Tag
48
48
 
49
49
  # Tag renders its own form inputs via `form_field(template, index)`
50
50
  # For example:
51
- # class MyTag < Occams::Content::Tag::Fragment
51
+ # class MyTag < Occams::Content::Tags::Fragment
52
52
  # def form_field(view, index, &block)
53
53
  # # omit yield if you don't want default wrapper
54
54
  # yield view.text_area "input_name", "value"
@@ -7,7 +7,7 @@
7
7
  # Whitelist is can be used to control what helpers are available.
8
8
  # By default there's a blacklist of methods that should not be called.
9
9
  #
10
- class Occams::Content::Tag::Helper < Occams::Content::Tag
10
+ class Occams::Content::Tags::Helper < Occams::Content::Tag
11
11
  BLACKLIST = %w[eval class_eval instance_eval render].freeze
12
12
 
13
13
  attr_reader :method_name
@@ -49,5 +49,5 @@ class Occams::Content::Tag::Helper < Occams::Content::Tag
49
49
  end
50
50
 
51
51
  Occams::Content::Renderer.register_tag(
52
- :helper, Occams::Content::Tag::Helper
52
+ :helper, Occams::Content::Tags::Helper
53
53
  )
@@ -3,7 +3,7 @@
3
3
  # Tag for text content that is going to be rendered using textarea with markdown
4
4
  # {{ cms:markdown identifier }}
5
5
  #
6
- class Occams::Content::Tag::Markdown < Occams::Content::Tag::Fragment
6
+ class Occams::Content::Tags::Markdown < Occams::Content::Tags::Fragment
7
7
  def render
8
8
  renderable ? Kramdown::Document.new(content.to_s).to_html : ''
9
9
  end
@@ -18,5 +18,5 @@ class Occams::Content::Tag::Markdown < Occams::Content::Tag::Fragment
18
18
  end
19
19
 
20
20
  Occams::Content::Renderer.register_tag(
21
- :markdown, Occams::Content::Tag::Markdown
21
+ :markdown, Occams::Content::Tags::Markdown
22
22
  )
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # A mixin for tags that returns the file as their content.
4
- module Occams::Content::Tag::Mixins
4
+ module Occams::Content::Tags::Mixins
5
5
  module FileContent
6
6
  # @param [ActiveStorage::Blob] file
7
7
  # @param ["link", "image", "url"] as
@@ -3,7 +3,7 @@
3
3
  # Tag for text content that is going to be rendered using number input
4
4
  # {{ cms:number identifier }}
5
5
  #
6
- class Occams::Content::Tag::Number < Occams::Content::Tag::Fragment
6
+ class Occams::Content::Tags::Number < Occams::Content::Tags::Fragment
7
7
  def form_field(object_name, view, index)
8
8
  name = "#{object_name}[fragments_attributes][#{index}][content]"
9
9
  options = { id: form_field_id, class: 'form-control' }
@@ -14,5 +14,5 @@ class Occams::Content::Tag::Number < Occams::Content::Tag::Fragment
14
14
  end
15
15
 
16
16
  Occams::Content::Renderer.register_tag(
17
- :number, Occams::Content::Tag::Number
17
+ :number, Occams::Content::Tags::Number
18
18
  )
@@ -22,8 +22,8 @@ require_relative 'mixins/file_content'
22
22
  # `crop` - imagemagick option. For example: "100x50+0+0"
23
23
  # `class` - any html classes that you want on the result link or image tag. For example "class1 class2"
24
24
  #
25
- class Occams::Content::Tag::PageFileLink < Occams::Content::Tag
26
- include Occams::Content::Tag::Mixins::FileContent
25
+ class Occams::Content::Tags::PageFileLink < Occams::Content::Tag
26
+ include Occams::Content::Tags::Mixins::FileContent
27
27
 
28
28
  # @return [String] A `cms:file(s)` identifier.
29
29
  attr_reader :identifier
@@ -79,5 +79,5 @@ class Occams::Content::Tag::PageFileLink < Occams::Content::Tag
79
79
  end
80
80
 
81
81
  Occams::Content::Renderer.register_tag(
82
- :page_file_link, Occams::Content::Tag::PageFileLink
82
+ :page_file_link, Occams::Content::Tags::PageFileLink
83
83
  )
@@ -6,7 +6,7 @@
6
6
  # <%= render partial: "path/to/partial", locals: {foo: bar, zip: zoop} %>
7
7
  # Whitelist is can be used to control what partials are renderable.
8
8
  #
9
- class Occams::Content::Tag::Partial < Occams::Content::Tag
9
+ class Occams::Content::Tags::Partial < Occams::Content::Tag
10
10
  attr_reader :path, :locals
11
11
 
12
12
  def initialize(context:, params: [], source: nil)
@@ -43,5 +43,5 @@ class Occams::Content::Tag::Partial < Occams::Content::Tag
43
43
  end
44
44
 
45
45
  Occams::Content::Renderer.register_tag(
46
- :partial, Occams::Content::Tag::Partial
46
+ :partial, Occams::Content::Tags::Partial
47
47
  )
@@ -17,7 +17,7 @@
17
17
  #
18
18
  # style and exclude parameters are optional
19
19
 
20
- class Occams::Content::Tag::Siblings < Occams::Content::Tag
20
+ class Occams::Content::Tags::Siblings < Occams::Content::Tag
21
21
  attr_reader :locals, :style, :sibs
22
22
  attr_accessor :links
23
23
 
@@ -42,6 +42,7 @@ class Occams::Content::Tag::Siblings < Occams::Content::Tag
42
42
  sib_idx = @sibs.index(sib)
43
43
  next if sib.slug == context.slug
44
44
  next if Rails.env == 'production' && !sib.is_published
45
+ next unless @sibs.index(context) # current page is excluded
45
46
 
46
47
  if sib_idx == @sibs.index(context) - 1
47
48
  @links += "<a href=#{sib.url(relative: true)}>#{sib.label}</a> &laquo;&nbsp;<em>Previous</em> &bull; "
@@ -58,5 +59,5 @@ class Occams::Content::Tag::Siblings < Occams::Content::Tag
58
59
  end
59
60
 
60
61
  Occams::Content::Renderer.register_tag(
61
- :siblings, Occams::Content::Tag::Siblings
62
+ :siblings, Occams::Content::Tags::Siblings
62
63
  )
@@ -4,7 +4,7 @@
4
4
  # {{cms:snippet identifier}}
5
5
  # Snippets may have more tags in them like fragments, so they may be expanded too.
6
6
  #
7
- class Occams::Content::Tag::Snippet < Occams::Content::Tag
7
+ class Occams::Content::Tags::Snippet < Occams::Content::Tag
8
8
  attr_reader :identifier
9
9
 
10
10
  def initialize(context:, params: [], source: nil)
@@ -32,5 +32,5 @@ class Occams::Content::Tag::Snippet < Occams::Content::Tag
32
32
  end
33
33
 
34
34
  Occams::Content::Renderer.register_tag(
35
- :snippet, Occams::Content::Tag::Snippet
35
+ :snippet, Occams::Content::Tags::Snippet
36
36
  )
@@ -6,7 +6,7 @@
6
6
  # <%= render template: "template/path" %>
7
7
  # Whitelist is can be used to control what templates are available.
8
8
  #
9
- class Occams::Content::Tag::Template < Occams::Content::Tag
9
+ class Occams::Content::Tags::Template < Occams::Content::Tag
10
10
  attr_reader :path
11
11
 
12
12
  def initialize(context:, params: [], source: nil)
@@ -38,5 +38,5 @@ class Occams::Content::Tag::Template < Occams::Content::Tag
38
38
  end
39
39
 
40
40
  Occams::Content::Renderer.register_tag(
41
- :template, Occams::Content::Tag::Template
41
+ :template, Occams::Content::Tags::Template
42
42
  )
@@ -3,7 +3,7 @@
3
3
  # Tag for text content that is going to be rendered using text input
4
4
  # {{ cms:text identifier }}
5
5
  #
6
- class Occams::Content::Tag::Text < Occams::Content::Tag::Fragment
6
+ class Occams::Content::Tags::Text < Occams::Content::Tags::Fragment
7
7
  def form_field(object_name, view, index)
8
8
  name = "#{object_name}[fragments_attributes][#{index}][content]"
9
9
  options = { id: form_field_id, class: 'form-control' }
@@ -14,5 +14,5 @@ class Occams::Content::Tag::Text < Occams::Content::Tag::Fragment
14
14
  end
15
15
 
16
16
  Occams::Content::Renderer.register_tag(
17
- :text, Occams::Content::Tag::Text
17
+ :text, Occams::Content::Tags::Text
18
18
  )
@@ -3,7 +3,8 @@
3
3
  # Tag for text content that is going to be rendered using textarea
4
4
  # {{ cms:textarea identifier }}
5
5
  #
6
- class Occams::Content::Tag::TextArea < Occams::Content::Tag::Fragment
6
+
7
+ class Occams::Content::Tags::Textarea < Occams::Content::Tags::Fragment
7
8
  def form_field(object_name, view, index)
8
9
  name = "#{object_name}[fragments_attributes][#{index}][content]"
9
10
  options = { id: form_field_id, data: { 'cms-cm-mode' => 'text/html' } }
@@ -14,5 +15,5 @@ class Occams::Content::Tag::TextArea < Occams::Content::Tag::Fragment
14
15
  end
15
16
 
16
17
  Occams::Content::Renderer.register_tag(
17
- :textarea, Occams::Content::Tag::TextArea
18
+ :textarea, Occams::Content::Tags::Textarea
18
19
  )
@@ -5,7 +5,7 @@
5
5
  # {{ cms:wysiwyg identifier }}
6
6
  #
7
7
  #
8
- class Occams::Content::Tag::Wysiwyg < Occams::Content::Tag::Fragment
8
+ class Occams::Content::Tags::Wysiwyg < Occams::Content::Tags::Fragment
9
9
  def form_field(object_name, view, index)
10
10
  name = "#{object_name}[fragments_attributes][#{index}][content]"
11
11
  options = { id: form_field_id, data: { 'cms-rich-text' => true } }
@@ -15,5 +15,5 @@ class Occams::Content::Tag::Wysiwyg < Occams::Content::Tag::Fragment
15
15
  end
16
16
 
17
17
  Occams::Content::Renderer.register_tag(
18
- :wysiwyg, Occams::Content::Tag::Wysiwyg
18
+ :wysiwyg, Occams::Content::Tags::Wysiwyg
19
19
  )
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Occams::Content::Tags
4
+ # ...
5
+ end
6
+
7
+ require_relative 'tags/fragment'
8
+ require_relative 'tags/wysiwyg'
9
+ require_relative 'tags/text'
10
+ require_relative 'tags/textarea'
11
+ require_relative 'tags/markdown'
12
+ require_relative 'tags/datetime'
13
+ require_relative 'tags/date'
14
+ require_relative 'tags/number'
15
+ require_relative 'tags/checkbox'
16
+ require_relative 'tags/file'
17
+ require_relative 'tags/files'
18
+ require_relative 'tags/snippet'
19
+ require_relative 'tags/asset'
20
+ require_relative 'tags/file_link'
21
+ require_relative 'tags/page_file_link'
22
+ require_relative 'tags/helper'
23
+ require_relative 'tags/partial'
24
+ require_relative 'tags/template'
25
+ require_relative 'tags/audio'
26
+ require_relative 'tags/breadcrumbs'
27
+ require_relative 'tags/children'
28
+ require_relative 'tags/siblings'
@@ -7,30 +7,5 @@ end
7
7
  require_relative 'content/renderer'
8
8
  require_relative 'content/params_parser'
9
9
  require_relative 'content/tag'
10
+ require_relative 'content/tags'
10
11
  require_relative 'content/block'
11
-
12
- require_relative 'content/tags/fragment'
13
-
14
- require_relative 'content/tags/wysiwyg'
15
- require_relative 'content/tags/text'
16
- require_relative 'content/tags/textarea'
17
- require_relative 'content/tags/markdown'
18
- require_relative 'content/tags/datetime'
19
- require_relative 'content/tags/date'
20
- require_relative 'content/tags/number'
21
- require_relative 'content/tags/checkbox'
22
- require_relative 'content/tags/file'
23
- require_relative 'content/tags/files'
24
-
25
- require_relative 'content/tags/snippet'
26
- require_relative 'content/tags/asset'
27
- require_relative 'content/tags/file_link'
28
- require_relative 'content/tags/page_file_link'
29
- require_relative 'content/tags/helper'
30
- require_relative 'content/tags/partial'
31
- require_relative 'content/tags/template'
32
-
33
- require_relative 'content/tags/audio'
34
- require_relative 'content/tags/breadcrumbs'
35
- require_relative 'content/tags/children'
36
- require_relative 'content/tags/siblings'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Occams::ActsAsTree
3
+ module Occams::Extensions::ActsAsTree
4
4
  def self.included(base)
5
5
  base.extend(ClassMethods)
6
6
  end
@@ -30,7 +30,7 @@ module Occams::ActsAsTree
30
30
  dependent: configuration[:dependent]
31
31
 
32
32
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
33
- include Occams::ActsAsTree::InstanceMethods
33
+ include Occams::Extensions::ActsAsTree::InstanceMethods
34
34
 
35
35
  scope :roots, -> {
36
36
  where("#{configuration[:foreign_key]} IS NULL").
@@ -110,5 +110,5 @@ module Occams::ActsAsTree
110
110
  end
111
111
 
112
112
  ActiveSupport.on_load :active_record do
113
- include Occams::ActsAsTree
113
+ include Occams::Extensions::ActsAsTree
114
114
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Occams::HasRevisions
3
+ module Occams::Extensions::HasRevisions
4
4
  def self.included(base)
5
5
  base.send :extend, ClassMethods
6
6
  end
7
7
 
8
8
  module ClassMethods
9
9
  def cms_has_revisions_for(*fields)
10
- include Occams::HasRevisions::InstanceMethods
10
+ include Occams::Extensions::HasRevisions::InstanceMethods
11
11
 
12
12
  attr_accessor :revision_data
13
13
 
@@ -64,5 +64,5 @@ module Occams::HasRevisions
64
64
  end
65
65
 
66
66
  ActiveSupport.on_load :active_record do
67
- include Occams::HasRevisions
67
+ include Occams::Extensions::HasRevisions
68
68
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Occams::Extensions
4
+ # ...
5
+ end
6
+
7
+ require_relative 'extensions/acts_as_tree'
8
+ require_relative 'extensions/has_revisions'
@@ -1,10 +1,79 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'routes/cms_admin'
4
- require_relative 'routes/cms'
3
+ module Occams::Routing
4
+ class ActionDispatch::Routing::Mapper
5
+ def occams_route_cms_admin(path: 'admin')
6
+ scope module: :occams, as: :occams do
7
+ scope module: :admin do
8
+ namespace :cms, as: :admin_cms, path: path, except: :show do
9
+ get '/', to: 'base#jump'
5
10
 
6
- class ActionDispatch::Routing::Mapper
7
- def occams_route(identifier, options = {})
8
- send("occams_route_#{identifier}", **options)
11
+ concern :with_revisions do |options|
12
+ resources :revisions, options.merge(only: %i[index show]) do
13
+ patch :revert, on: :member
14
+ end
15
+ end
16
+
17
+ concern :with_reorder do
18
+ put :reorder, on: :collection
19
+ end
20
+
21
+ concern :with_form_fragments do
22
+ get :form_fragments, on: :member
23
+ end
24
+
25
+ resources :sites do
26
+ resources :pages do
27
+ concerns :with_reorder
28
+ concerns :with_form_fragments
29
+ concerns :with_revisions, controller: 'revisions/page'
30
+
31
+ get :toggle_branch, on: :member
32
+
33
+ resources :translations, except: [:index] do
34
+ concerns :with_form_fragments
35
+ concerns :with_revisions, controller: 'revisions/translation'
36
+ end
37
+ end
38
+
39
+ resources :files, concerns: [:with_reorder]
40
+
41
+ resources :layouts do
42
+ concerns :with_reorder
43
+ concerns :with_revisions, controller: 'revisions/layout'
44
+ end
45
+
46
+ resources :snippets do
47
+ concerns :with_reorder
48
+ concerns :with_revisions, controller: 'revisions/snippet'
49
+ end
50
+
51
+ resources :categories
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+
59
+ class ActionDispatch::Routing::Mapper
60
+ def occams_route_cms(options = {})
61
+ Occams.configuration.public_cms_path = options[:path]
62
+
63
+ scope module: :occams, as: :occams do
64
+ namespace :cms, path: options[:path] do
65
+ get 'cms-css/:site_id/:identifier(/:cache_buster)' => 'assets#render_css', as: 'render_css'
66
+ get 'cms-js/:site_id/:identifier(/:cache_buster)' => 'assets#render_js', as: 'render_js'
67
+
68
+ get '(*cms_path)' => 'content#show', as: 'render_page', action: '/:format'
69
+ end
70
+ end
71
+ end
72
+ end
73
+
74
+ class ActionDispatch::Routing::Mapper
75
+ def occams_route(identifier, options = {})
76
+ send("occams_route_#{identifier}", **options)
77
+ end
9
78
  end
10
79
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Occams
4
- VERSION = '1.0.7.2'
4
+ VERSION = '1.0.8'
5
5
  end
data/lib/occams.rb CHANGED
@@ -25,12 +25,12 @@ require_relative 'occams/seeds/snippet/importer'
25
25
  require_relative 'occams/seeds/snippet/exporter'
26
26
  require_relative 'occams/seeds/file/importer'
27
27
  require_relative 'occams/seeds/file/exporter'
28
- require_relative 'occams/extensions/acts_as_tree'
29
- require_relative 'occams/extensions/has_revisions'
30
-
31
28
  require_relative 'occams/content'
29
+ require_relative 'occams/extensions'
32
30
 
33
31
  module Occams
32
+ Version = Occams::VERSION
33
+
34
34
  class << self
35
35
  attr_writer :logger
36
36
 
data/occams.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Andrew vonderLuft']
9
9
  spec.email = ['wonder@hey.com']
10
10
  spec.homepage = 'http://github.com/avonderluft/occams'
11
- spec.summary = 'Rails 6-7+ CMS Engine'
12
- spec.description = 'Occams is a powerful Rails 6-7+ CMS Engine'
11
+ spec.summary = 'Rails 6.1-7.1+ CMS Engine'
12
+ spec.description = 'Occams is a powerful Rails 6.1-7.1+ CMS Engine'
13
13
  spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -19,17 +19,17 @@ Gem::Specification.new do |spec|
19
19
  spec.required_ruby_version = '>= 2.7.0'
20
20
  spec.metadata['rubygems_mfa_required'] = 'true'
21
21
 
22
- spec.add_dependency 'active_link_to', '~> 1.0', '>= 1.0.5'
23
- spec.add_dependency 'comfy_bootstrap_form', '~> 4.0', '>= 4.0.0'
24
- spec.add_dependency 'haml-rails', '~> 2.1', '>= 2.1.0'
25
- spec.add_dependency 'image_processing', '~> 1.2', '>= 1.12.2'
26
- spec.add_dependency 'jquery-rails', '~> 4.6', '>= 4.6.0'
27
- spec.add_dependency 'kaminari', '~> 1.2', '>= 1.2.2'
28
- spec.add_dependency 'kramdown', '~> 2.4', '>= 2.4.0'
29
- spec.add_dependency 'mimemagic', '~> 0.4', '>= 0.4.3'
30
- spec.add_dependency 'mini_magick', '~> 4.12', '>= 4.12.0'
22
+ spec.add_dependency 'active_link_to', '~> 1.0', '>= 1.0.5'
23
+ spec.add_dependency 'comfy_bootstrap_form', '~> 4.0', '>= 4.0.0'
24
+ spec.add_dependency 'haml-rails', '~> 2.1', '>= 2.1.0'
25
+ spec.add_dependency 'image_processing', '~> 1.2', '>= 1.12.2'
26
+ spec.add_dependency 'jquery-rails', '~> 4.6', '>= 4.6.0'
27
+ spec.add_dependency 'kaminari', '~> 1.2', '>= 1.2.2'
28
+ spec.add_dependency 'kramdown', '~> 2.4', '>= 2.4.0'
29
+ spec.add_dependency 'mimemagic', '~> 0.4', '>= 0.4.3'
30
+ spec.add_dependency 'mini_magick', '~> 4.12', '>= 4.12.0'
31
31
  spec.add_dependency 'rails', '>= 6.1.0'
32
32
  spec.add_dependency 'rails-i18n', '>= 6.0.0'
33
- spec.add_dependency 'sassc-rails', '~> 2.1', '>= 2.1.2'
34
- spec.add_dependency 'sprockets-rails', '~> 3.4', '>= 3.4.2'
33
+ spec.add_dependency 'sassc-rails', '~> 2.1', '>= 2.1.2'
34
+ spec.add_dependency 'sprockets-rails', '~> 3.4', '>= 3.4.2'
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occams
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7.2
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew vonderLuft
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-27 00:00:00.000000000 Z
11
+ date: 2023-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_link_to
@@ -258,7 +258,7 @@ dependencies:
258
258
  - - ">="
259
259
  - !ruby/object:Gem::Version
260
260
  version: 3.4.2
261
- description: Occams is a powerful Rails 6-7+ CMS Engine
261
+ description: Occams is a powerful Rails 6.1-7.1+ CMS Engine
262
262
  email:
263
263
  - wonder@hey.com
264
264
  executables: []
@@ -631,6 +631,7 @@ files:
631
631
  - config/initializers/inflections.rb
632
632
  - config/initializers/json.rb
633
633
  - config/initializers/new_framework_defaults_7_0.rb
634
+ - config/initializers/new_framework_defaults_7_1.rb
634
635
  - config/initializers/occams.rb
635
636
  - config/initializers/permissions_policy.rb
636
637
  - config/locales/ar.yml
@@ -675,6 +676,7 @@ files:
675
676
  - db/migrate/01_create_cms.rb
676
677
  - gemfiles/6.1.gemfile
677
678
  - gemfiles/7.0.gemfile
679
+ - gemfiles/7.1.gemfile
678
680
  - lib/generators/occams/cms/README
679
681
  - lib/generators/occams/cms/assets_generator.rb
680
682
  - lib/generators/occams/cms/cms_generator.rb
@@ -704,6 +706,7 @@ files:
704
706
  - lib/occams/content/params_parser.rb
705
707
  - lib/occams/content/renderer.rb
706
708
  - lib/occams/content/tag.rb
709
+ - lib/occams/content/tags.rb
707
710
  - lib/occams/content/tags/asset.rb
708
711
  - lib/occams/content/tags/audio.rb
709
712
  - lib/occams/content/tags/breadcrumbs.rb
@@ -729,6 +732,7 @@ files:
729
732
  - lib/occams/content/tags/wysiwyg.rb
730
733
  - lib/occams/engine.rb
731
734
  - lib/occams/error.rb
735
+ - lib/occams/extensions.rb
732
736
  - lib/occams/extensions/acts_as_tree.rb
733
737
  - lib/occams/extensions/has_revisions.rb
734
738
  - lib/occams/form_builder.rb
@@ -773,5 +777,5 @@ requirements: []
773
777
  rubygems_version: 3.4.13
774
778
  signing_key:
775
779
  specification_version: 4
776
- summary: Rails 6-7+ CMS Engine
780
+ summary: Rails 6.1-7.1+ CMS Engine
777
781
  test_files: []