katalyst-content 1.0.2 → 1.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 +4 -4
- data/app/assets/javascripts/controllers/content/editor/trix_controller.js +6 -1
- data/app/helpers/katalyst/content/editor_helper.rb +3 -3
- data/app/helpers/katalyst/content/frontend_helper.rb +2 -2
- data/app/models/katalyst/content/figure.rb +1 -1
- data/app/models/katalyst/content/item.rb +17 -1
- data/app/views/katalyst/content/asides/_aside.html+form.erb +2 -2
- data/app/views/katalyst/content/asides/_aside.html.erb +1 -1
- data/app/views/katalyst/content/columns/_column.html+form.erb +2 -2
- data/app/views/katalyst/content/columns/_column.html.erb +7 -3
- data/app/views/katalyst/content/contents/_content.html+form.erb +2 -2
- data/app/views/katalyst/content/contents/_content.html.erb +1 -1
- data/app/views/katalyst/content/groups/_group.html+form.erb +2 -2
- data/app/views/katalyst/content/groups/_group.html.erb +1 -1
- data/app/views/katalyst/content/items/_item.html+form.erb +2 -2
- data/app/views/katalyst/content/sections/_section.html+form.erb +2 -2
- data/app/views/katalyst/content/sections/_section.html.erb +1 -1
- data/db/migrate/20230515151440_change_katalyst_content_items_show_heading_column.rb +13 -0
- data/lib/katalyst/content/config.rb +1 -0
- data/lib/katalyst/content/version.rb +1 -1
- data/spec/factories/katalyst/content/items.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87e4bd83eeac48370da7a9d48165db46776c97be76b76e08fccf16f7b3890493
|
4
|
+
data.tar.gz: ab1893973d8a60e5db8eddfaab2fe7251f7df21b7bcb2e5ba34f5408bf438d3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0ea63540fe34c71e88405905054b5ed27d36d7232583f5fe5270d2daf1b40ce7c0a27d42a7fc0d6963c44f1353147d251d406ae1d4cdc4f4d231bfac49d6167
|
7
|
+
data.tar.gz: 2e41d43a9122257aab1df8c274c7ad09a77e253a48a0c34157fcd08d74ecafd4cc6a113d54cb56f2bc6bf44a53ac9f31755dbc5e835d842ec09d83f6145cc778
|
@@ -1,5 +1,10 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus";
|
2
|
-
import
|
2
|
+
import "trix";
|
3
|
+
|
4
|
+
// Note, action_text 7.1.2 changes how Trix is bundled and loaded. This
|
5
|
+
// seems to have broken the default export from trix. This is a workaround
|
6
|
+
// that relies on the backwards compatibility of the old export to window.Trix.
|
7
|
+
const Trix = window.Trix;
|
3
8
|
|
4
9
|
// Stimulus controller doesn't do anything, but having one ensures that trix
|
5
10
|
// will be lazy loaded when a trix-editor is added to the dom.
|
@@ -5,7 +5,7 @@ module Katalyst
|
|
5
5
|
module EditorHelper
|
6
6
|
def content_editor_new_items(container:)
|
7
7
|
Katalyst::Content.config.items.map do |item_class|
|
8
|
-
item_class = item_class.is_a?(String)
|
8
|
+
item_class = item_class.safe_constantize if item_class.is_a?(String)
|
9
9
|
item_class.new(container: container)
|
10
10
|
end
|
11
11
|
end
|
@@ -55,8 +55,8 @@ module Katalyst
|
|
55
55
|
defaults.deep_merge(options)
|
56
56
|
end
|
57
57
|
|
58
|
-
def content_editor_image_field(
|
59
|
-
Editor::ImageField.new(self, item.container).build(
|
58
|
+
def content_editor_image_field(...)
|
59
|
+
Editor::ImageField.new(self, item.container).build(...)
|
60
60
|
end
|
61
61
|
|
62
62
|
# When rendering item forms do not include the controller namespace prefix (katalyst/content)
|
@@ -8,12 +8,16 @@ module Katalyst
|
|
8
8
|
Katalyst::Content.config
|
9
9
|
end
|
10
10
|
|
11
|
+
enum heading_style: config.heading_styles, _prefix: :heading
|
12
|
+
|
11
13
|
belongs_to :container, polymorphic: true
|
12
14
|
|
13
15
|
validates :heading, presence: true
|
16
|
+
validates :heading_style, inclusion: { in: config.heading_styles }
|
14
17
|
validates :background, presence: true, inclusion: { in: config.backgrounds }, if: :validate_background?
|
15
18
|
|
16
19
|
after_initialize :initialize_tree
|
20
|
+
before_validation :set_defaults
|
17
21
|
|
18
22
|
attr_accessor :parent, :children, :index, :depth
|
19
23
|
|
@@ -23,7 +27,7 @@ module Katalyst
|
|
23
27
|
container_id
|
24
28
|
type
|
25
29
|
heading
|
26
|
-
|
30
|
+
heading_style
|
27
31
|
background
|
28
32
|
visible
|
29
33
|
]
|
@@ -33,6 +37,14 @@ module Katalyst
|
|
33
37
|
heading if show_heading? && visible?
|
34
38
|
end
|
35
39
|
|
40
|
+
def show_heading?
|
41
|
+
!heading_none?
|
42
|
+
end
|
43
|
+
|
44
|
+
def heading_style_class
|
45
|
+
heading_style unless heading_default?
|
46
|
+
end
|
47
|
+
|
36
48
|
def layout?
|
37
49
|
is_a? Layout
|
38
50
|
end
|
@@ -44,6 +56,10 @@ module Katalyst
|
|
44
56
|
self.children ||= []
|
45
57
|
end
|
46
58
|
|
59
|
+
def set_defaults
|
60
|
+
self.heading_style = "none" if heading_style.blank?
|
61
|
+
end
|
62
|
+
|
47
63
|
def validate_background?
|
48
64
|
true
|
49
65
|
end
|
@@ -8,8 +8,8 @@
|
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<div class="field">
|
11
|
-
<%= form.label :
|
12
|
-
<%= form.
|
11
|
+
<%= form.label :heading_style %>
|
12
|
+
<%= form.collection_radio_buttons :heading_style, Katalyst::Content.config.heading_styles, :itself, :itself %>
|
13
13
|
</div>
|
14
14
|
|
15
15
|
<div class="field">
|
@@ -8,8 +8,8 @@
|
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<div class="field">
|
11
|
-
<%= form.label :
|
12
|
-
<%= form.
|
11
|
+
<%= form.label :heading_style %>
|
12
|
+
<%= form.collection_radio_buttons :heading_style, Katalyst::Content.config.heading_styles, :itself, :itself %>
|
13
13
|
</div>
|
14
14
|
|
15
15
|
<div class="field">
|
@@ -1,14 +1,18 @@
|
|
1
1
|
<%= content_item_tag column do %>
|
2
|
-
<%= tag.h3 column.heading if column.show_heading? %>
|
2
|
+
<%= tag.h3 column.heading, class: column.heading_style_class if column.show_heading? %>
|
3
3
|
|
4
4
|
<% items = column.children.select(&:visible?) %>
|
5
5
|
<% last = items.pop %>
|
6
6
|
<div class="columns-container">
|
7
7
|
<div class="column">
|
8
|
-
|
8
|
+
<% if items.any? %>
|
9
|
+
<%= render_content_items items %>
|
10
|
+
<% elsif last %>
|
11
|
+
<%= render_content_items [last] %>
|
12
|
+
<% end %>
|
9
13
|
</div>
|
10
14
|
<div class="column">
|
11
|
-
<%= render_content_items [last] if last %>
|
15
|
+
<%= render_content_items [last] if last && items.any? %>
|
12
16
|
</div>
|
13
17
|
</div>
|
14
18
|
<% end %>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<div class="field">
|
11
|
-
<%= form.label :
|
12
|
-
<%= form.
|
11
|
+
<%= form.label :heading_style %>
|
12
|
+
<%= form.collection_radio_buttons :heading_style, Katalyst::Content.config.heading_styles, :itself, :itself %>
|
13
13
|
</div>
|
14
14
|
|
15
15
|
<div class="field">
|
@@ -8,8 +8,8 @@
|
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<div class="field">
|
11
|
-
<%= form.label :
|
12
|
-
<%= form.
|
11
|
+
<%= form.label :heading_style %>
|
12
|
+
<%= form.collection_radio_buttons :heading_style, Katalyst::Content.config.heading_styles, :itself, :itself %>
|
13
13
|
</div>
|
14
14
|
|
15
15
|
<div class="field">
|
@@ -8,8 +8,8 @@
|
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<div class="field">
|
11
|
-
<%= form.label :
|
12
|
-
<%= form.
|
11
|
+
<%= form.label :heading_style %>
|
12
|
+
<%= form.collection_radio_buttons :heading_style, Katalyst::Content.config.heading_styles, :itself, :itself %>
|
13
13
|
</div>
|
14
14
|
|
15
15
|
<div class="field">
|
@@ -8,8 +8,8 @@
|
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<div class="field">
|
11
|
-
<%= form.label :
|
12
|
-
<%= form.
|
11
|
+
<%= form.label :heading_style %>
|
12
|
+
<%= form.collection_radio_buttons :heading_style, Katalyst::Content.config.heading_styles, :itself, :itself %>
|
13
13
|
</div>
|
14
14
|
|
15
15
|
<div class="field">
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ChangeKatalystContentItemsShowHeadingColumn < ActiveRecord::Migration[7.0]
|
4
|
+
def up
|
5
|
+
add_column :katalyst_content_items, :heading_style, :integer, null: false, default: 0
|
6
|
+
Katalyst::Content::Item.where(show_heading: true).update_all(heading_style: 1)
|
7
|
+
remove_column :katalyst_content_items, :show_heading, :boolean
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
raise ActiveRecord::IrreversibleMigration
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: katalyst-content
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katalyst Interactive
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_storage_validations
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- config/routes.rb
|
109
109
|
- db/migrate/20220913003839_create_katalyst_content_items.rb
|
110
110
|
- db/migrate/20220926061535_add_fields_for_figure_to_katalyst_content_items.rb
|
111
|
+
- db/migrate/20230515151440_change_katalyst_content_items_show_heading_column.rb
|
111
112
|
- lib/katalyst/content.rb
|
112
113
|
- lib/katalyst/content/config.rb
|
113
114
|
- lib/katalyst/content/engine.rb
|
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
134
|
- !ruby/object:Gem::Version
|
134
135
|
version: '0'
|
135
136
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
137
|
+
rubygems_version: 3.4.20
|
137
138
|
signing_key:
|
138
139
|
specification_version: 4
|
139
140
|
summary: Rich content page builder and editor
|