katalyst-content 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +3 -3
- data/lib/tasks/yarn.rake +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9add66f2ceddd578d133b679abf018fc4af299b100ab60b12c93e701e0681c3f
|
4
|
+
data.tar.gz: 6432a682a93e61c38b3bbaecc3dc392c9be03070838094cbd195646e6a0bcdcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74ef81a842d28873e577a245a84a97649814d2fdd1387e25cb2fcb273fca7edf4c5fee147bcfcddf3c556a66d11bb9d58705b73e9daae383271fd1ab93ed0362
|
7
|
+
data.tar.gz: 1a8dd6463ff2146bf80ffaecb05adc76e866d956d89544c3257dc2a38be4f8f38d3c86090e464a2571d37108cf3a5d8ceb8e9ffa0223d83cdee435791cd5c7c6
|
@@ -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.0
|
4
|
+
version: 1.1.0
|
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-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_storage_validations
|
@@ -108,11 +108,11 @@ 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
|
114
115
|
- lib/katalyst/content/version.rb
|
115
|
-
- lib/tasks/yarn.rake
|
116
116
|
- spec/factories/katalyst/content/items.rb
|
117
117
|
homepage: https://github.com/katalyst/content
|
118
118
|
licenses:
|
data/lib/tasks/yarn.rake
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
namespace :yarn do
|
4
|
-
desc "Install npm packages with yarn"
|
5
|
-
task install: :environment do
|
6
|
-
sh "yarn install"
|
7
|
-
end
|
8
|
-
|
9
|
-
desc "Lint JS/SCSS files using yarn (prettier)"
|
10
|
-
task lint: :install do
|
11
|
-
sh "yarn lint"
|
12
|
-
end
|
13
|
-
|
14
|
-
desc "Autoformat JS/SCSS files using yarn (prettier)"
|
15
|
-
task format: :install do
|
16
|
-
sh "yarn format"
|
17
|
-
end
|
18
|
-
end
|