alchemy_cms 5.0.0.rc2 → 5.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +9 -17
- data/CHANGELOG.md +22 -1
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/app/controllers/alchemy/admin/pages_controller.rb +1 -1
- data/app/helpers/alchemy/admin/base_helper.rb +2 -0
- data/app/helpers/alchemy/url_helper.rb +2 -2
- data/app/models/alchemy/attachment.rb +4 -1
- data/app/models/alchemy/essence_file.rb +1 -1
- data/app/models/alchemy/essence_picture.rb +1 -1
- data/app/models/alchemy/essence_picture_view.rb +5 -1
- data/app/models/alchemy/picture/url.rb +4 -2
- data/app/serializers/alchemy/page_tree_serializer.rb +4 -4
- data/app/views/alchemy/admin/elements/_element_toolbar.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/show.html.erb +1 -1
- data/app/views/alchemy/admin/resources/index.html.erb +21 -22
- data/app/views/alchemy/essences/_essence_file_view.html.erb +1 -1
- data/lib/alchemy/resource.rb +5 -3
- data/lib/alchemy/version.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f72f743e334595c49a1bfd3c2faf2a7751106cbbf7db00e26df9ea6f676e0d9c
|
4
|
+
data.tar.gz: f370970c8934b50efc3c63b16cd7aaa8e6314334cbf7b71a76794567b69011ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: effc1689a9c747ab521c3d2af854e645c69050846cecef186788c908772f321fd679d0dc2372355651162b2a9837fa91d480121af3d0e4d45cf7505434626373
|
7
|
+
data.tar.gz: '00192ed6cc59f60a1aecb130d2302a5fe074ece729c154167d1b7d3c094c10039032c1382662b819ea72264c2a5c9a3f77ddaf92d784e60297c56360d590f11e'
|
data/.github/workflows/ci.yml
CHANGED
@@ -43,14 +43,14 @@ jobs:
|
|
43
43
|
MYSQL_ROOT_PASSWORD: password
|
44
44
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
45
45
|
steps:
|
46
|
-
- uses: actions/checkout@
|
46
|
+
- uses: actions/checkout@v2.3.4
|
47
47
|
- name: Set up Ruby
|
48
|
-
uses: actions/setup-ruby@v1
|
48
|
+
uses: actions/setup-ruby@v1.1.2
|
49
49
|
with:
|
50
50
|
ruby-version: ${{ matrix.ruby }}
|
51
51
|
- name: Restore apt cache
|
52
52
|
id: apt-cache
|
53
|
-
uses: actions/cache@
|
53
|
+
uses: actions/cache@v2.1.3
|
54
54
|
with:
|
55
55
|
path: /home/runner/apt/cache
|
56
56
|
key: ${{ runner.os }}-apt-${{ matrix.database }}
|
@@ -75,7 +75,7 @@ jobs:
|
|
75
75
|
gem install bundler
|
76
76
|
- name: Restore Ruby Gems cache
|
77
77
|
id: cache
|
78
|
-
uses: actions/cache@
|
78
|
+
uses: actions/cache@v2.1.3
|
79
79
|
with:
|
80
80
|
path: vendor/bundle
|
81
81
|
key: ${{ runner.os }}-bundle-${{ matrix.ruby }}-${{ matrix.rails }}-${{ matrix.database }}-${{ hashFiles('**/Gemfile') }}
|
@@ -87,7 +87,7 @@ jobs:
|
|
87
87
|
bundle install --jobs 4 --retry 3 --path vendor/bundle
|
88
88
|
- name: Restore node modules cache
|
89
89
|
id: yarn-cache
|
90
|
-
uses: actions/cache@
|
90
|
+
uses: actions/cache@v2.1.3
|
91
91
|
with:
|
92
92
|
path: spec/dummy/node_modules
|
93
93
|
key: ${{ runner.os }}-yarn-dummy-${{ hashFiles('./package.json') }}
|
@@ -97,12 +97,12 @@ jobs:
|
|
97
97
|
run: |
|
98
98
|
bundle exec rake alchemy:spec:prepare
|
99
99
|
- name: Run tests & publish code coverage
|
100
|
-
uses: paambaati/codeclimate-action@v2.5
|
100
|
+
uses: paambaati/codeclimate-action@v2.7.5
|
101
101
|
env:
|
102
102
|
CC_TEST_REPORTER_ID: bca4349e32f97919210ac8a450b04904b90683fcdd57d65a22c0f5065482bc22
|
103
103
|
with:
|
104
104
|
coverageCommand: bundle exec rspec
|
105
|
-
- uses: actions/upload-artifact@
|
105
|
+
- uses: actions/upload-artifact@main
|
106
106
|
if: failure()
|
107
107
|
with:
|
108
108
|
name: Screenshots
|
@@ -112,9 +112,9 @@ jobs:
|
|
112
112
|
env:
|
113
113
|
NODE_ENV: test
|
114
114
|
steps:
|
115
|
-
- uses: actions/checkout@
|
115
|
+
- uses: actions/checkout@v2.3.4
|
116
116
|
- name: Restore node modules cache
|
117
|
-
uses: actions/cache@
|
117
|
+
uses: actions/cache@v2.1.3
|
118
118
|
with:
|
119
119
|
path: node_modules
|
120
120
|
key: ${{ runner.os }}-yarn-${{ hashFiles('./package.json') }}
|
@@ -124,11 +124,3 @@ jobs:
|
|
124
124
|
run: yarn install
|
125
125
|
- name: Run jest
|
126
126
|
run: yarn jest
|
127
|
-
- name: Run jest & publish code coverage
|
128
|
-
uses: paambaati/codeclimate-action@v2.5.7
|
129
|
-
env:
|
130
|
-
CC_TEST_REPORTER_ID: bca4349e32f97919210ac8a450b04904b90683fcdd57d65a22c0f5065482bc22
|
131
|
-
with:
|
132
|
-
coverageLocations:
|
133
|
-
./coverage/lcov.info:lcov
|
134
|
-
coverageCommand: yarn jest --collectCoverage --coverageDirectory=coverage
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
|
-
## 5.0.
|
1
|
+
## 5.0.4 (2021-05-06)
|
2
2
|
|
3
|
+
- Use symbols in polymorphic routes for resources [#2087](https://github.com/AlchemyCMS/alchemy_cms/pull/2087) ([tvdeyen](https://github.com/tvdeyen))
|
4
|
+
|
5
|
+
## 5.0.3 (2021-01-12)
|
6
|
+
|
7
|
+
- Fix copy element feature [#1996](https://github.com/AlchemyCMS/alchemy_cms/pull/1996) ([tvdeyen](https://github.com/tvdeyen))
|
8
|
+
|
9
|
+
## 5.0.2 (2020-12-18)
|
10
|
+
|
11
|
+
- Fix page sorting [#1984](https://github.com/AlchemyCMS/alchemy_cms/pull/1984) ([tvdeyen](https://github.com/tvdeyen))
|
12
|
+
|
13
|
+
## 5.0.1 (2020-09-29)
|
14
|
+
|
15
|
+
- Better image alt text support [#1940](https://github.com/AlchemyCMS/alchemy_cms/pull/1940) ([tvdeyen](https://github.com/tvdeyen))
|
16
|
+
|
17
|
+
## 5.0.0 (2020-07-17)
|
18
|
+
|
19
|
+
- Do not convert JPEG images into JPG [#1904](https://github.com/AlchemyCMS/alchemy_cms/pull/1904) ([tvdeyen](https://github.com/tvdeyen))
|
20
|
+
- Do not enable image cropper if file is missing [#1903](https://github.com/AlchemyCMS/alchemy_cms/pull/1903) ([tvdeyen](https://github.com/tvdeyen))
|
21
|
+
- Always show original image as zoomed image [#1902](https://github.com/AlchemyCMS/alchemy_cms/pull/1902) ([tvdeyen](https://github.com/tvdeyen))
|
22
|
+
- Rename Attachment#urlname into slug [#1848](https://github.com/AlchemyCMS/alchemy_cms/pull/1848) ([tvdeyen](https://github.com/tvdeyen))
|
23
|
+
- Deprecate toolbar helper ([tvdeyen](https://github.com/tvdeyen))
|
3
24
|
- Deprecate redirect_to_public_child ([tvdeyen](https://github.com/tvdeyen))
|
4
25
|
- Add --auto-accept option to installer ([tvdeyen](https://github.com/tvdeyen))
|
5
26
|
- Move all installer code into install generator ([tvdeyen](https://github.com/tvdeyen))
|
data/Gemfile
CHANGED
@@ -10,7 +10,7 @@ if ENV["DB"].nil? || ENV["DB"] == "sqlite"
|
|
10
10
|
gem "sqlite3", "~> 1.4.1"
|
11
11
|
end
|
12
12
|
gem "mysql2", "~> 0.5.1" if ENV["DB"] == "mysql"
|
13
|
-
gem "pg",
|
13
|
+
gem "pg", "~> 1.0" if ENV["DB"] == "postgresql"
|
14
14
|
|
15
15
|
group :development, :test do
|
16
16
|
if ENV["GITHUB_ACTIONS"]
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# AlchemyCMS
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/alchemy_cms.svg)](http://badge.fury.io/rb/alchemy_cms)
|
4
|
-
[![Build Status](https://github.com/AlchemyCMS/alchemy_cms/workflows/CI/badge.svg?branch=
|
4
|
+
[![Build Status](https://github.com/AlchemyCMS/alchemy_cms/workflows/CI/badge.svg?branch=main)](https://github.com/AlchemyCMS/alchemy_cms/actions)
|
5
5
|
[![Maintainability](https://api.codeclimate.com/v1/badges/196c56c56568ed24a697/maintainability)](https://codeclimate.com/github/AlchemyCMS/alchemy_cms/maintainability)
|
6
6
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/196c56c56568ed24a697/test_coverage)](https://codeclimate.com/github/AlchemyCMS/alchemy_cms/test_coverage)
|
7
7
|
[![Depfu](https://badges.depfu.com/badges/ebe56d2dd7b7044a8ae700cc81212a8e/overview.svg)](https://depfu.com/github/AlchemyCMS/alchemy_cms?project_id=4600)
|
@@ -314,6 +314,8 @@ module Alchemy
|
|
314
314
|
end
|
315
315
|
end
|
316
316
|
|
317
|
+
deprecate toolbar: "Please use `content_for(:toolbar)` instead", deprecator: Alchemy::Deprecation
|
318
|
+
|
317
319
|
# (internal) Used by upload form
|
318
320
|
def new_asset_path_with_session_information(asset_type)
|
319
321
|
session_key = Rails.application.config.session_options[:key]
|
@@ -26,12 +26,12 @@ module Alchemy
|
|
26
26
|
|
27
27
|
# Returns the path for downloading an alchemy attachment
|
28
28
|
def download_alchemy_attachment_path(attachment)
|
29
|
-
alchemy.download_attachment_path(attachment, attachment.
|
29
|
+
alchemy.download_attachment_path(attachment, attachment.slug)
|
30
30
|
end
|
31
31
|
|
32
32
|
# Returns the url for downloading an alchemy attachment
|
33
33
|
def download_alchemy_attachment_url(attachment)
|
34
|
-
alchemy.download_attachment_url(attachment, attachment.
|
34
|
+
alchemy.download_attachment_url(attachment, attachment.slug)
|
35
35
|
end
|
36
36
|
|
37
37
|
# Returns the full url containing host, page and anchor for the given element
|
@@ -77,10 +77,13 @@ module Alchemy
|
|
77
77
|
end
|
78
78
|
|
79
79
|
# An url save filename without format suffix
|
80
|
-
def
|
80
|
+
def slug
|
81
81
|
CGI.escape(file_name.gsub(/\.#{extension}$/, "").tr(".", " "))
|
82
82
|
end
|
83
83
|
|
84
|
+
alias_method :urlname, :slug
|
85
|
+
deprecate urlname: :slug, deprecator: Alchemy::Deprecation
|
86
|
+
|
84
87
|
# Checks if the attachment is restricted, because it is attached on restricted pages only
|
85
88
|
def restricted?
|
86
89
|
pages.any? && pages.not_restricted.blank?
|
@@ -55,7 +55,7 @@ module Alchemy
|
|
55
55
|
def img_tag
|
56
56
|
@_img_tag ||= image_tag(
|
57
57
|
essence.picture_url(options.except(*DEFAULT_OPTIONS.keys)), {
|
58
|
-
alt:
|
58
|
+
alt: alt_text,
|
59
59
|
title: essence.title.presence,
|
60
60
|
class: caption ? nil : essence.css_class.presence,
|
61
61
|
srcset: srcset.join(", ").presence,
|
@@ -79,5 +79,9 @@ module Alchemy
|
|
79
79
|
width.present? ? "#{url} #{width}w" : "#{url} #{height}h"
|
80
80
|
end
|
81
81
|
end
|
82
|
+
|
83
|
+
def alt_text
|
84
|
+
essence.alt_tag.presence || html_options.delete(:alt) || essence.picture.name&.humanize
|
85
|
+
end
|
82
86
|
end
|
83
87
|
end
|
@@ -71,7 +71,9 @@ module Alchemy
|
|
71
71
|
|
72
72
|
encoding_options = []
|
73
73
|
|
74
|
-
|
74
|
+
convert_format = target_format != image_file_format.sub("jpeg", "jpg")
|
75
|
+
|
76
|
+
if target_format =~ /jpe?g/ && convert_format
|
75
77
|
quality = options[:quality] || Config.get(:output_image_jpg_quality)
|
76
78
|
encoding_options << "-quality #{quality}"
|
77
79
|
end
|
@@ -80,7 +82,7 @@ module Alchemy
|
|
80
82
|
encoding_options << "-flatten"
|
81
83
|
end
|
82
84
|
|
83
|
-
convertion_needed =
|
85
|
+
convertion_needed = convert_format || encoding_options.present?
|
84
86
|
|
85
87
|
if has_convertible_format? && convertion_needed
|
86
88
|
image = image.encode(target_format, encoding_options.join(" "))
|
@@ -40,7 +40,7 @@ module Alchemy
|
|
40
40
|
|
41
41
|
level = path.count + base_level
|
42
42
|
|
43
|
-
path.last[:children] << page_hash(page,
|
43
|
+
path.last[:children] << page_hash(page, level, folded)
|
44
44
|
end
|
45
45
|
|
46
46
|
tree
|
@@ -48,7 +48,7 @@ module Alchemy
|
|
48
48
|
|
49
49
|
protected
|
50
50
|
|
51
|
-
def page_hash(page,
|
51
|
+
def page_hash(page, level, folded)
|
52
52
|
p_hash = {
|
53
53
|
id: page.id,
|
54
54
|
name: page.name,
|
@@ -59,8 +59,8 @@ module Alchemy
|
|
59
59
|
urlname: page.urlname,
|
60
60
|
url_path: page.url_path,
|
61
61
|
level: level,
|
62
|
-
root: page.
|
63
|
-
root_or_leaf: page.
|
62
|
+
root: page.root?,
|
63
|
+
root_or_leaf: page.root? || page.leaf?,
|
64
64
|
children: [],
|
65
65
|
}
|
66
66
|
|
@@ -1,29 +1,28 @@
|
|
1
1
|
<% label_title = Alchemy.t("Create #{resource_name}", default: Alchemy.t('Create')) %>
|
2
2
|
|
3
|
-
<% toolbar
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
<% content_for(:toolbar) do %>
|
4
|
+
<%= toolbar_button(
|
5
|
+
icon: :plus,
|
6
|
+
label: label_title,
|
7
|
+
url: new_resource_path,
|
8
|
+
title: label_title,
|
9
|
+
hotkey: 'alt+n',
|
10
|
+
dialog_options: {
|
9
11
|
title: label_title,
|
10
|
-
|
11
|
-
dialog_options: {
|
12
|
-
title: label_title,
|
13
|
-
size: resource_window_size
|
14
|
-
},
|
15
|
-
if_permitted_to: [:create, resource_model]
|
12
|
+
size: resource_window_size
|
16
13
|
},
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
) %>
|
14
|
+
if_permitted_to: [:create, resource_model]
|
15
|
+
) %>
|
16
|
+
<%= toolbar_button(
|
17
|
+
icon: :download,
|
18
|
+
url: resource_url_proxy.url_for(action: 'index', format: 'csv', q: search_filter_params[:q], sort: params[:sort]),
|
19
|
+
label: Alchemy.t(:download_csv),
|
20
|
+
title: Alchemy.t(:download_csv),
|
21
|
+
dialog: false,
|
22
|
+
if_permitted_to: [:index, resource_model]
|
23
|
+
) %>
|
24
|
+
<%= render 'alchemy/admin/partials/search_form' %>
|
25
|
+
<% end %>
|
27
26
|
|
28
27
|
<div id="archive_all" class="resources-table-wrapper<%= ' with_tag_filter' if resource_has_tags || resource_has_filters %>">
|
29
28
|
<%= render 'alchemy/admin/resources/table_header' %>
|
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
|
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: 5.0.
|
4
|
+
version: 5.0.4
|
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:
|
16
|
+
date: 2021-05-06 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: active_model_serializers
|
@@ -1263,14 +1263,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1263
1263
|
version: 2.3.0
|
1264
1264
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1265
1265
|
requirements:
|
1266
|
-
- - "
|
1266
|
+
- - ">="
|
1267
1267
|
- !ruby/object:Gem::Version
|
1268
|
-
version:
|
1268
|
+
version: '0'
|
1269
1269
|
requirements:
|
1270
1270
|
- ImageMagick (libmagick), v6.6 or greater.
|
1271
|
-
rubygems_version: 3.
|
1272
|
-
signing_key:
|
1271
|
+
rubygems_version: 3.1.4
|
1272
|
+
signing_key:
|
1273
1273
|
specification_version: 4
|
1274
1274
|
summary: A powerful, userfriendly and flexible CMS for Rails
|
1275
1275
|
test_files: []
|
1276
|
-
...
|