alchemy_cms 5.1.1 → 5.1.5
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.
Potentially problematic release.
This version of alchemy_cms might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/Gemfile +5 -0
- data/alchemy_cms.gemspec +1 -1
- data/app/decorators/alchemy/element_editor.rb +66 -0
- data/app/models/alchemy/picture.rb +1 -1
- data/app/views/alchemy/admin/elements/_element.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_element_footer.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +3 -3
- data/lib/alchemy/resource.rb +5 -3
- data/lib/alchemy/upgrader/five_point_zero.rb +31 -0
- data/lib/alchemy/version.rb +1 -1
- data/lib/tasks/alchemy/thumbnails.rake +4 -2
- data/lib/tasks/alchemy/upgrade.rake +20 -0
- data/package/admin.js +2 -0
- data/package/src/__tests__/i18n.spec.js +23 -0
- data/package/src/i18n.js +1 -3
- data/package.json +1 -1
- metadata +12 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e22cad36f7f22bd3c584b8ec7449098db4664356f44f3dc502ec03b40f6fb37e
|
4
|
+
data.tar.gz: e762d80d1be086a4da0063956187caea7824bf67c556ecb11856af3a33c18988
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1e60d6b1edbc55f0419a168296067ac0de8860825288e07c9aa063fc80fde587c8cf18c59d2809a500a13588dfdabdeab038fa0bb83a7811c56d77827005467
|
7
|
+
data.tar.gz: 7f6be2a004959880f66a56007c9648c50ad5ce7f3355e40acc5a487fcdacc82c866fcb291c186b84134903de7019aadbf929e6cc96655e6c61e6d6a64a7be8e6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
## 5.1.5 (2021-09-15)
|
2
|
+
|
3
|
+
- generate picture thumbnails only for pictures with convertible format [#2131](https://github.com/AlchemyCMS/alchemy_cms/pull/2131) ([afdev82](https://github.com/afdev82))
|
4
|
+
- Backport #2115 to v5.1 [#2125](https://github.com/AlchemyCMS/alchemy_cms/pull/2125) ([dbwinger](https://github.com/dbwinger))
|
5
|
+
- Backport #2114 to v5.1 [#2117](https://github.com/AlchemyCMS/alchemy_cms/pull/2117) ([afdev82](https://github.com/afdev82))
|
6
|
+
|
7
|
+
## 5.1.4 (2021-05-13)
|
8
|
+
|
9
|
+
- Fix alchemy:generate:thumbnails task [#2092](https://github.com/AlchemyCMS/alchemy_cms/pull/2092) ([afdev82](https://github.com/afdev82))
|
10
|
+
- Do not attempt to generate thumbs for svg files. [#2090](https://github.com/AlchemyCMS/alchemy_cms/pull/2090) ([oneiros](https://github.com/oneiros))
|
11
|
+
|
12
|
+
## 5.1.3 (2021-05-06)
|
13
|
+
|
14
|
+
- Use symbols in polymorphic routes for resources [#2087](https://github.com/AlchemyCMS/alchemy_cms/pull/2087) ([tvdeyen](https://github.com/tvdeyen))
|
15
|
+
- Backport #2049 to 5.1 [#2059](https://github.com/AlchemyCMS/alchemy_cms/pull/2059) ([rickythefox](https://github.com/rickythefox))
|
16
|
+
## 5.1.2 (2021-01-26)
|
17
|
+
|
18
|
+
- Allow to safe hidden elements [#2007](https://github.com/AlchemyCMS/alchemy_cms/pull/2007) ([tvdeyen](https://github.com/tvdeyen))
|
19
|
+
|
1
20
|
## 5.1.1 (2021-01-12)
|
2
21
|
|
3
22
|
- Fix copy element feature [#1996](https://github.com/AlchemyCMS/alchemy_cms/pull/1996) ([tvdeyen](https://github.com/tvdeyen))
|
data/Gemfile
CHANGED
@@ -13,6 +13,11 @@ gem "mysql2", "~> 0.5.1" if ENV["DB"] == "mysql"
|
|
13
13
|
gem "pg", "~> 1.0" if ENV["DB"] == "postgresql"
|
14
14
|
|
15
15
|
group :development, :test do
|
16
|
+
# execjs 2.8 removes deprecation warnings but also breaks a number of dependent projects.
|
17
|
+
# in our case the culprit is `handlebars-assets`. The changes between 2.7.0 and 2.8.0 are
|
18
|
+
# minimal, but breaking.
|
19
|
+
gem "execjs", "= 2.7.0"
|
20
|
+
|
16
21
|
if ENV["GITHUB_ACTIONS"]
|
17
22
|
gem "sassc", "~> 2.4.0" # https://github.com/sass/sassc-ruby/issues/146
|
18
23
|
else
|
data/alchemy_cms.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.add_runtime_dependency 'awesome_nested_set', ['~> 3.1']
|
24
24
|
gem.add_runtime_dependency 'cancancan', ['>= 2.1', '< 4.0']
|
25
25
|
gem.add_runtime_dependency 'coffee-rails', ['>= 4.0', '< 6.0']
|
26
|
-
gem.add_runtime_dependency 'dragonfly', ['~> 1.0', '>= 1.0.7']
|
26
|
+
gem.add_runtime_dependency 'dragonfly', ['~> 1.0', '>= 1.0.7', '< 1.4.0']
|
27
27
|
gem.add_runtime_dependency 'dragonfly_svg', ['~> 0.0.4']
|
28
28
|
gem.add_runtime_dependency 'gutentag', ['~> 2.2', '>= 2.2.1']
|
29
29
|
gem.add_runtime_dependency 'handlebars_assets', ['~> 0.23']
|
@@ -8,6 +8,17 @@ module Alchemy
|
|
8
8
|
"alchemy/admin/elements/element"
|
9
9
|
end
|
10
10
|
|
11
|
+
# Returns content editor instances for defined contents
|
12
|
+
#
|
13
|
+
# Creates contents on demand if the content is not yet present on the element
|
14
|
+
#
|
15
|
+
# @return Array<Alchemy::ContentEditor>
|
16
|
+
def contents
|
17
|
+
element.definition.fetch(:contents, []).map do |content|
|
18
|
+
Alchemy::ContentEditor.new(find_or_create_content(content[:name]))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
11
22
|
# CSS classes for the element editor partial.
|
12
23
|
def css_classes
|
13
24
|
[
|
@@ -36,5 +47,60 @@ module Alchemy
|
|
36
47
|
|
37
48
|
super
|
38
49
|
end
|
50
|
+
|
51
|
+
# Returns a deprecation notice for elements marked deprecated
|
52
|
+
#
|
53
|
+
# You can either use localizations or pass a String as notice
|
54
|
+
# in the element definition.
|
55
|
+
#
|
56
|
+
# == Custom deprecation notices
|
57
|
+
#
|
58
|
+
# Use general element deprecation notice
|
59
|
+
#
|
60
|
+
# - name: old_element
|
61
|
+
# deprecated: true
|
62
|
+
#
|
63
|
+
# Add a translation to your locale file for a per element notice.
|
64
|
+
#
|
65
|
+
# en:
|
66
|
+
# alchemy:
|
67
|
+
# element_deprecation_notices:
|
68
|
+
# old_element: Foo baz widget is deprecated
|
69
|
+
#
|
70
|
+
# or use the global translation that apply to all deprecated elements.
|
71
|
+
#
|
72
|
+
# en:
|
73
|
+
# alchemy:
|
74
|
+
# element_deprecation_notice: Foo baz widget is deprecated
|
75
|
+
#
|
76
|
+
# or pass string as deprecation notice.
|
77
|
+
#
|
78
|
+
# - name: old_element
|
79
|
+
# deprecated: This element will be removed soon.
|
80
|
+
#
|
81
|
+
def deprecation_notice
|
82
|
+
case definition["deprecated"]
|
83
|
+
when String
|
84
|
+
definition["deprecated"]
|
85
|
+
when TrueClass
|
86
|
+
Alchemy.t(name,
|
87
|
+
scope: :element_deprecation_notices,
|
88
|
+
default: Alchemy.t(:element_deprecated))
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def find_or_create_content(name)
|
95
|
+
find_content(name) || create_content(name)
|
96
|
+
end
|
97
|
+
|
98
|
+
def find_content(name)
|
99
|
+
element.contents.find { |content| content.name == name }
|
100
|
+
end
|
101
|
+
|
102
|
+
def create_content(name)
|
103
|
+
Alchemy::Content.create(element: element, name: name)
|
104
|
+
end
|
39
105
|
end
|
40
106
|
end
|
@@ -91,7 +91,7 @@ module Alchemy
|
|
91
91
|
end
|
92
92
|
|
93
93
|
# Create important thumbnails upfront
|
94
|
-
after_create -> { PictureThumb.generate_thumbs!(self) }
|
94
|
+
after_create -> { PictureThumb.generate_thumbs!(self) if has_convertible_format? }
|
95
95
|
|
96
96
|
# We need to define this method here to have it available in the validations below.
|
97
97
|
class << self
|
@@ -25,7 +25,7 @@
|
|
25
25
|
<div id="element_<%= element.id %>_errors" class="element_errors"></div>
|
26
26
|
|
27
27
|
<div id="element_<%= element.id %>_content" class="element-content-editors">
|
28
|
-
<%= render element.contents
|
28
|
+
<%= render element.contents %>
|
29
29
|
</div>
|
30
30
|
|
31
31
|
<% if element.taggable? %>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
</p>
|
6
6
|
<% end %>
|
7
7
|
|
8
|
-
<button type="submit"
|
8
|
+
<button type="submit" form="element_<%= element.id %>_form" class="button" data-alchemy-button>
|
9
9
|
<%= Alchemy.t(:save) %>
|
10
10
|
</button>
|
11
11
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% content = local_assigns[:content] || local_assigns[:essence_picture_view] %>
|
2
2
|
<%= Alchemy::EssencePictureView.new(
|
3
3
|
content,
|
4
|
-
local_assigns[:options],
|
5
|
-
local_assigns[:html_options]
|
6
|
-
).render %>
|
4
|
+
local_assigns[:options] || {},
|
5
|
+
local_assigns[:html_options] || {}
|
6
|
+
).render %>
|
data/lib/alchemy/resource.rb
CHANGED
@@ -132,7 +132,9 @@ module Alchemy
|
|
132
132
|
end
|
133
133
|
|
134
134
|
def namespaced_resource_name
|
135
|
-
@_namespaced_resource_name ||=
|
135
|
+
@_namespaced_resource_name ||= begin
|
136
|
+
namespaced_resources_name.to_s.singularize
|
137
|
+
end.to_sym # Rails >= 6.0.3.7 needs symbols in polymorphic routes
|
136
138
|
end
|
137
139
|
|
138
140
|
def namespaced_resources_name
|
@@ -140,13 +142,13 @@ module Alchemy
|
|
140
142
|
resource_name_array = resource_array.dup
|
141
143
|
resource_name_array.delete(engine_name) if in_engine?
|
142
144
|
resource_name_array.join("_")
|
143
|
-
end
|
145
|
+
end.to_sym # Rails >= 6.0.3.7 needs symbols in polymorphic routes
|
144
146
|
end
|
145
147
|
|
146
148
|
def namespace_for_scope
|
147
149
|
namespace_array = namespace_diff
|
148
150
|
namespace_array.delete(engine_name) if in_engine?
|
149
|
-
namespace_array
|
151
|
+
namespace_array.map(&:to_sym) # Rails >= 6.0.3.7 needs symbols in polymorphic routes
|
150
152
|
end
|
151
153
|
|
152
154
|
# Returns an array of underscored association names
|
@@ -1,9 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "tasks/harden_gutentag_migrations"
|
4
|
+
require "rails/generators"
|
5
|
+
require "thor"
|
6
|
+
require "alchemy/install/tasks"
|
4
7
|
|
5
8
|
module Alchemy
|
6
9
|
class Upgrader::FivePointZero < Upgrader
|
10
|
+
include Rails::Generators::Actions
|
11
|
+
include Thor::Base
|
12
|
+
include Thor::Actions
|
13
|
+
|
14
|
+
source_root File.expand_path("../../generators/alchemy/install/files", __dir__)
|
15
|
+
|
7
16
|
class << self
|
8
17
|
def install_gutentag_migrations
|
9
18
|
desc "Install Gutentag migrations"
|
@@ -36,6 +45,28 @@ module Alchemy
|
|
36
45
|
log "Root page not found.", :skip
|
37
46
|
end
|
38
47
|
end
|
48
|
+
|
49
|
+
def run_webpacker_installer
|
50
|
+
# Webpacker does not create a package.json, but we need one
|
51
|
+
unless File.exist? app_root.join("package.json")
|
52
|
+
in_root { run "echo '{}' > package.json" }
|
53
|
+
end
|
54
|
+
new.rake("webpacker:install", abort_on_failure: true)
|
55
|
+
end
|
56
|
+
|
57
|
+
def add_npm_package
|
58
|
+
new.run "yarn add @alchemy_cms/admin"
|
59
|
+
end
|
60
|
+
|
61
|
+
def copy_alchemy_entry_point
|
62
|
+
webpack_config = YAML.load_file(app_root.join("config", "webpacker.yml"))[Rails.env]
|
63
|
+
new.copy_file "alchemy_admin.js",
|
64
|
+
app_root.join(webpack_config["source_path"], webpack_config["source_entry_path"], "alchemy/admin.js")
|
65
|
+
end
|
66
|
+
|
67
|
+
def app_root
|
68
|
+
@_app_root ||= Rails.root
|
69
|
+
end
|
39
70
|
end
|
40
71
|
end
|
41
72
|
end
|
data/lib/alchemy/version.rb
CHANGED
@@ -4,8 +4,8 @@ namespace :alchemy do
|
|
4
4
|
namespace :generate do
|
5
5
|
desc "Generates all thumbnails for Alchemy Pictures and EssencePictures."
|
6
6
|
task thumbnails: [
|
7
|
-
"
|
8
|
-
"
|
7
|
+
"alchemy:generate:picture_thumbnails",
|
8
|
+
"alchemy:generate:essence_picture_thumbnails",
|
9
9
|
]
|
10
10
|
|
11
11
|
desc "Generates thumbnails for Alchemy Pictures."
|
@@ -14,6 +14,8 @@ namespace :alchemy do
|
|
14
14
|
puts "Please wait..."
|
15
15
|
|
16
16
|
Alchemy::Picture.find_each do |picture|
|
17
|
+
next unless picture.has_convertible_format?
|
18
|
+
|
17
19
|
puts Alchemy::PictureThumb.generate_thumbs!(picture)
|
18
20
|
end
|
19
21
|
|
@@ -42,6 +42,9 @@ namespace :alchemy do
|
|
42
42
|
"alchemy:upgrade:5.0:install_gutentag_migrations",
|
43
43
|
"alchemy:upgrade:5.0:remove_layout_roots",
|
44
44
|
"alchemy:upgrade:5.0:remove_root_page",
|
45
|
+
"alchemy:upgrade:5.0:run_webpacker_installer",
|
46
|
+
"alchemy:upgrade:5.0:add_npm_package",
|
47
|
+
"alchemy:upgrade:5.0:copy_alchemy_entry_point",
|
45
48
|
]
|
46
49
|
|
47
50
|
desc "Install Gutentag migrations"
|
@@ -58,6 +61,23 @@ namespace :alchemy do
|
|
58
61
|
task remove_root_page: [:environment] do
|
59
62
|
Alchemy::Upgrader::FivePointZero.remove_root_page
|
60
63
|
end
|
64
|
+
|
65
|
+
desc "Run webpacker installer"
|
66
|
+
task run_webpacker_installer: [:environment] do
|
67
|
+
Alchemy::Upgrader::FivePointZero.run_webpacker_installer
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "Add NPM package"
|
71
|
+
task add_npm_package: [:environment] do
|
72
|
+
puts "adding npm_package..."
|
73
|
+
Alchemy::Upgrader::FivePointZero.add_npm_package
|
74
|
+
end
|
75
|
+
|
76
|
+
desc "Copy alchemy entry point"
|
77
|
+
task copy_alchemy_entry_point: [:environment] do
|
78
|
+
puts "copying alchemy entry point"
|
79
|
+
Alchemy::Upgrader::FivePointZero.copy_alchemy_entry_point
|
80
|
+
end
|
61
81
|
end
|
62
82
|
end
|
63
83
|
end
|
data/package/admin.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import translate from "./src/i18n"
|
2
|
+
import translationData from "./src/translations"
|
2
3
|
import NodeTree from "./src/node_tree"
|
3
4
|
|
4
5
|
// Global Alchemy object
|
@@ -10,5 +11,6 @@ if (typeof window.Alchemy === "undefined") {
|
|
10
11
|
Object.assign(Alchemy, {
|
11
12
|
// Global utility method for translating a given string
|
12
13
|
t: translate,
|
14
|
+
translations: Object.assign(Alchemy.translations || {}, translationData),
|
13
15
|
NodeTree
|
14
16
|
})
|
@@ -15,12 +15,20 @@ describe("translate", () => {
|
|
15
15
|
})
|
16
16
|
|
17
17
|
describe("if translation is present", () => {
|
18
|
+
beforeEach(() => {
|
19
|
+
Alchemy.translations = { en: { help: "Help" } }
|
20
|
+
})
|
21
|
+
|
18
22
|
it("Returns translated string", () => {
|
19
23
|
expect(translate("help")).toEqual("Help")
|
20
24
|
})
|
21
25
|
|
22
26
|
describe("if key includes a period", () => {
|
23
27
|
describe("that is translated", () => {
|
28
|
+
beforeEach(() => {
|
29
|
+
Alchemy.translations = { en: { formats: { date: "Y-m-d" } } }
|
30
|
+
})
|
31
|
+
|
24
32
|
it("splits into group", () => {
|
25
33
|
expect(translate("formats.date")).toEqual("Y-m-d")
|
26
34
|
})
|
@@ -40,6 +48,10 @@ describe("translate", () => {
|
|
40
48
|
})
|
41
49
|
|
42
50
|
describe("if replacement is given", () => {
|
51
|
+
beforeEach(() => {
|
52
|
+
Alchemy.translations = { en: { allowed_chars: "of %{number} chars" } }
|
53
|
+
})
|
54
|
+
|
43
55
|
it("replaces it", () => {
|
44
56
|
expect(translate("allowed_chars", 5)).toEqual("of 5 chars")
|
45
57
|
})
|
@@ -67,4 +79,15 @@ describe("translate", () => {
|
|
67
79
|
spy.mockRestore()
|
68
80
|
})
|
69
81
|
})
|
82
|
+
|
83
|
+
describe("if Alchemy.translations is not set", () => {
|
84
|
+
it("Returns passed string and logs a warning", () => {
|
85
|
+
const spy = jest.spyOn(console, "warn").mockImplementation(() => {})
|
86
|
+
expect(translate("help")).toEqual("help")
|
87
|
+
expect(spy.mock.calls).toEqual([
|
88
|
+
["Translations for locale kl not found!"]
|
89
|
+
])
|
90
|
+
spy.mockRestore()
|
91
|
+
})
|
92
|
+
})
|
70
93
|
})
|
data/package/src/i18n.js
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
import translationData from "./translations"
|
2
|
-
|
3
1
|
const KEY_SEPARATOR = /\./
|
4
2
|
|
5
3
|
function currentLocale() {
|
@@ -11,7 +9,7 @@ function currentLocale() {
|
|
11
9
|
|
12
10
|
function getTranslations() {
|
13
11
|
const locale = currentLocale()
|
14
|
-
const translations =
|
12
|
+
const translations = Alchemy.translations && Alchemy.translations[locale]
|
15
13
|
|
16
14
|
if (translations) {
|
17
15
|
return translations
|
data/package.json
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: 5.1.
|
4
|
+
version: 5.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas von Deyen
|
@@ -10,10 +10,10 @@ authors:
|
|
10
10
|
- Hendrik Mans
|
11
11
|
- Carsten Fregin
|
12
12
|
- Martin Meyerhoff
|
13
|
-
autorequire:
|
13
|
+
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2021-
|
16
|
+
date: 2021-09-15 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: active_model_serializers
|
@@ -113,6 +113,9 @@ dependencies:
|
|
113
113
|
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: 1.0.7
|
116
|
+
- - "<"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 1.4.0
|
116
119
|
type: :runtime
|
117
120
|
prerelease: false
|
118
121
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -123,6 +126,9 @@ dependencies:
|
|
123
126
|
- - ">="
|
124
127
|
- !ruby/object:Gem::Version
|
125
128
|
version: 1.0.7
|
129
|
+
- - "<"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.4.0
|
126
132
|
- !ruby/object:Gem::Dependency
|
127
133
|
name: dragonfly_svg
|
128
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1278,8 +1284,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1278
1284
|
version: '0'
|
1279
1285
|
requirements:
|
1280
1286
|
- ImageMagick (libmagick), v6.6 or greater.
|
1281
|
-
rubygems_version: 3.
|
1282
|
-
signing_key:
|
1287
|
+
rubygems_version: 3.2.26
|
1288
|
+
signing_key:
|
1283
1289
|
specification_version: 4
|
1284
1290
|
summary: A powerful, userfriendly and flexible CMS for Rails
|
1285
1291
|
test_files: []
|
1292
|
+
...
|