alchemy_cms 5.1.2 → 5.2.0.b1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a9ae8a64411801bcb7be5b56f82e42769cf60209f0aea166090ff85ad26cdce
4
- data.tar.gz: 3f7a532599c4c117a4f6aa526bafc905e0de1feaab8a2897ada425bc98769e4d
3
+ metadata.gz: f2d282ae615eeffe270108252f3979dbad9a1233d280f8834c1b5420afc27929
4
+ data.tar.gz: '095d174025843dd1c347c17ef6fe9ca93bf80398d6eb33f1d5f6d5c2d1c2e7d4'
5
5
  SHA512:
6
- metadata.gz: fb3d9c8af97d9e44fc6bcbf556a24b89945ebb2b029a3ce1f9cec97229dfc23c22f2333dbe4b6ff8cddb846fe5e291bf7f0a323040384a12e8962a5c80bb7d70
7
- data.tar.gz: e889382a72271598703b531c476cc7c9737a5b22441fefa1215035de46c14fa84f1a2f75e1d12b6f372b2115f7fecc5774c3198818f0a05939b052ad50a9869b
6
+ metadata.gz: 260ad000c50c5466d49644054541829229f4eebf0bb75e375c25aeffd835a61acfe5fd8d4accf45bc7724c707966fc8501c21f7ee1e080d73e84c1435265d4b0
7
+ data.tar.gz: '08af0b5dab164cfda123d3d600f486592ffc2f5ac59caf63a4c8b6642cf3febff9371c394adab35811c3c7e0c11601bf0b63e17211906dbd31300e7e9d70964a'
@@ -4,7 +4,7 @@ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  RSpec:
7
- runs-on: ubuntu-latest
7
+ runs-on: ubuntu-18.04
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
@@ -14,6 +14,7 @@ jobs:
14
14
  ruby:
15
15
  - '2.5.x'
16
16
  - '2.6.x'
17
+ - '2.7.x'
17
18
  database:
18
19
  - mysql
19
20
  - postgresql
data/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ## 5.2.0.b1 (2021-02-11)
2
+
3
+ ### Features
4
+
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))
7
+
8
+ ### Changes
9
+
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))
18
+
19
+ ### Misc
20
+
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))
27
+
1
28
  ## 5.1.2 (2021-01-26)
2
29
 
3
30
  - Allow to safe hidden elements [#2007](https://github.com/AlchemyCMS/alchemy_cms/pull/2007) ([tvdeyen](https://github.com/tvdeyen))
data/Gemfile CHANGED
@@ -22,7 +22,7 @@ group :development, :test do
22
22
  gem "yard"
23
23
  gem "redcarpet"
24
24
  gem "pry-byebug"
25
- gem "rubocop", "~> 1.1.0", require: false
25
+ gem "rubocop", "~> 1.9.0", require: false
26
26
  gem "listen"
27
27
  gem "localeapp", "~> 3.0", require: false
28
28
  gem "dotenv", "~> 2.2"
@@ -30,5 +30,6 @@ group :development, :test do
30
30
  gem "active_record_query_trace", require: false
31
31
  gem "rack-mini-profiler", require: false
32
32
  gem "rufo", require: false
33
+ gem "brakeman", require: false
33
34
  end
34
35
  end
data/alchemy_cms.gemspec CHANGED
@@ -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', '< 3.0']
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.17.1']
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 {
@@ -72,6 +72,7 @@ module Alchemy
72
72
  def trash_empty?(category)
73
73
  "alchemy/#{category.singularize}".classify.constantize.trashed.blank?
74
74
  end
75
+ deprecate :trash_empty?, deprecator: Alchemy::Deprecation
75
76
 
76
77
  def set_stamper
77
78
  if Alchemy.user_class < ActiveRecord::Base
@@ -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
@@ -17,6 +17,7 @@ module Alchemy
17
17
  taggable? ? "taggable" : "not-taggable",
18
18
  folded ? "folded" : "expanded",
19
19
  compact? ? "compact" : nil,
20
+ deprecated? ? "deprecated" : nil,
20
21
  fixed? ? "is-fixed" : "not-fixed",
21
22
  public? ? "visible" : "hidden",
22
23
  ].join(" ")
@@ -36,5 +37,46 @@ module Alchemy
36
37
 
37
38
  super
38
39
  end
40
+
41
+ # Returns a deprecation notice for elements marked deprecated
42
+ #
43
+ # You can either use localizations or pass a String as notice
44
+ # in the element definition.
45
+ #
46
+ # == Custom deprecation notices
47
+ #
48
+ # Use general element deprecation notice
49
+ #
50
+ # - name: old_element
51
+ # deprecated: true
52
+ #
53
+ # Add a translation to your locale file for a per element notice.
54
+ #
55
+ # en:
56
+ # alchemy:
57
+ # element_deprecation_notices:
58
+ # old_element: Foo baz widget is deprecated
59
+ #
60
+ # or use the global translation that apply to all deprecated elements.
61
+ #
62
+ # en:
63
+ # alchemy:
64
+ # element_deprecation_notice: Foo baz widget is deprecated
65
+ #
66
+ # or pass string as deprecation notice.
67
+ #
68
+ # - name: old_element
69
+ # deprecated: This element will be removed soon.
70
+ #
71
+ def deprecation_notice
72
+ case definition["deprecated"]
73
+ when String
74
+ definition["deprecated"]
75
+ when TrueClass
76
+ Alchemy.t(name,
77
+ scope: :element_deprecation_notices,
78
+ default: Alchemy.t(:element_deprecated))
79
+ end
80
+ end
39
81
  end
40
82
  end
@@ -19,13 +19,8 @@ module Alchemy
19
19
 
20
20
  content_name = content.name_for_label
21
21
 
22
- if content.definition.blank?
23
- warning("Content #{content.name} is missing its definition")
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
- [render_hint_for(content), render_content_name(content)].compact.join("&nbsp;").html_safe
37
+ [render_content_name(content), render_hint_for(content)].compact.join("&nbsp;").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)
@@ -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"]
@@ -37,6 +37,7 @@ module Alchemy
37
37
  "taggable",
38
38
  "compact",
39
39
  "message",
40
+ "deprecated",
40
41
  ].freeze
41
42
 
42
43
  SKIPPED_ATTRIBUTES_ON_COPY = [
@@ -124,6 +125,9 @@ module Alchemy
124
125
 
125
126
  # class methods
126
127
  class << self
128
+ deprecate :trashed, deprecator: Alchemy::Deprecation
129
+ deprecate :not_trashed, deprecator: Alchemy::Deprecation
130
+
127
131
  # Builds a new element as described in +/config/alchemy/elements.yml+
128
132
  #
129
133
  # - Returns a new Alchemy::Element object if no name is given in attributes,
@@ -227,10 +231,12 @@ module Alchemy
227
231
  self.folded = true
228
232
  remove_from_list
229
233
  end
234
+ deprecate :trash!, deprecator: Alchemy::Deprecation
230
235
 
231
236
  def trashed?
232
237
  position.nil?
233
238
  end
239
+ deprecate :trashed?, deprecator: Alchemy::Deprecation
234
240
 
235
241
  # Returns true if the definition of this element has a taggable true value.
236
242
  def taggable?
@@ -247,6 +253,38 @@ module Alchemy
247
253
  definition["compact"] == true
248
254
  end
249
255
 
256
+ # Defined as deprecated element?
257
+ #
258
+ # You can either set true or a String on your elements definition.
259
+ #
260
+ # == Passing true
261
+ #
262
+ # - name: old_element
263
+ # deprecated: true
264
+ #
265
+ # The deprecation notice can be translated. Either as global notice for all deprecated elements.
266
+ #
267
+ # en:
268
+ # alchemy:
269
+ # element_deprecation_notice: Foo baz widget is deprecated
270
+ #
271
+ # Or add a translation to your locale file for a per element notice.
272
+ #
273
+ # en:
274
+ # alchemy:
275
+ # element_deprecation_notices:
276
+ # old_element: Foo baz widget is deprecated
277
+ #
278
+ # == Pass a String
279
+ #
280
+ # - name: old_element
281
+ # deprecated: This element will be removed soon.
282
+ #
283
+ # @return Boolean
284
+ def deprecated?
285
+ !!definition["deprecated"]
286
+ end
287
+
250
288
  # The element's view partial is dependent from its name
251
289
  #
252
290
  # == Define elements