katalyst-content 1.1.1 → 2.0.0
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 +4 -4
- data/README.md +81 -7
- data/app/assets/builds/katalyst/content.esm.js +1004 -0
- data/app/assets/builds/katalyst/content.js +1004 -0
- data/app/assets/builds/katalyst/content.min.js +2 -0
- data/app/assets/builds/katalyst/content.min.js.map +1 -0
- data/app/assets/config/katalyst-content.js +1 -1
- data/app/assets/stylesheets/katalyst/content/editor/_index.scss +1 -1
- data/app/assets/stylesheets/katalyst/content/editor/_new-items.scss +36 -10
- data/app/assets/stylesheets/katalyst/content/editor/_status-bar.scss +3 -1
- data/app/{helpers/katalyst/content/editor/base.rb → components/katalyst/content/editor/base_component.rb} +15 -12
- data/app/components/katalyst/content/editor/errors_component.html.erb +12 -0
- data/app/components/katalyst/content/editor/errors_component.rb +15 -0
- data/app/components/katalyst/content/editor/item_component.html.erb +25 -0
- data/app/components/katalyst/content/editor/item_component.rb +28 -0
- data/app/components/katalyst/content/editor/new_item_component.html.erb +22 -0
- data/app/components/katalyst/content/editor/new_item_component.rb +52 -0
- data/app/{views/katalyst/content/editor/_new_items.html.erb → components/katalyst/content/editor/new_items_component.html.erb} +1 -1
- data/app/components/katalyst/content/editor/new_items_component.rb +20 -0
- data/app/{views/katalyst/content/editor/_list_item.html.erb → components/katalyst/content/editor/row_component.html.erb} +1 -1
- data/app/components/katalyst/content/editor/row_component.rb +13 -0
- data/app/{helpers/katalyst/content/editor/status_bar.rb → components/katalyst/content/editor/status_bar_component.rb} +17 -13
- data/app/components/katalyst/content/editor/table_component.html.erb +11 -0
- data/app/components/katalyst/content/editor/table_component.rb +36 -0
- data/app/components/katalyst/content/editor_component.html.erb +9 -0
- data/app/components/katalyst/content/editor_component.rb +49 -0
- data/app/controllers/katalyst/content/items_controller.rb +6 -3
- data/app/helpers/katalyst/content/editor_helper.rb +4 -48
- data/app/helpers/katalyst/content/frontend_helper.rb +3 -3
- data/app/javascript/content/application.js +35 -0
- data/app/{assets/javascripts/utils → javascript}/content/editor/container.js +1 -1
- data/app/{assets/javascripts/controllers → javascript}/content/editor/container_controller.js +3 -3
- data/app/{assets/javascripts/controllers → javascript}/content/editor/item_controller.js +1 -1
- data/app/{assets/javascripts/controllers → javascript}/content/editor/list_controller.js +12 -2
- data/app/models/katalyst/content/types/nodes_type.rb +2 -2
- data/app/views/active_storage/blobs/_blob.html.erb +1 -1
- data/app/views/katalyst/content/asides/_aside.html+form.erb +2 -2
- data/app/views/katalyst/content/columns/_column.html+form.erb +2 -2
- data/app/views/katalyst/content/contents/_content.html+form.erb +3 -3
- data/app/views/katalyst/content/figures/_figure.html+form.erb +2 -2
- data/app/views/katalyst/content/groups/_group.html+form.erb +2 -2
- data/app/views/katalyst/content/items/_item.html+form.erb +2 -2
- data/app/views/katalyst/content/items/update.turbo_stream.erb +2 -2
- data/app/views/katalyst/content/sections/_section.html+form.erb +2 -2
- data/config/importmap.rb +1 -6
- data/lib/katalyst/content.rb +0 -1
- metadata +61 -24
- data/app/helpers/katalyst/content/editor/container.rb +0 -43
- data/app/helpers/katalyst/content/editor/errors.rb +0 -24
- data/app/helpers/katalyst/content/editor/item.rb +0 -67
- data/app/helpers/katalyst/content/editor/list.rb +0 -41
- data/app/helpers/katalyst/content/editor/new_item.rb +0 -53
- data/app/views/katalyst/content/editor/_item.html.erb +0 -14
- data/app/views/katalyst/content/editor/_new_item.html.erb +0 -3
- data/lib/katalyst/content/version.rb +0 -7
- /data/app/{assets/javascripts/utils → javascript}/content/editor/item.js +0 -0
- /data/app/{assets/javascripts/controllers → javascript}/content/editor/new_item_controller.js +0 -0
- /data/app/{assets/javascripts/utils/content/editor/rules-engine.js → javascript/content/editor/rules_engine.js} +0 -0
- /data/app/{assets/javascripts/controllers → javascript}/content/editor/status_bar_controller.js +0 -0
- /data/app/{assets/javascripts/controllers → javascript}/content/editor/trix_controller.js +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32b03e6922fb9f2062318ea0fa31fc988463ac2975d9f5ba193187638c4528f2
|
4
|
+
data.tar.gz: 1830d2633def549737b742d4c29fddf5a419e253365b1c59f5a40ebbec445d90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63ccbcf8ce1f61175eabb29a7d0d88385245a315c487ce4e78055467a6ada93998592aeb882d1c3b1475a6f864a056166caeac31e69df91522dc7a15f3926f4a
|
7
|
+
data.tar.gz: 9b301a53e876f2c76b7e8854429c009af2aa6dd8637c6f76e4f810bb4c44c5d6cb60136dc03e33dbcae66472c5457cbec781ec2a1acd86b8e78d2d2166b17858
|
data/README.md
CHANGED
@@ -5,19 +5,37 @@ applications.
|
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
|
-
|
8
|
+
Install the gem as usual
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
gem
|
11
|
+
gem "katalyst-content"
|
12
12
|
```
|
13
13
|
|
14
|
-
|
14
|
+
Mount the engine in your `routes.rb` file:
|
15
15
|
|
16
|
-
|
16
|
+
```ruby
|
17
|
+
mount Katalyst::Content::Engine, at: "content"
|
18
|
+
```
|
17
19
|
|
18
|
-
|
20
|
+
Add the Gem's migrations to your application:
|
19
21
|
|
20
|
-
|
22
|
+
```ruby
|
23
|
+
rake katalyst_content:install:migrations
|
24
|
+
```
|
25
|
+
|
26
|
+
Add the Gem's javascript and CSS to your build pipeline. This assumes that
|
27
|
+
you're using `rails-dartsass` and `importmaps` to manage your assets.
|
28
|
+
|
29
|
+
```javascript
|
30
|
+
// app/javascript/controllers/application.js
|
31
|
+
import { application } from "controllers/application";
|
32
|
+
import content from "@katalyst/content";
|
33
|
+
application.load(content);
|
34
|
+
```
|
35
|
+
|
36
|
+
```sass
|
37
|
+
@use "katalyst/content";
|
38
|
+
```
|
21
39
|
|
22
40
|
## Usage
|
23
41
|
|
@@ -80,11 +98,67 @@ FactoryBot.define do
|
|
80
98
|
end
|
81
99
|
```
|
82
100
|
|
101
|
+
Create a controller for editing content. This example assumes you're rendering the editor on the 'show' route of an
|
102
|
+
admin controller.
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
class Admin::PagesController < Admin::BaseController
|
106
|
+
before_action :set_page, only: %i[show update]
|
107
|
+
|
108
|
+
def show; end
|
109
|
+
|
110
|
+
def update
|
111
|
+
@page.attributes = page_params
|
112
|
+
|
113
|
+
unless @page.valid?
|
114
|
+
return respond_to do |format|
|
115
|
+
format.turbo_stream { render @editor.errors, status: :unprocessable_entity }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
case params[:commit]
|
120
|
+
when "publish"
|
121
|
+
@page.save!
|
122
|
+
@page.publish!
|
123
|
+
when "save"
|
124
|
+
@page.save!
|
125
|
+
when "revert"
|
126
|
+
@page.revert!
|
127
|
+
end
|
128
|
+
|
129
|
+
redirect_to [:admin, @page], status: :see_other
|
130
|
+
end
|
131
|
+
|
132
|
+
private
|
133
|
+
|
134
|
+
def set_page
|
135
|
+
@page = Page.find(params[:id])
|
136
|
+
@editor = Katalyst::Content::EditorComponent.new(container: @page)
|
137
|
+
end
|
138
|
+
|
139
|
+
def page_params
|
140
|
+
params.require(:page).permit(items_attributes: %i[id index depth])
|
141
|
+
end
|
142
|
+
end
|
143
|
+
```
|
144
|
+
|
145
|
+
And the view:
|
146
|
+
|
147
|
+
```erb
|
148
|
+
<%# app/views/admin/pages/show.html.erb %>
|
149
|
+
<%= render @editor.status_bar %>
|
150
|
+
<%= render @editor %>
|
151
|
+
<%# We suggest you render new items in a sidebar %>
|
152
|
+
<%= render @editor.new_items %>
|
153
|
+
```
|
154
|
+
|
83
155
|
## Development
|
84
156
|
|
85
157
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests.
|
86
158
|
|
87
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
159
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
160
|
+
version number and run `bundle exec rake release`, which will create a git tag for the version, push git commits and
|
161
|
+
the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
88
162
|
|
89
163
|
## Contributing
|
90
164
|
|