alchemy_cms 8.2.8 → 8.2.10
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/components/alchemy/admin/resource/action.rb +4 -6
- data/app/components/alchemy/admin/resource/cell.rb +4 -6
- data/app/components/alchemy/admin/resource/table.rb +14 -2
- data/app/components/alchemy/ingredients/base_view.rb +1 -1
- data/app/components/alchemy/ingredients/picture_view.rb +1 -1
- data/app/components/alchemy/ingredients/text_view.rb +2 -2
- data/app/models/concerns/alchemy/publishable.rb +1 -3
- data/config/importmap.rb +12 -6
- data/db/migrate/20260702090038_add_index_to_elements_pages_join_table.rb +14 -0
- data/lib/alchemy/test_support/shared_publishable_examples.rb +10 -0
- data/lib/alchemy/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f71f14030df55abfe021569d0c8c816c5e94a4176b07c9949aac4a4605b4c97
|
|
4
|
+
data.tar.gz: 9ed19aa050280a931a26c04b6d1c0dba213f80a5e1b67d3480565808489557de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72ccdb22228d035975cea321c2e4de08442a9f580fec0b269fafde14e134c795cbf0348c28cafb6a60ffbc98b4d2d88711179862b35a6eb3e014de1eea6d253b
|
|
7
|
+
data.tar.gz: ee40daf52d764ffb4f247110edfef6fb0d5dc42644c28de6dcb76edc2e71b1e215fde3e204ae103c3c0e4cc799d14ddaacd81532dcb9e578e453844683eb41c0
|
|
@@ -10,6 +10,8 @@ module Alchemy
|
|
|
10
10
|
# name of an action to evaluate if the user can perform these action on the given object
|
|
11
11
|
# @param [String, nil] :tooltip
|
|
12
12
|
# show a tooltip around the button
|
|
13
|
+
# @param [Object, nil] :resource
|
|
14
|
+
# the resource of the row the action belongs to
|
|
13
15
|
# @param [Lambda] :block
|
|
14
16
|
# a block to include a button or a link
|
|
15
17
|
#
|
|
@@ -30,15 +32,11 @@ module Alchemy
|
|
|
30
32
|
<% end %>
|
|
31
33
|
ERB
|
|
32
34
|
|
|
33
|
-
def initialize(name = nil, tooltip = nil, &block)
|
|
35
|
+
def initialize(name = nil, tooltip = nil, resource = nil, &block)
|
|
34
36
|
@name = name
|
|
35
37
|
@tooltip = tooltip
|
|
36
|
-
@block = block
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def with_resource(resource)
|
|
40
38
|
@resource = resource
|
|
41
|
-
|
|
39
|
+
@block = block
|
|
42
40
|
end
|
|
43
41
|
end
|
|
44
42
|
end
|
|
@@ -7,6 +7,8 @@ module Alchemy
|
|
|
7
7
|
#
|
|
8
8
|
# @param [String, nil] :css_classes
|
|
9
9
|
# css classes that are show at the table cell
|
|
10
|
+
# @param [Object, nil] :resource
|
|
11
|
+
# the resource of the row the cell belongs to
|
|
10
12
|
# @param [Lambda] :block
|
|
11
13
|
# a block to include a button or a link
|
|
12
14
|
#
|
|
@@ -19,14 +21,10 @@ module Alchemy
|
|
|
19
21
|
</td>
|
|
20
22
|
ERB
|
|
21
23
|
|
|
22
|
-
def initialize(css_classes, &block)
|
|
24
|
+
def initialize(css_classes, resource = nil, &block)
|
|
23
25
|
@css_classes = css_classes
|
|
24
|
-
@block = block
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def with_resource(resource)
|
|
28
26
|
@resource = resource
|
|
29
|
-
|
|
27
|
+
@block = block
|
|
30
28
|
end
|
|
31
29
|
end
|
|
32
30
|
end
|
|
@@ -69,12 +69,12 @@ module Alchemy
|
|
|
69
69
|
<% collection.each do |resource| %>
|
|
70
70
|
<tr class="<%= cycle('even', 'odd') %>">
|
|
71
71
|
<% cells.each do |cell| %>
|
|
72
|
-
<%= render cell
|
|
72
|
+
<%= render cell_for(cell, resource) %>
|
|
73
73
|
<% end %>
|
|
74
74
|
<% if actions? %>
|
|
75
75
|
<td class="tools">
|
|
76
76
|
<% actions.each do |action| %>
|
|
77
|
-
<%= render action
|
|
77
|
+
<%= render action_for(action, resource) %>
|
|
78
78
|
<% end %>
|
|
79
79
|
</td>
|
|
80
80
|
<% end %>
|
|
@@ -134,6 +134,18 @@ module Alchemy
|
|
|
134
134
|
|
|
135
135
|
private
|
|
136
136
|
|
|
137
|
+
# A fresh cell instance is built for every resource because ViewComponent
|
|
138
|
+
# instances are single-use and may not be rendered more than once.
|
|
139
|
+
def cell_for(cell, resource)
|
|
140
|
+
Cell.new(cell.css_classes, resource, &cell.block)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# A fresh action instance is built for every resource because ViewComponent
|
|
144
|
+
# instances are single-use and may not be rendered more than once.
|
|
145
|
+
def action_for(action, resource)
|
|
146
|
+
Action.new(action.name, action.tooltip, resource, &action.block)
|
|
147
|
+
end
|
|
148
|
+
|
|
137
149
|
##
|
|
138
150
|
# if no cells are available the resource_helper will be used, to generate the
|
|
139
151
|
# default attributes of the given resource
|
|
@@ -18,7 +18,7 @@ module Alchemy
|
|
|
18
18
|
|
|
19
19
|
def call
|
|
20
20
|
if disable_link?
|
|
21
|
-
dom_id.present? ? anchor : value
|
|
21
|
+
dom_id.present? ? anchor : h(value)
|
|
22
22
|
else
|
|
23
23
|
link_to(value, url_for(link), {
|
|
24
24
|
id: dom_id.presence,
|
|
@@ -26,7 +26,7 @@ module Alchemy
|
|
|
26
26
|
target: link_target_value(link_target),
|
|
27
27
|
rel: link_rel_value(link_target)
|
|
28
28
|
}.merge(html_options))
|
|
29
|
-
end
|
|
29
|
+
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
private
|
|
@@ -9,9 +9,7 @@ module Alchemy
|
|
|
9
9
|
scope :published, ->(at: Current.preview_time) {
|
|
10
10
|
scheduled
|
|
11
11
|
.where("#{table_name}.public_on <= :at", at:)
|
|
12
|
-
.where(public_until:
|
|
13
|
-
where("#{table_name}.public_until > :at", at:)
|
|
14
|
-
)
|
|
12
|
+
.where("#{table_name}.public_until IS NULL OR #{table_name}.public_until > :at", at:)
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
validate do
|
data/config/importmap.rb
CHANGED
|
@@ -13,12 +13,18 @@ pin "@rails/ujs", to: "rails-ujs.min.js", preload: true # @7.1.2
|
|
|
13
13
|
pin "tinymce", to: "tinymce.min.js", preload: true
|
|
14
14
|
|
|
15
15
|
pin "alchemy_admin", to: "alchemy/alchemy_admin.min.js", preload: true
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
pin "alchemy_admin/components/
|
|
21
|
-
pin "alchemy_admin/components/
|
|
16
|
+
# Individually importable admin components. These resolve to their source
|
|
17
|
+
# files (not the bundle) so host engines can import a single component without
|
|
18
|
+
# loading and executing the whole admin bundle. Not preloaded, so they add no
|
|
19
|
+
# fetches to normal admin page loads (which import the bundle instead).
|
|
20
|
+
pin "alchemy_admin/components/page_select"
|
|
21
|
+
pin "alchemy_admin/components/attachment_select"
|
|
22
|
+
pin "alchemy_admin/components/element_select"
|
|
23
|
+
pin "alchemy_admin/components/tags_autocomplete"
|
|
24
|
+
pin "alchemy_admin/components/tinymce"
|
|
25
|
+
pin "alchemy_admin/components/remote_select"
|
|
26
|
+
pin "alchemy_admin/components/select"
|
|
27
|
+
pin "alchemy_admin/i18n"
|
|
22
28
|
pin "alchemy_admin/image_cropper", to: "alchemy/alchemy_admin.min.js"
|
|
23
29
|
pin "alchemy_admin/image_overlay", to: "alchemy/alchemy_admin.min.js"
|
|
24
30
|
pin "alchemy_admin/picture_selector", to: "alchemy/alchemy_admin.min.js"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class AddIndexToElementsPagesJoinTable < ActiveRecord::Migration[7.2]
|
|
2
|
+
disable_ddl_transaction! if connection.adapter_name.match?(/postgres/i)
|
|
3
|
+
|
|
4
|
+
def change
|
|
5
|
+
add_index :alchemy_elements_alchemy_pages, :element_id, if_not_exists: true, algorithm: algorithm
|
|
6
|
+
add_index :alchemy_elements_alchemy_pages, :page_id, if_not_exists: true, algorithm: algorithm
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def algorithm
|
|
12
|
+
connection.adapter_name.match?(/postgres/i) ? :concurrently : nil
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -81,6 +81,16 @@ RSpec.shared_examples_for "being publishable" do |factory_name|
|
|
|
81
81
|
])
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
|
+
|
|
85
|
+
context "with a publication window that has not started yet" do
|
|
86
|
+
let!(:future_window) do
|
|
87
|
+
create(factory_name, public_on: Date.tomorrow, public_until: Date.tomorrow + 2.days)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it "does not return the record" do
|
|
91
|
+
expect(described_class.published.where(id: future_window.id)).to be_empty
|
|
92
|
+
end
|
|
93
|
+
end
|
|
84
94
|
end
|
|
85
95
|
|
|
86
96
|
describe "#scheduled?" do
|
data/lib/alchemy/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: alchemy_cms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.2.
|
|
4
|
+
version: 8.2.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas von Deyen
|
|
@@ -1285,6 +1285,7 @@ files:
|
|
|
1285
1285
|
- db/migrate/20260102121232_add_metadata_to_page_versions.rb
|
|
1286
1286
|
- db/migrate/20260115164704_add_publication_timestamps_to_alchemy_elements.rb
|
|
1287
1287
|
- db/migrate/20260115164705_add_index_to_element_publication_timestamps.rb
|
|
1288
|
+
- db/migrate/20260702090038_add_index_to_elements_pages_join_table.rb
|
|
1288
1289
|
- lib/alchemy.rb
|
|
1289
1290
|
- lib/alchemy/ability_helper.rb
|
|
1290
1291
|
- lib/alchemy/admin/locale.rb
|
|
@@ -1490,7 +1491,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1490
1491
|
version: '0'
|
|
1491
1492
|
requirements:
|
|
1492
1493
|
- ImageMagick (libmagick), v6.6 or greater.
|
|
1493
|
-
rubygems_version: 4.0.
|
|
1494
|
+
rubygems_version: 4.0.20
|
|
1494
1495
|
specification_version: 4
|
|
1495
1496
|
summary: A powerful, userfriendly and flexible CMS for Rails
|
|
1496
1497
|
test_files: []
|