alchemy_cms 5.1.9 → 5.2.0.b1
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 +2 -1
- data/CHANGELOG.md +21 -25
- data/Gemfile +2 -6
- data/alchemy_cms.gemspec +3 -3
- data/app/assets/stylesheets/alchemy/_variables.scss +2 -0
- data/app/assets/stylesheets/alchemy/elements.scss +38 -5
- data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +3 -3
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +7 -7
- data/app/controllers/alchemy/admin/base_controller.rb +1 -0
- data/app/controllers/alchemy/admin/trash_controller.rb +2 -0
- data/app/decorators/alchemy/content_editor.rb +64 -0
- data/app/decorators/alchemy/element_editor.rb +1 -25
- data/app/helpers/alchemy/admin/contents_helper.rb +3 -8
- data/app/helpers/alchemy/elements_helper.rb +0 -18
- data/app/helpers/alchemy/pages_helper.rb +1 -1
- data/app/models/alchemy/attachment.rb +5 -1
- data/app/models/alchemy/content.rb +7 -0
- data/app/models/alchemy/element/definitions.rb +5 -22
- data/app/models/alchemy/element.rb +39 -1
- data/app/models/alchemy/node.rb +1 -1
- data/app/models/alchemy/page/page_elements.rb +9 -2
- data/app/models/alchemy/page.rb +1 -1
- data/app/models/alchemy/picture.rb +2 -2
- data/app/models/alchemy/picture_variant.rb +1 -1
- data/app/views/alchemy/admin/elements/_element.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_element_header.html.erb +2 -0
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +3 -3
- data/config/brakeman.ignore +305 -17
- data/config/locales/alchemy.en.yml +40 -24
- data/lib/alchemy/deprecation.rb +1 -1
- data/lib/alchemy/element_definition.rb +70 -0
- data/lib/alchemy/elements_finder.rb +6 -2
- data/lib/alchemy/engine.rb +1 -1
- data/lib/alchemy/essence.rb +4 -4
- data/lib/alchemy/filetypes.rb +13 -0
- data/lib/alchemy/forms/builder.rb +1 -1
- data/lib/alchemy/i18n.rb +4 -5
- data/lib/alchemy/page_layout.rb +1 -0
- data/lib/alchemy/resource.rb +3 -5
- data/lib/alchemy/test_support/integration_helpers.rb +5 -5
- data/lib/alchemy/upgrader/five_point_zero.rb +0 -32
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +1 -0
- data/lib/generators/alchemy/install/install_generator.rb +1 -2
- data/lib/tasks/alchemy/thumbnails.rake +2 -4
- data/lib/tasks/alchemy/upgrade.rake +0 -20
- data/package/admin.js +0 -2
- data/package/src/__tests__/i18n.spec.js +0 -23
- data/package/src/i18n.js +3 -1
- data/package.json +1 -1
- metadata +12 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2d282ae615eeffe270108252f3979dbad9a1233d280f8834c1b5420afc27929
|
4
|
+
data.tar.gz: '095d174025843dd1c347c17ef6fe9ca93bf80398d6eb33f1d5f6d5c2d1c2e7d4'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 260ad000c50c5466d49644054541829229f4eebf0bb75e375c25aeffd835a61acfe5fd8d4accf45bc7724c707966fc8501c21f7ee1e080d73e84c1435265d4b0
|
7
|
+
data.tar.gz: '08af0b5dab164cfda123d3d600f486592ffc2f5ac59caf63a4c8b6642cf3febff9371c394adab35811c3c7e0c11601bf0b63e17211906dbd31300e7e9d70964a'
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,39 +1,35 @@
|
|
1
|
-
## 5.
|
1
|
+
## 5.2.0.b1 (2021-02-11)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
## 5.1.8 (2021-11-17)
|
6
|
-
|
7
|
-
- Set stampable user_class_name without root identifier ([tvdeyen](https://github.com/tvdeyen))
|
8
|
-
- Use relative path for tinymce font-face ([tvdeyen](https://github.com/tvdeyen))
|
9
|
-
|
10
|
-
## 5.1.7 (2021-10-26)
|
11
|
-
|
12
|
-
- Make sure to install correct npm package ([tvdeyen](https://github.com/tvdeyen))
|
13
|
-
|
14
|
-
## 5.1.6 (2021-09-17)
|
15
|
-
|
16
|
-
- Use self_and_ancestors in page_active? helper [#2194](https://github.com/AlchemyCMS/alchemy_cms/pull/2194) ([mamhoff](https://github.com/mamhoff))
|
3
|
+
### Features
|
17
4
|
|
18
|
-
|
5
|
+
- Allow Element and Content deprecation notices [#1988](https://github.com/AlchemyCMS/alchemy_cms/pull/1988) ([tvdeyen](https://github.com/tvdeyen))
|
6
|
+
- Add element definition api (based on PageLayout definitions) [#1986](https://github.com/AlchemyCMS/alchemy_cms/pull/1986) ([stockime](https://github.com/stockime))
|
19
7
|
|
20
|
-
|
21
|
-
- Backport #2115 to v5.1 [#2125](https://github.com/AlchemyCMS/alchemy_cms/pull/2125) ([dbwinger](https://github.com/dbwinger))
|
22
|
-
- Backport #2114 to v5.1 [#2117](https://github.com/AlchemyCMS/alchemy_cms/pull/2117) ([afdev82](https://github.com/afdev82))
|
8
|
+
### Changes
|
23
9
|
|
24
|
-
|
10
|
+
- Fix jpeg quality option for jpeg files [#2016](https://github.com/AlchemyCMS/alchemy_cms/pull/2016) ([kulturbande](https://github.com/kulturbande))
|
11
|
+
- Pin Ransack to below 2.4.2 [#2012](https://github.com/AlchemyCMS/alchemy_cms/pull/2012) ([tvdeyen](https://github.com/tvdeyen))
|
12
|
+
- Fix setting current_user in integration helper [#2006](https://github.com/AlchemyCMS/alchemy_cms/pull/2006) ([tvdeyen](https://github.com/tvdeyen))
|
13
|
+
- Update mime type icons and translations [#2002](https://github.com/AlchemyCMS/alchemy_cms/pull/2002) ([tvdeyen](https://github.com/tvdeyen))
|
14
|
+
- Deprecate page layout change [#1993](https://github.com/AlchemyCMS/alchemy_cms/pull/1993) ([tvdeyen](https://github.com/tvdeyen))
|
15
|
+
- Fix Ruby 2.7 deprecations [#1989](https://github.com/AlchemyCMS/alchemy_cms/pull/1989) ([tvdeyen](https://github.com/tvdeyen))
|
16
|
+
- Deprecate trash [#1985](https://github.com/AlchemyCMS/alchemy_cms/pull/1985) ([tvdeyen](https://github.com/tvdeyen))
|
17
|
+
- Deprecate elements fallbacks [#1982](https://github.com/AlchemyCMS/alchemy_cms/pull/1982) ([tvdeyen](https://github.com/tvdeyen))
|
25
18
|
|
26
|
-
|
27
|
-
- Do not attempt to generate thumbs for svg files. [#2090](https://github.com/AlchemyCMS/alchemy_cms/pull/2090) ([oneiros](https://github.com/oneiros))
|
19
|
+
### Misc
|
28
20
|
|
29
|
-
|
21
|
+
- Use Ubuntu 18.04 on GH actions [#2018](https://github.com/AlchemyCMS/alchemy_cms/pull/2018) ([tvdeyen](https://github.com/tvdeyen))
|
22
|
+
- [ruby - main] Upgrade rubocop to version 1.9.0 [#2011](https://github.com/AlchemyCMS/alchemy_cms/pull/2011) ([depfu](https://github.com/apps/depfu))
|
23
|
+
- [ruby - main] Upgrade rubocop to version 1.8.1 [#1999](https://github.com/AlchemyCMS/alchemy_cms/pull/1999) ([depfu](https://github.com/apps/depfu))
|
24
|
+
- Update brakeman ignores [#1992](https://github.com/AlchemyCMS/alchemy_cms/pull/1992) ([tvdeyen](https://github.com/tvdeyen))
|
25
|
+
- [ruby - main] Upgrade rubocop to version 1.6.1 [#1978](https://github.com/AlchemyCMS/alchemy_cms/pull/1978) ([depfu](https://github.com/apps/depfu))
|
26
|
+
- [ruby - main] Upgrade simplecov to version 0.20.0 [#1971](https://github.com/AlchemyCMS/alchemy_cms/pull/1971) ([depfu](https://github.com/apps/depfu))
|
30
27
|
|
31
|
-
- Use symbols in polymorphic routes for resources [#2087](https://github.com/AlchemyCMS/alchemy_cms/pull/2087) ([tvdeyen](https://github.com/tvdeyen))
|
32
|
-
- Backport #2049 to 5.1 [#2059](https://github.com/AlchemyCMS/alchemy_cms/pull/2059) ([rickythefox](https://github.com/rickythefox))
|
33
28
|
## 5.1.2 (2021-01-26)
|
34
29
|
|
35
30
|
- Allow to safe hidden elements [#2007](https://github.com/AlchemyCMS/alchemy_cms/pull/2007) ([tvdeyen](https://github.com/tvdeyen))
|
36
31
|
|
32
|
+
|
37
33
|
## 5.1.1 (2021-01-12)
|
38
34
|
|
39
35
|
- Fix copy element feature [#1996](https://github.com/AlchemyCMS/alchemy_cms/pull/1996) ([tvdeyen](https://github.com/tvdeyen))
|
data/Gemfile
CHANGED
@@ -13,11 +13,6 @@ 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
|
-
|
21
16
|
if ENV["GITHUB_ACTIONS"]
|
22
17
|
gem "sassc", "~> 2.4.0" # https://github.com/sass/sassc-ruby/issues/146
|
23
18
|
else
|
@@ -27,7 +22,7 @@ group :development, :test do
|
|
27
22
|
gem "yard"
|
28
23
|
gem "redcarpet"
|
29
24
|
gem "pry-byebug"
|
30
|
-
gem "rubocop", "~> 1.
|
25
|
+
gem "rubocop", "~> 1.9.0", require: false
|
31
26
|
gem "listen"
|
32
27
|
gem "localeapp", "~> 3.0", require: false
|
33
28
|
gem "dotenv", "~> 2.2"
|
@@ -35,5 +30,6 @@ group :development, :test do
|
|
35
30
|
gem "active_record_query_trace", require: false
|
36
31
|
gem "rack-mini-profiler", require: false
|
37
32
|
gem "rufo", require: false
|
33
|
+
gem "brakeman", require: false
|
38
34
|
end
|
39
35
|
end
|
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']
|
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']
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |gem|
|
|
33
33
|
gem.add_runtime_dependency 'originator', ['~> 3.1']
|
34
34
|
gem.add_runtime_dependency 'non-stupid-digest-assets', ['~> 1.0.8']
|
35
35
|
gem.add_runtime_dependency 'rails', ['>= 5.2.0', '< 6.1']
|
36
|
-
gem.add_runtime_dependency 'ransack', ['>= 1.8', '<
|
36
|
+
gem.add_runtime_dependency 'ransack', ['>= 1.8', '< 2.4.2'] # 2.4.2 dropped Ruby 2.5 support in a patch level release
|
37
37
|
gem.add_runtime_dependency 'request_store', ['~> 1.2']
|
38
38
|
gem.add_runtime_dependency 'responders', ['>= 2.0', '< 4.0']
|
39
39
|
gem.add_runtime_dependency 'sassc-rails', ['~> 2.1']
|
@@ -49,7 +49,7 @@ Gem::Specification.new do |gem|
|
|
49
49
|
gem.add_development_dependency 'rails-controller-testing', ['~> 1.0']
|
50
50
|
gem.add_development_dependency 'rspec-activemodel-mocks', ['~> 1.0']
|
51
51
|
gem.add_development_dependency 'rspec-rails', ['>= 4.0.0.beta2']
|
52
|
-
gem.add_development_dependency 'simplecov', ['~> 0.
|
52
|
+
gem.add_development_dependency 'simplecov', ['~> 0.20']
|
53
53
|
gem.add_development_dependency 'webdrivers', ['~> 4.0']
|
54
54
|
gem.add_development_dependency 'webmock', ['~> 3.3']
|
55
55
|
gem.add_development_dependency 'shoulda-matchers', ['~> 4.0']
|
@@ -145,6 +145,8 @@ $elements-window-min-width: 400px !default;
|
|
145
145
|
$element-header-bg-color: $medium-gray !default;
|
146
146
|
$element-header-active-bg-color: $dark-blue !default;
|
147
147
|
$element-header-active-color: $white !default;
|
148
|
+
$element-header-deprecated-bg-color: rgba(253, 213, 175, 0.25) !default;
|
149
|
+
$element-deprecated-border-color: rgb(253, 213, 175) !default;
|
148
150
|
$top-menu-height: 75px !default;
|
149
151
|
|
150
152
|
$tabs-height: 31px !default;
|
@@ -170,13 +170,32 @@
|
|
170
170
|
}
|
171
171
|
}
|
172
172
|
|
173
|
+
&.deprecated {
|
174
|
+
border-color: $element-deprecated-border-color;
|
175
|
+
|
176
|
+
> .element-header {
|
177
|
+
background-color: $element-header-deprecated-bg-color;
|
178
|
+
background-image: linear-gradient(
|
179
|
+
45deg,
|
180
|
+
$element-header-deprecated-bg-color 25%,
|
181
|
+
$element-header-bg-color 25%,
|
182
|
+
$element-header-bg-color 50%,
|
183
|
+
$element-header-deprecated-bg-color 50%,
|
184
|
+
$element-header-deprecated-bg-color 75%,
|
185
|
+
$element-header-bg-color 75%,
|
186
|
+
$element-header-bg-color 100%
|
187
|
+
);
|
188
|
+
background-size: 28.28px 28.28px;
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
173
192
|
&.selected:not(.is-fixed), &:hover {
|
174
193
|
&:not(.hidden) {
|
175
194
|
box-shadow: 0 2px 8px rgba(#9b9b9b, 0.75);
|
176
195
|
}
|
177
196
|
}
|
178
197
|
|
179
|
-
&.selected:not(.is-fixed):not(.folded):not(.dirty):not(.hidden) {
|
198
|
+
&.selected:not(.is-fixed):not(.folded):not(.dirty):not(.hidden):not(.deprecated) {
|
180
199
|
> .element-header {
|
181
200
|
background-color: $element-header-active-bg-color;
|
182
201
|
color: $element-header-active-color;
|
@@ -670,6 +689,24 @@ select.long {
|
|
670
689
|
}
|
671
690
|
}
|
672
691
|
|
692
|
+
&.deprecated {
|
693
|
+
border-radius: $default-border-radius;
|
694
|
+
background-color: $element-header-deprecated-bg-color;
|
695
|
+
background-image: linear-gradient(
|
696
|
+
45deg,
|
697
|
+
$element-header-deprecated-bg-color 25%,
|
698
|
+
$element-header-bg-color 25%,
|
699
|
+
$element-header-bg-color 50%,
|
700
|
+
$element-header-deprecated-bg-color 50%,
|
701
|
+
$element-header-deprecated-bg-color 75%,
|
702
|
+
$element-header-bg-color 75%,
|
703
|
+
$element-header-bg-color 100%
|
704
|
+
);
|
705
|
+
background-size: 28.28px 28.28px;
|
706
|
+
padding-left: 2px;
|
707
|
+
padding-right: 2px;
|
708
|
+
}
|
709
|
+
|
673
710
|
label {
|
674
711
|
display: block;
|
675
712
|
margin: $default-margin 0;
|
@@ -802,10 +839,6 @@ textarea.has_tinymce {
|
|
802
839
|
}
|
803
840
|
}
|
804
841
|
|
805
|
-
.element-handle .hint-with-icon {
|
806
|
-
top: -1px;
|
807
|
-
}
|
808
|
-
|
809
842
|
.is-fixed {
|
810
843
|
&.with-contents {
|
811
844
|
>.element-footer {
|
@@ -30,7 +30,7 @@ td,th {
|
|
30
30
|
|
31
31
|
.mce-object {
|
32
32
|
border: 1px dotted #3a3a3a;
|
33
|
-
background: #d5d5d5 url(
|
33
|
+
background: #d5d5d5 url(img/object.gif) no-repeat center;
|
34
34
|
}
|
35
35
|
|
36
36
|
.mce-pagebreak {
|
@@ -55,7 +55,7 @@ td,th {
|
|
55
55
|
width: 9px!important;
|
56
56
|
height: 9px!important;
|
57
57
|
border: 1px dotted #3a3a3a;
|
58
|
-
background: #d5d5d5 url(
|
58
|
+
background: #d5d5d5 url(img/anchor.gif) no-repeat center;
|
59
59
|
}
|
60
60
|
|
61
61
|
.mce-nbsp {
|
@@ -77,7 +77,7 @@ hr {
|
|
77
77
|
}
|
78
78
|
|
79
79
|
.mce-spellchecker-word {
|
80
|
-
background: url(
|
80
|
+
background: url(img/wline.gif) repeat-x bottom left;
|
81
81
|
cursor: default;
|
82
82
|
}
|
83
83
|
|
@@ -1561,23 +1561,23 @@ i.mce-i-resize {
|
|
1561
1561
|
opacity: 0.6;
|
1562
1562
|
filter: alpha(opacity=60);
|
1563
1563
|
zoom: 1;
|
1564
|
-
background: #fff url('
|
1564
|
+
background: #fff url('img/loader.gif') no-repeat center center;
|
1565
1565
|
}
|
1566
1566
|
|
1567
1567
|
@font-face {
|
1568
1568
|
font-family: 'tinymce';
|
1569
|
-
src: url('
|
1570
|
-
url('
|
1571
|
-
url('
|
1569
|
+
src: url('fonts/tinymce.woff') format('woff'),
|
1570
|
+
url('fonts/tinymce.ttf') format('truetype'),
|
1571
|
+
url('fonts/tinymce.svg#tinymce') format('svg');
|
1572
1572
|
font-weight: normal;
|
1573
1573
|
font-style: normal;
|
1574
1574
|
}
|
1575
1575
|
|
1576
1576
|
@font-face {
|
1577
1577
|
font-family: 'tinymce-small';
|
1578
|
-
src: url('
|
1579
|
-
url('
|
1580
|
-
url('
|
1578
|
+
src: url('fonts/tinymce-small.woff') format('woff'),
|
1579
|
+
url('fonts/tinymce-small.ttf') format('truetype'),
|
1580
|
+
url('fonts/tinymce-small.svg#tinymce') format('svg');
|
1581
1581
|
font-weight: normal;
|
1582
1582
|
font-style: normal;
|
1583
1583
|
}
|
@@ -12,12 +12,14 @@ module Alchemy
|
|
12
12
|
@page = Page.find(params[:page_id])
|
13
13
|
@allowed_elements = @page.available_element_definitions
|
14
14
|
end
|
15
|
+
deprecate :index, deprecator: Alchemy::Deprecation
|
15
16
|
|
16
17
|
def clear
|
17
18
|
@page = Page.find(params[:page_id])
|
18
19
|
@elements = Element.trashed
|
19
20
|
@elements.map(&:destroy)
|
20
21
|
end
|
22
|
+
deprecate :clear, deprecator: Alchemy::Deprecation
|
21
23
|
|
22
24
|
private
|
23
25
|
|
@@ -12,6 +12,7 @@ module Alchemy
|
|
12
12
|
[
|
13
13
|
"content_editor",
|
14
14
|
essence_partial_name,
|
15
|
+
deprecated? ? "deprecated" : nil,
|
15
16
|
].compact
|
16
17
|
end
|
17
18
|
|
@@ -51,5 +52,68 @@ module Alchemy
|
|
51
52
|
|
52
53
|
super
|
53
54
|
end
|
55
|
+
|
56
|
+
def has_warnings?
|
57
|
+
definition.blank? || deprecated?
|
58
|
+
end
|
59
|
+
|
60
|
+
def warnings
|
61
|
+
return unless has_warnings?
|
62
|
+
|
63
|
+
if definition.blank?
|
64
|
+
Logger.warn("Content #{name} is missing its definition", caller(1..1))
|
65
|
+
Alchemy.t(:content_definition_missing)
|
66
|
+
else
|
67
|
+
deprecation_notice
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Returns a deprecation notice for contents marked deprecated
|
72
|
+
#
|
73
|
+
# You can either use localizations or pass a String as notice
|
74
|
+
# in the content definition.
|
75
|
+
#
|
76
|
+
# == Custom deprecation notices
|
77
|
+
#
|
78
|
+
# Use general content deprecation notice
|
79
|
+
#
|
80
|
+
# - name: element_name
|
81
|
+
# contents:
|
82
|
+
# - name: old_content
|
83
|
+
# type: EssenceText
|
84
|
+
# deprecated: true
|
85
|
+
#
|
86
|
+
# Add a translation to your locale file for a per content notice.
|
87
|
+
#
|
88
|
+
# en:
|
89
|
+
# alchemy:
|
90
|
+
# content_deprecation_notices:
|
91
|
+
# element_name:
|
92
|
+
# old_content: Foo baz widget is deprecated
|
93
|
+
#
|
94
|
+
# or use the global translation that apply to all deprecated contents.
|
95
|
+
#
|
96
|
+
# en:
|
97
|
+
# alchemy:
|
98
|
+
# content_deprecation_notice: Foo baz widget is deprecated
|
99
|
+
#
|
100
|
+
# or pass string as deprecation notice.
|
101
|
+
#
|
102
|
+
# - name: element_name
|
103
|
+
# contents:
|
104
|
+
# - name: old_content
|
105
|
+
# type: EssenceText
|
106
|
+
# deprecated: This content will be removed soon.
|
107
|
+
#
|
108
|
+
def deprecation_notice
|
109
|
+
case definition["deprecated"]
|
110
|
+
when String
|
111
|
+
definition["deprecated"]
|
112
|
+
when TrueClass
|
113
|
+
Alchemy.t(name,
|
114
|
+
scope: [:content_deprecation_notices, element.name],
|
115
|
+
default: Alchemy.t(:content_deprecated))
|
116
|
+
end
|
117
|
+
end
|
54
118
|
end
|
55
119
|
end
|
@@ -8,17 +8,6 @@ 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
|
-
|
22
11
|
# CSS classes for the element editor partial.
|
23
12
|
def css_classes
|
24
13
|
[
|
@@ -28,6 +17,7 @@ module Alchemy
|
|
28
17
|
taggable? ? "taggable" : "not-taggable",
|
29
18
|
folded ? "folded" : "expanded",
|
30
19
|
compact? ? "compact" : nil,
|
20
|
+
deprecated? ? "deprecated" : nil,
|
31
21
|
fixed? ? "is-fixed" : "not-fixed",
|
32
22
|
public? ? "visible" : "hidden",
|
33
23
|
].join(" ")
|
@@ -88,19 +78,5 @@ module Alchemy
|
|
88
78
|
default: Alchemy.t(:element_deprecated))
|
89
79
|
end
|
90
80
|
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
|
105
81
|
end
|
106
82
|
end
|
@@ -19,13 +19,8 @@ module Alchemy
|
|
19
19
|
|
20
20
|
content_name = content.name_for_label
|
21
21
|
|
22
|
-
if content.
|
23
|
-
|
24
|
-
|
25
|
-
icon = hint_with_tooltip(
|
26
|
-
Alchemy.t(:content_definition_missing),
|
27
|
-
)
|
28
|
-
|
22
|
+
if content.has_warnings?
|
23
|
+
icon = hint_with_tooltip(content.warnings)
|
29
24
|
content_name = "#{icon} #{content_name}".html_safe
|
30
25
|
end
|
31
26
|
|
@@ -39,7 +34,7 @@ module Alchemy
|
|
39
34
|
# Renders the label and a remove link for a content.
|
40
35
|
def content_label(content)
|
41
36
|
content_tag :label, for: content.form_field_id do
|
42
|
-
[
|
37
|
+
[render_content_name(content), render_hint_for(content)].compact.join(" ").html_safe
|
43
38
|
end
|
44
39
|
end
|
45
40
|
end
|
@@ -28,22 +28,6 @@ module Alchemy
|
|
28
28
|
# <%= render_elements from_page: 'footer' %>
|
29
29
|
# </footer>
|
30
30
|
#
|
31
|
-
# === Fallback to elements from global page:
|
32
|
-
#
|
33
|
-
# You can use the fallback option as an override for elements that are stored on another page.
|
34
|
-
# So you can take elements from a global page and only if the user adds an element on current page the
|
35
|
-
# local one gets rendered.
|
36
|
-
#
|
37
|
-
# 1. You have to pass the the name of the element the fallback is for as <tt>for</tt> key.
|
38
|
-
# 2. You have to pass a <tt>page_layout</tt> name or {Alchemy::Page} from where the fallback elements is taken from as <tt>from</tt> key.
|
39
|
-
# 3. You can pass the name of element to fallback with as <tt>with</tt> key. This is optional (the element name from the <tt>for</tt> key is taken as default).
|
40
|
-
#
|
41
|
-
# <%= render_elements(fallback: {
|
42
|
-
# for: 'contact_teaser',
|
43
|
-
# from: 'sidebar',
|
44
|
-
# with: 'contact_teaser'
|
45
|
-
# }) %>
|
46
|
-
#
|
47
31
|
# === Custom elements finder:
|
48
32
|
#
|
49
33
|
# Having a custom element finder class:
|
@@ -76,8 +60,6 @@ module Alchemy
|
|
76
60
|
# The amount of elements to be rendered (begins with first element found)
|
77
61
|
# @option options [Number] :offset
|
78
62
|
# The offset to begin loading elements from
|
79
|
-
# @option options [Hash] :fallback
|
80
|
-
# Define elements that are rendered from another page.
|
81
63
|
# @option options [Boolean] :random (false)
|
82
64
|
# Randomize the output of elements
|
83
65
|
# @option options [Boolean] :reverse (false)
|
@@ -100,7 +100,7 @@ module Alchemy
|
|
100
100
|
|
101
101
|
# Returns true if page is in the active branch
|
102
102
|
def page_active?(page)
|
103
|
-
@_page_ancestors ||= @page
|
103
|
+
@_page_ancestors ||= Page.ancestors_for(@page)
|
104
104
|
@_page_ancestors.include?(page)
|
105
105
|
end
|
106
106
|
|
@@ -28,7 +28,7 @@ module Alchemy
|
|
28
28
|
after_assign { |f| write_attribute(:file_mime_type, f.mime_type) }
|
29
29
|
end
|
30
30
|
|
31
|
-
stampable stamper_class_name: Alchemy.
|
31
|
+
stampable stamper_class_name: Alchemy.user_class_name
|
32
32
|
|
33
33
|
has_many :essence_files, class_name: "Alchemy::EssenceFile", foreign_key: "attachment_id"
|
34
34
|
has_many :contents, through: :essence_files
|
@@ -125,6 +125,10 @@ module Alchemy
|
|
125
125
|
"file-alt"
|
126
126
|
when *EXCEL_FILE_TYPES
|
127
127
|
"file-excel"
|
128
|
+
when *POWERPOINT_FILE_TYPES
|
129
|
+
"file-powerpoint"
|
130
|
+
when *WORD_FILE_TYPES
|
131
|
+
"file-word"
|
128
132
|
when *VCARD_FILE_TYPES
|
129
133
|
"address-card"
|
130
134
|
when *ARCHIVE_FILE_TYPES
|
@@ -46,9 +46,12 @@ module Alchemy
|
|
46
46
|
|
47
47
|
delegate :restricted?, to: :page, allow_nil: true
|
48
48
|
delegate :trashed?, to: :element, allow_nil: true
|
49
|
+
deprecate :trashed?, deprecator: Alchemy::Deprecation
|
49
50
|
delegate :public?, to: :element, allow_nil: true
|
50
51
|
|
51
52
|
class << self
|
53
|
+
deprecate :not_trashed, deprecator: Alchemy::Deprecation
|
54
|
+
|
52
55
|
# Returns the translated label for a content name.
|
53
56
|
#
|
54
57
|
# Translate it in your locale yml file:
|
@@ -189,6 +192,10 @@ module Alchemy
|
|
189
192
|
essence && !essence.link.blank?
|
190
193
|
end
|
191
194
|
|
195
|
+
def deprecated?
|
196
|
+
!!definition["deprecated"]
|
197
|
+
end
|
198
|
+
|
192
199
|
# Returns true if this content should be taken for element preview.
|
193
200
|
def preview_content?
|
194
201
|
!!definition["as_element_title"]
|
@@ -13,41 +13,24 @@ module Alchemy
|
|
13
13
|
# your own set of elements
|
14
14
|
#
|
15
15
|
def definitions
|
16
|
-
|
16
|
+
ElementDefinition.all
|
17
17
|
end
|
18
18
|
|
19
19
|
# Returns one element definition by given name.
|
20
20
|
#
|
21
21
|
def definition_by_name(name)
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
# Reads the element definitions file named +elements.yml+ from +config/alchemy/+ folder.
|
28
|
-
#
|
29
|
-
def read_definitions_file
|
30
|
-
if ::File.exist?(definitions_file_path)
|
31
|
-
::YAML.safe_load(ERB.new(File.read(definitions_file_path)).result, YAML_WHITELIST_CLASSES, [], true) || []
|
32
|
-
else
|
33
|
-
raise LoadError, "Could not find elements.yml file! Please run `rails generate alchemy:install`"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# Returns the +elements.yml+ file path
|
38
|
-
#
|
39
|
-
def definitions_file_path
|
40
|
-
Rails.root.join "config/alchemy/elements.yml"
|
22
|
+
ElementDefinition.get(name)
|
41
23
|
end
|
42
24
|
end
|
43
25
|
|
44
26
|
# The definition of this element.
|
45
27
|
#
|
46
28
|
def definition
|
47
|
-
if definition = self.class.
|
29
|
+
if definition = self.class.definition_by_name(name)
|
48
30
|
definition
|
49
31
|
else
|
50
|
-
log_warning "Could not find element definition for #{name}.
|
32
|
+
log_warning "Could not find element definition for #{name}. " \
|
33
|
+
"Please check your elements.yml file!"
|
51
34
|
{}
|
52
35
|
end
|
53
36
|
end
|