katalyst-content 3.1.0 → 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: d1be194d961a873a0cdb20f871b5ff57f57ff1b5b503dfc8716b1004b6b6a4e6
4
- data.tar.gz: b3f45e0d9e23450e39055da1cd5b15b3b93865fa7b37b6cc632ff900041e0d60
3
+ metadata.gz: 3ba3b723f228e2f561064d4c6e42db46f7dad064163a4b6e44818ef9ef893e5f
4
+ data.tar.gz: 302430ededc05a9a227df3d07e8a4b60b25bc0ab213504e35fcedfd8c9c8d6fa
5
5
  SHA512:
6
- metadata.gz: 647b389cbc0c4b8c27227c377a910c04906cb46e34be09d12914f368d2699a0d778b73b7a2e5d493dd45c4f6de9303a366f45f4246984db6b3764294ab2f794b
7
- data.tar.gz: af45914d0047b3b13d4ea19051fb2914cfa4aebf81809af22d14ef022332dd51683d49f10fc5685e9e32e8225bd3712d2c0b51c85df7c033cf1d5457458e4e55
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: :unprocessable_entity
12
+ render :update, locals: { item_editor: }, status: :unprocessable_content
13
13
  end
14
14
  end
15
15
  alias_method :create, :update
@@ -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?
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.1.0
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: 3.6.9
231
+ rubygems_version: 4.0.3
232
232
  specification_version: 4
233
233
  summary: Rich content page builder and editor
234
234
  test_files: []