katalyst-content 3.0.3 → 3.1.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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ba3b723f228e2f561064d4c6e42db46f7dad064163a4b6e44818ef9ef893e5f
|
|
4
|
+
data.tar.gz: 302430ededc05a9a227df3d07e8a4b60b25bc0ab213504e35fcedfd8c9c8d6fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 557be5c1037ddb0563142b18027fc0d5e99be80d1c54e5198546fb2cf774f97b435baf4efb11d1df1005ac8ed477998e4b3a7bb8d835ef3f74a92e66fc22d00b
|
|
7
|
+
data.tar.gz: '08cab857ca6675464b13d5c616efc213bfa9d75e55819ab217a4aef95a7fd812f24c42357ed98980b1d49cc3202ab68a947749dd56996771edf212a84a1c6050'
|
data/README.md
CHANGED
|
@@ -78,6 +78,35 @@ class CreatePageVersions < ActiveRecord::Migration[7.0]
|
|
|
78
78
|
end
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
+
If you don't have a pages model yet, add it before the page_versions change:
|
|
82
|
+
```ruby
|
|
83
|
+
class CreatePages < ActiveRecord::Migration[7.0]
|
|
84
|
+
def change
|
|
85
|
+
create_table :pages do |t|
|
|
86
|
+
t.string :title
|
|
87
|
+
t.string :slug
|
|
88
|
+
t.boolean :show_title, default: true, null: false
|
|
89
|
+
|
|
90
|
+
t.timestamps
|
|
91
|
+
end
|
|
92
|
+
add_index :pages, :slug, unique: true
|
|
93
|
+
|
|
94
|
+
create_table :page_versions do |t|
|
|
95
|
+
t.references :parent, foreign_key: { to_table: :pages }, null: false
|
|
96
|
+
t.json :nodes
|
|
97
|
+
|
|
98
|
+
t.timestamps
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
change_table :pages do |t|
|
|
102
|
+
t.references :published_version, foreign_key: { to_table: :page_versions }
|
|
103
|
+
t.references :draft_version, foreign_key: { to_table: :page_versions }
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
|
|
81
110
|
Next, include the `Katalyst::Content` concerns into your model, and add a nested
|
|
82
111
|
model for storing content version information:
|
|
83
112
|
|
|
@@ -9,7 +9,7 @@ module Katalyst
|
|
|
9
9
|
if item.valid?
|
|
10
10
|
render :update, locals: { item_editor: }
|
|
11
11
|
else
|
|
12
|
-
render :update, locals: { item_editor: }, status: :
|
|
12
|
+
render :update, locals: { item_editor: }, status: :unprocessable_content
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
alias_method :create, :update
|
|
@@ -31,11 +31,11 @@ module Katalyst
|
|
|
31
31
|
private
|
|
32
32
|
|
|
33
33
|
def content_table_allowed_tags
|
|
34
|
-
Katalyst::Content
|
|
34
|
+
Katalyst::Content.config.table_sanitizer_allowed_tags
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def content_table_allowed_attributes
|
|
38
|
-
Katalyst::Content
|
|
38
|
+
Katalyst::Content.config.table_sanitizer_allowed_attributes
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# rubocop:disable Rails/HelperInstanceVariable
|
|
@@ -49,11 +49,8 @@ module Katalyst
|
|
|
49
49
|
dependent: :destroy,
|
|
50
50
|
validate: true
|
|
51
51
|
|
|
52
|
-
# Rails 7.2 dropped support for ActiveModel enums. This is a temporary workaround.
|
|
53
|
-
# Intended behaviour:
|
|
54
|
-
# attribute :state, :string
|
|
55
|
-
# enum :state, %i[published draft unpublished].index_with(&:to_s)
|
|
56
52
|
attribute :state, :string
|
|
53
|
+
enum :state, %i[published draft unpublished].index_with(&:to_s)
|
|
57
54
|
|
|
58
55
|
# Returns true if there is a published version. Note that this includes drafts.
|
|
59
56
|
def published?
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "active_support/configurable"
|
|
4
|
-
|
|
5
3
|
module Katalyst
|
|
6
4
|
module Content
|
|
7
5
|
class Config
|
|
8
|
-
|
|
6
|
+
attr_accessor :base_controller,
|
|
7
|
+
:default_theme,
|
|
8
|
+
:errors_component,
|
|
9
|
+
:heading_styles,
|
|
10
|
+
:image_mime_types,
|
|
11
|
+
:items,
|
|
12
|
+
:max_image_size,
|
|
13
|
+
:table_sanitizer_allowed_attributes,
|
|
14
|
+
:table_sanitizer_allowed_tags,
|
|
15
|
+
:themes
|
|
16
|
+
|
|
17
|
+
alias_attribute :backgrounds, :themes
|
|
9
18
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
alias_method :backgrounds=, :themes=
|
|
19
|
+
def initialize
|
|
20
|
+
self.themes = %w[light dark]
|
|
21
|
+
self.default_theme = themes.first
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
%w[
|
|
23
|
+
self.heading_styles = %w[none default]
|
|
24
|
+
self.items = %w[
|
|
18
25
|
Katalyst::Content::Content
|
|
19
26
|
Katalyst::Content::Figure
|
|
20
27
|
Katalyst::Content::Table
|
|
@@ -23,21 +30,16 @@ module Katalyst
|
|
|
23
30
|
Katalyst::Content::Column
|
|
24
31
|
Katalyst::Content::Aside
|
|
25
32
|
]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
self.image_mime_types = %w[image/png image/gif image/jpeg image/webp]
|
|
34
|
+
self.max_image_size = 20
|
|
35
|
+
self.errors_component = "Katalyst::Content::Editor::ErrorsComponent"
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
config_accessor(:errors_component) { "Katalyst::Content::Editor::ErrorsComponent" }
|
|
37
|
+
self.base_controller = "ApplicationController"
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
%w[table thead tbody tr th td caption a strong em span br p text].freeze
|
|
38
|
-
end
|
|
39
|
-
config_accessor(:table_sanitizer_allowed_attributes) do
|
|
40
|
-
%w[colspan rowspan href].freeze
|
|
39
|
+
# Sanitizer
|
|
40
|
+
self.table_sanitizer_allowed_tags = %w[table thead tbody tr th td caption a strong em span br p
|
|
41
|
+
text].freeze
|
|
42
|
+
self.table_sanitizer_allowed_attributes = %w[colspan rowspan href].freeze
|
|
41
43
|
end
|
|
42
44
|
end
|
|
43
45
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: katalyst-content
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Katalyst Interactive
|
|
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
228
228
|
- !ruby/object:Gem::Version
|
|
229
229
|
version: '0'
|
|
230
230
|
requirements: []
|
|
231
|
-
rubygems_version:
|
|
231
|
+
rubygems_version: 4.0.3
|
|
232
232
|
specification_version: 4
|
|
233
233
|
summary: Rich content page builder and editor
|
|
234
234
|
test_files: []
|