alchemy_cms 5.1.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +2 -1
  3. data/CHANGELOG.md +51 -0
  4. data/Gemfile +2 -1
  5. data/alchemy_cms.gemspec +2 -2
  6. data/app/assets/stylesheets/alchemy/_variables.scss +2 -0
  7. data/app/assets/stylesheets/alchemy/elements.scss +38 -5
  8. data/app/controllers/alchemy/admin/base_controller.rb +1 -0
  9. data/app/controllers/alchemy/admin/trash_controller.rb +2 -0
  10. data/app/decorators/alchemy/content_editor.rb +64 -0
  11. data/app/decorators/alchemy/element_editor.rb +67 -0
  12. data/app/helpers/alchemy/admin/contents_helper.rb +3 -8
  13. data/app/helpers/alchemy/elements_helper.rb +0 -18
  14. data/app/helpers/alchemy/pages_helper.rb +3 -1
  15. data/app/models/alchemy/attachment.rb +4 -0
  16. data/app/models/alchemy/content.rb +7 -0
  17. data/app/models/alchemy/element.rb +38 -0
  18. data/app/models/alchemy/element/definitions.rb +5 -22
  19. data/app/models/alchemy/page/page_elements.rb +9 -2
  20. data/app/models/alchemy/picture_variant.rb +1 -1
  21. data/app/views/alchemy/admin/elements/_element.html.erb +1 -1
  22. data/app/views/alchemy/admin/elements/_element_footer.html.erb +1 -1
  23. data/app/views/alchemy/admin/elements/_element_header.html.erb +2 -0
  24. data/app/views/alchemy/admin/elements/_element_toolbar.html.erb +1 -1
  25. data/config/brakeman.ignore +305 -17
  26. data/config/locales/alchemy.en.yml +40 -24
  27. data/lib/alchemy/deprecation.rb +1 -1
  28. data/lib/alchemy/element_definition.rb +70 -0
  29. data/lib/alchemy/elements_finder.rb +6 -2
  30. data/lib/alchemy/essence.rb +4 -4
  31. data/lib/alchemy/filetypes.rb +13 -0
  32. data/lib/alchemy/forms/builder.rb +1 -1
  33. data/lib/alchemy/i18n.rb +4 -5
  34. data/lib/alchemy/page_layout.rb +1 -0
  35. data/lib/alchemy/resource.rb +5 -3
  36. data/lib/alchemy/test_support.rb +18 -0
  37. data/lib/alchemy/test_support/essence_shared_examples.rb +0 -3
  38. data/lib/alchemy/test_support/factories.rb +11 -0
  39. data/lib/alchemy/test_support/factories/attachment_factory.rb +0 -2
  40. data/lib/alchemy/test_support/factories/content_factory.rb +0 -6
  41. data/lib/alchemy/test_support/factories/dummy_user_factory.rb +0 -2
  42. data/lib/alchemy/test_support/factories/element_factory.rb +0 -3
  43. data/lib/alchemy/test_support/factories/essence_file_factory.rb +0 -3
  44. data/lib/alchemy/test_support/factories/essence_page_factory.rb +0 -3
  45. data/lib/alchemy/test_support/factories/essence_picture_factory.rb +0 -4
  46. data/lib/alchemy/test_support/factories/essence_text_factory.rb +0 -2
  47. data/lib/alchemy/test_support/factories/language_factory.rb +0 -3
  48. data/lib/alchemy/test_support/factories/node_factory.rb +0 -4
  49. data/lib/alchemy/test_support/factories/page_factory.rb +0 -3
  50. data/lib/alchemy/test_support/factories/picture_factory.rb +0 -2
  51. data/lib/alchemy/test_support/factories/picture_thumb_factory.rb +0 -3
  52. data/lib/alchemy/test_support/factories/site_factory.rb +0 -2
  53. data/lib/alchemy/test_support/integration_helpers.rb +5 -5
  54. data/lib/alchemy/version.rb +1 -1
  55. data/lib/alchemy_cms.rb +1 -0
  56. metadata +8 -6
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "factory_bot"
4
- require "alchemy/test_support/factories/language_factory"
5
- require "alchemy/test_support/factories/page_factory"
6
-
7
3
  FactoryBot.define do
8
4
  factory :alchemy_node, class: "Alchemy::Node" do
9
5
  language { Alchemy::Language.default || create(:alchemy_language) }
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "factory_bot"
4
- require "alchemy/test_support/factories/language_factory"
5
-
6
3
  FactoryBot.define do
7
4
  factory :alchemy_page, class: "Alchemy::Page" do
8
5
  language do
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "factory_bot"
4
-
5
3
  FactoryBot.define do
6
4
  factory :alchemy_picture, class: "Alchemy::Picture" do
7
5
  image_file do
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "factory_bot"
4
- require "securerandom"
5
-
6
3
  FactoryBot.define do
7
4
  factory :alchemy_picture_thumb, class: "Alchemy::PictureThumb" do
8
5
  picture { create(:alchemy_picture) }
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "factory_bot"
4
-
5
3
  FactoryBot.define do
6
4
  factory :alchemy_site, class: "Alchemy::Site" do
7
5
  name { "A Site" }
@@ -6,16 +6,16 @@ module Alchemy
6
6
  # This file is included in spec_helper.rb
7
7
  #
8
8
  module IntegrationHelpers
9
- # Used to stub the current_alchemy_user
9
+ # Used to stub the current_user in integration specs
10
10
  #
11
11
  # Pass either a user object or a symbol in the format of ':as_admin'.
12
- # The browser language is set to english ('en')
13
12
  #
14
13
  def authorize_user(user_or_role = nil)
15
- if user_or_role.is_a?(Alchemy.user_class)
16
- user = user_or_role
17
- else
14
+ case user_or_role
15
+ when Symbol, String
18
16
  user = build(:alchemy_dummy_user, user_or_role)
17
+ else
18
+ user = user_or_role
19
19
  end
20
20
  allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user)
21
21
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "5.1.0"
4
+ VERSION = "5.2.0"
5
5
 
6
6
  def self.version
7
7
  VERSION
data/lib/alchemy_cms.rb CHANGED
@@ -35,6 +35,7 @@ require_relative "alchemy/config"
35
35
  require_relative "alchemy/configuration_methods"
36
36
  require_relative "alchemy/controller_actions"
37
37
  require_relative "alchemy/deprecation"
38
+ require_relative "alchemy/element_definition"
38
39
  require_relative "alchemy/elements_finder"
39
40
  require_relative "alchemy/errors"
40
41
  require_relative "alchemy/essence"
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.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2020-12-18 00:00:00.000000000 Z
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
@@ -276,7 +276,7 @@ dependencies:
276
276
  version: '1.8'
277
277
  - - "<"
278
278
  - !ruby/object:Gem::Version
279
- version: '3.0'
279
+ version: 2.4.2
280
280
  type: :runtime
281
281
  prerelease: false
282
282
  version_requirements: !ruby/object:Gem::Requirement
@@ -286,7 +286,7 @@ dependencies:
286
286
  version: '1.8'
287
287
  - - "<"
288
288
  - !ruby/object:Gem::Version
289
- version: '3.0'
289
+ version: 2.4.2
290
290
  - !ruby/object:Gem::Dependency
291
291
  name: request_store
292
292
  requirement: !ruby/object:Gem::Requirement
@@ -513,14 +513,14 @@ dependencies:
513
513
  requirements:
514
514
  - - "~>"
515
515
  - !ruby/object:Gem::Version
516
- version: 0.17.1
516
+ version: '0.20'
517
517
  type: :development
518
518
  prerelease: false
519
519
  version_requirements: !ruby/object:Gem::Requirement
520
520
  requirements:
521
521
  - - "~>"
522
522
  - !ruby/object:Gem::Version
523
- version: 0.17.1
523
+ version: '0.20'
524
524
  - !ruby/object:Gem::Dependency
525
525
  name: webdrivers
526
526
  requirement: !ruby/object:Gem::Requirement
@@ -1086,6 +1086,7 @@ files:
1086
1086
  - lib/alchemy/configuration_methods.rb
1087
1087
  - lib/alchemy/controller_actions.rb
1088
1088
  - lib/alchemy/deprecation.rb
1089
+ - lib/alchemy/element_definition.rb
1089
1090
  - lib/alchemy/elements_finder.rb
1090
1091
  - lib/alchemy/engine.rb
1091
1092
  - lib/alchemy/errors.rb
@@ -1110,6 +1111,7 @@ files:
1110
1111
  - lib/alchemy/shell.rb
1111
1112
  - lib/alchemy/taggable.rb
1112
1113
  - lib/alchemy/tasks/tidy.rb
1114
+ - lib/alchemy/test_support.rb
1113
1115
  - lib/alchemy/test_support/config_stubbing.rb
1114
1116
  - lib/alchemy/test_support/essence_shared_examples.rb
1115
1117
  - lib/alchemy/test_support/factories.rb