alchemy_cms 5.0.10 → 5.1.0.beta1

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.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +1 -1
  3. data/.github/workflows/stale.yml +1 -1
  4. data/.gitignore +1 -0
  5. data/.travis.yml +48 -0
  6. data/CHANGELOG.md +50 -40
  7. data/CONTRIBUTING.md +2 -2
  8. data/Gemfile +2 -2
  9. data/README.md +2 -2
  10. data/alchemy_cms.gemspec +4 -4
  11. data/app/assets/images/alchemy/missing-image.svg +1 -0
  12. data/app/assets/stylesheets/alchemy/_variables.scss +1 -0
  13. data/app/assets/stylesheets/alchemy/archive.scss +23 -17
  14. data/app/assets/stylesheets/alchemy/errors.scss +1 -1
  15. data/app/assets/stylesheets/alchemy/navigation.scss +7 -10
  16. data/app/assets/stylesheets/alchemy/pagination.scss +1 -1
  17. data/app/assets/stylesheets/alchemy/search.scss +12 -2
  18. data/app/assets/stylesheets/alchemy/tags.scss +19 -31
  19. data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +3 -3
  20. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +7 -7
  21. data/app/controllers/alchemy/admin/base_controller.rb +3 -9
  22. data/app/controllers/alchemy/admin/pictures_controller.rb +13 -6
  23. data/app/controllers/alchemy/admin/resources_controller.rb +3 -3
  24. data/app/controllers/alchemy/pages_controller.rb +49 -14
  25. data/app/helpers/alchemy/admin/base_helper.rb +0 -44
  26. data/app/helpers/alchemy/admin/navigation_helper.rb +2 -1
  27. data/app/helpers/alchemy/pages_helper.rb +1 -1
  28. data/app/models/alchemy/attachment/url.rb +40 -0
  29. data/app/models/alchemy/attachment.rb +21 -4
  30. data/app/models/alchemy/element.rb +1 -1
  31. data/app/models/alchemy/essence_picture.rb +3 -3
  32. data/app/models/alchemy/essence_picture_view.rb +5 -3
  33. data/app/models/alchemy/node.rb +1 -1
  34. data/app/models/alchemy/page/page_natures.rb +2 -0
  35. data/app/models/alchemy/page/url_path.rb +8 -6
  36. data/app/models/alchemy/page.rb +17 -2
  37. data/app/models/alchemy/picture/calculations.rb +55 -0
  38. data/app/models/alchemy/picture/transformations.rb +8 -52
  39. data/app/models/alchemy/picture/url.rb +28 -77
  40. data/app/models/alchemy/picture.rb +59 -3
  41. data/app/models/alchemy/picture_thumb/create.rb +39 -0
  42. data/app/models/alchemy/picture_thumb/signature.rb +23 -0
  43. data/app/models/alchemy/picture_thumb/uid.rb +22 -0
  44. data/app/models/alchemy/picture_thumb.rb +57 -0
  45. data/app/models/alchemy/picture_variant.rb +114 -0
  46. data/app/serializers/alchemy/page_tree_serializer.rb +4 -4
  47. data/app/views/alchemy/admin/attachments/show.html.erb +8 -8
  48. data/app/views/alchemy/admin/dashboard/index.html.erb +13 -16
  49. data/app/views/alchemy/admin/elements/_element_toolbar.html.erb +1 -1
  50. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +1 -1
  51. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +2 -2
  52. data/app/views/alchemy/admin/layoutpages/edit.html.erb +4 -6
  53. data/app/views/alchemy/admin/pages/_form.html.erb +4 -6
  54. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +2 -1
  55. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +14 -13
  56. data/app/views/alchemy/admin/partials/_search_form.html.erb +8 -8
  57. data/app/views/alchemy/admin/pictures/_archive.html.erb +1 -1
  58. data/app/views/alchemy/admin/pictures/_form.html.erb +1 -1
  59. data/app/views/alchemy/admin/pictures/_picture.html.erb +3 -3
  60. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -1
  61. data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +1 -1
  62. data/app/views/alchemy/admin/pictures/index.html.erb +1 -1
  63. data/app/views/alchemy/admin/pictures/show.html.erb +3 -3
  64. data/app/views/alchemy/admin/resources/_per_page_select.html.erb +3 -3
  65. data/app/views/alchemy/admin/resources/index.html.erb +4 -1
  66. data/app/views/alchemy/admin/tags/index.html.erb +14 -15
  67. data/app/views/alchemy/base/500.html.erb +11 -13
  68. data/app/views/alchemy/essences/_essence_file_view.html.erb +3 -3
  69. data/app/views/alchemy/essences/_essence_picture_view.html.erb +3 -3
  70. data/config/alchemy/config.yml +15 -11
  71. data/config/alchemy/modules.yml +12 -12
  72. data/config/initializers/dragonfly.rb +0 -8
  73. data/config/routes.rb +1 -1
  74. data/db/migrate/20200617110713_create_alchemy_picture_thumbs.rb +22 -0
  75. data/db/migrate/20200907111332_remove_tri_state_booleans.rb +33 -0
  76. data/lib/alchemy/auth_accessors.rb +12 -5
  77. data/lib/alchemy/config.rb +1 -3
  78. data/lib/alchemy/engine.rb +6 -8
  79. data/lib/alchemy/modules.rb +11 -1
  80. data/lib/alchemy/resource.rb +3 -5
  81. data/lib/alchemy/test_support/factories/picture_factory.rb +0 -1
  82. data/lib/alchemy/test_support/factories/picture_thumb_factory.rb +12 -0
  83. data/lib/alchemy/upgrader/five_point_zero.rb +0 -32
  84. data/lib/alchemy/version.rb +1 -1
  85. data/lib/alchemy_cms.rb +0 -1
  86. data/lib/generators/alchemy/install/files/alchemy.en.yml +2 -2
  87. data/lib/generators/alchemy/install/install_generator.rb +1 -2
  88. data/lib/generators/alchemy/install/templates/dragonfly.rb.tt +5 -5
  89. data/lib/tasks/alchemy/thumbnails.rake +37 -0
  90. data/lib/tasks/alchemy/upgrade.rake +0 -20
  91. data/package/admin.js +0 -2
  92. data/package/src/__tests__/i18n.spec.js +0 -23
  93. data/package/src/i18n.js +3 -1
  94. data/package.json +1 -1
  95. metadata +34 -23
  96. data/.github/workflows/ci.yml +0 -126
  97. data/.github/workflows/greetings.yml +0 -13
  98. data/app/controllers/concerns/alchemy/locale_redirects.rb +0 -40
  99. data/app/controllers/concerns/alchemy/page_redirects.rb +0 -68
  100. data/lib/alchemy/dragonfly/processors/crop_resize.rb +0 -35
  101. data/lib/alchemy/error_tracking/airbrake_handler.rb +0 -13
  102. data/lib/alchemy/error_tracking.rb +0 -14
  103. data/lib/alchemy/userstamp.rb +0 -12
@@ -91,16 +91,23 @@ module Alchemy
91
91
  @@user_class_name.constantize
92
92
  rescue NameError => e
93
93
  if e.message =~ /#{Regexp.escape(@@user_class_name)}/
94
- abort <<-MSG.strip_heredoc
94
+ Rails.logger.warn <<~MSG
95
+ #{e.message}
96
+ #{e.backtrace.join("\n")}
95
97
 
96
- AlchemyCMS cannot find any user class!
98
+ AlchemyCMS cannot find any user class!
97
99
 
98
- Please add a user class and tell Alchemy about it or, if you don't want
99
- to create your own class, add the `alchemy-devise` gem to your Gemfile.
100
+ Please add a user class and tell Alchemy about it:
100
101
 
101
- bundle add alchemy-devise
102
+ # config/initializers/alchemy.rb
103
+ Alchemy.user_class_name = 'MyUser'
104
+
105
+ Or add the `alchemy-devise` gem to your Gemfile:
106
+
107
+ bundle add alchemy-devise
102
108
 
103
109
  MSG
110
+ nil
104
111
  else
105
112
  raise e
106
113
  end
@@ -31,9 +31,7 @@ module Alchemy
31
31
  # a value of nil means there is no new default
32
32
  # any not nil value is the new default
33
33
  def deprecated_configs
34
- {
35
- redirect_to_public_child: nil,
36
- }
34
+ {}
37
35
  end
38
36
 
39
37
  private
@@ -40,14 +40,12 @@ module Alchemy
40
40
  end
41
41
  end
42
42
 
43
- config.after_initialize do
44
- require_relative "./userstamp"
45
- end
46
-
47
- initializer "alchemy.error_tracking" do
48
- if defined?(Airbrake)
49
- require_relative "error_tracking/airbrake_handler"
50
- Alchemy::ErrorTracking.notification_handler = Alchemy::ErrorTracking::AirbrakeHandler
43
+ initializer "alchemy.userstamp" do
44
+ if Alchemy.user_class
45
+ ActiveSupport.on_load(:active_record) do
46
+ Alchemy.user_class.model_stamper
47
+ Alchemy.user_class.stampable(stamper_class_name: Alchemy.user_class_name)
48
+ end
51
49
  end
52
50
  end
53
51
  end
@@ -72,7 +72,8 @@ module Alchemy
72
72
  alchemy_modules.detect do |alchemy_module|
73
73
  module_navi = alchemy_module.fetch("navigation", {})
74
74
  definition_from_mainnavi(module_navi, name_or_params) ||
75
- definition_from_subnavi(module_navi, name_or_params)
75
+ definition_from_subnavi(module_navi, name_or_params) ||
76
+ definition_from_nested(module_navi, name_or_params)
76
77
  end
77
78
  else
78
79
  raise ArgumentError, "Could not find module definition for #{name_or_params}"
@@ -94,6 +95,15 @@ module Alchemy
94
95
  end
95
96
  end
96
97
 
98
+ def definition_from_nested(module_navi, params)
99
+ nested = module_navi["nested"]
100
+ return if nested.nil?
101
+
102
+ nested.any? do |navi|
103
+ controller_matches?(navi, params) && action_matches?(navi, params)
104
+ end
105
+ end
106
+
97
107
  def controller_matches?(navi, params)
98
108
  remove_slash(navi["controller"]) == remove_slash(params["controller"])
99
109
  end
@@ -132,9 +132,7 @@ module Alchemy
132
132
  end
133
133
 
134
134
  def 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
135
+ @_namespaced_resource_name ||= namespaced_resources_name.singularize
138
136
  end
139
137
 
140
138
  def namespaced_resources_name
@@ -142,13 +140,13 @@ module Alchemy
142
140
  resource_name_array = resource_array.dup
143
141
  resource_name_array.delete(engine_name) if in_engine?
144
142
  resource_name_array.join("_")
145
- end.to_sym # Rails >= 6.0.3.7 needs symbols in polymorphic routes
143
+ end
146
144
  end
147
145
 
148
146
  def namespace_for_scope
149
147
  namespace_array = namespace_diff
150
148
  namespace_array.delete(engine_name) if in_engine?
151
- namespace_array.map(&:to_sym) # Rails >= 6.0.3.7 needs symbols in polymorphic routes
149
+ namespace_array
152
150
  end
153
151
 
154
152
  # Returns an array of underscored association names
@@ -8,7 +8,6 @@ FactoryBot.define do
8
8
  File.new(Alchemy::Engine.root.join("lib", "alchemy", "test_support", "fixtures", "image.png"))
9
9
  end
10
10
  name { "image" }
11
- image_file_name { "image.png" }
12
11
  upload_hash { Time.current.hash }
13
12
  end
14
13
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "factory_bot"
4
+ require "securerandom"
5
+
6
+ FactoryBot.define do
7
+ factory :alchemy_picture_thumb, class: "Alchemy::PictureThumb" do
8
+ picture { create(:alchemy_picture) }
9
+ signature { SecureRandom.hex(16) }
10
+ sequence(:uid) { |n| "#{Time.now.strftime("%Y/%m/%d")}/#{n}.jpg" }
11
+ end
12
+ end
@@ -1,19 +1,9 @@
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"
7
- require "alchemy/version"
8
4
 
9
5
  module Alchemy
10
6
  class Upgrader::FivePointZero < Upgrader
11
- include Rails::Generators::Actions
12
- include Thor::Base
13
- include Thor::Actions
14
-
15
- source_root File.expand_path("../../generators/alchemy/install/files", __dir__)
16
-
17
7
  class << self
18
8
  def install_gutentag_migrations
19
9
  desc "Install Gutentag migrations"
@@ -46,28 +36,6 @@ module Alchemy
46
36
  log "Root page not found.", :skip
47
37
  end
48
38
  end
49
-
50
- def run_webpacker_installer
51
- # Webpacker does not create a package.json, but we need one
52
- unless File.exist? app_root.join("package.json")
53
- in_root { run "echo '{}' > package.json" }
54
- end
55
- new.rake("webpacker:install", abort_on_failure: true)
56
- end
57
-
58
- def add_npm_package
59
- new.run "yarn add @alchemy_cms/admin@~#{Alchemy.version}"
60
- end
61
-
62
- def copy_alchemy_entry_point
63
- webpack_config = YAML.load_file(app_root.join("config", "webpacker.yml"))[Rails.env]
64
- new.copy_file "alchemy_admin.js",
65
- app_root.join(webpack_config["source_path"], webpack_config["source_entry_path"], "alchemy/admin.js")
66
- end
67
-
68
- def app_root
69
- @_app_root ||= Rails.root
70
- end
71
39
  end
72
40
  end
73
41
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "5.0.10"
4
+ VERSION = "5.1.0.beta1"
5
5
 
6
6
  def self.version
7
7
  VERSION
data/lib/alchemy_cms.rb CHANGED
@@ -38,7 +38,6 @@ require_relative "alchemy/configuration_methods"
38
38
  require_relative "alchemy/controller_actions"
39
39
  require_relative "alchemy/deprecation"
40
40
  require_relative "alchemy/elements_finder"
41
- require_relative "alchemy/error_tracking"
42
41
  require_relative "alchemy/errors"
43
42
  require_relative "alchemy/essence"
44
43
  require_relative "alchemy/filetypes"
@@ -18,7 +18,7 @@ en:
18
18
  # Default texts for new contents created
19
19
  default_content_texts:
20
20
  article_headline: "Welcome to your first Alchemy CMS page"
21
- article_text: '<p><strong>How to get started.</strong></p><p>First of all you should read about Alchemy and its architecture in the <a class="external" href="http://guides.alchemy-cms.com/stable/alchemy_approach.html" target="_blank" data-link-target="blank">guidelines</a>.</p><p>The most important things to know about Alchemy are elements and page layouts.</p><p><span style="text-decoration: underline;"><strong>Elements:</strong></span></p><p>With Alchemy you can split pages into content parts, elements. These elements can be defined out of several base content types: essences. The basic essences are:</p><ul><li>EssenceText - <em>A single line of text</em></li><li>EssenceRichtext - <em>A TinyMCE powered formatted text block</em></li><li>EssencePicture - <em>A reference to an image</em></li><li>EssenceHtml - <em>HTML embed code</em></li><li>EssenceSelect - <em>A selection of values</em></li><li>EssenceBoolean - <em>A checkbox</em></li></ul><p>Elements get defined in a YAML file <strong>config/alchemy/elements.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/stable/elements.html" target="_blank" data-link-target="blank">Read more about elements and how to define them in the guidelines.</a></p><p><span style="text-decoration: underline;"><strong>Page types:</strong></span></p><p>You can define several types of pages, called page layouts. You can assign elements to page layouts and control how elements and the page of a certain layout behave.</p><p>Page layouts get defined in a YAML file <strong>config/alchemy/page_layouts.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/stable/page_layouts.html" target="_blank" data-link-target="blank">Read more about defining page layouts in the guidelines.</a></p>'
21
+ article_text: '<p><strong>How to get started.</strong></p><p>First of all you should read about Alchemy and its architecture in the <a class="external" href="http://guides.alchemy-cms.com/alchemy_approach.html" target="_blank" data-link-target="blank">guidelines</a>.</p><p>The most important things to know about Alchemy are elements and page layouts.</p><p><span style="text-decoration: underline;"><strong>Elements:</strong></span></p><p>With Alchemy you can split pages into content parts, elements. These elements can be defined out of several base content types: essences. The basic essences are:</p><ul><li>EssenceText - <em>A single line of text</em></li><li>EssenceRichtext - <em>A TinyMCE powered formatted text block</em></li><li>EssencePicture - <em>A reference to an image</em></li><li>EssenceHtml - <em>HTML embed code</em></li><li>EssenceSelect - <em>A selection of values</em></li><li>EssenceBoolean - <em>A checkbox</em></li></ul><p>Elements get defined in a YAML file <strong>config/alchemy/elements.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/elements.html" target="_blank" data-link-target="blank">Read more about elements and how to define them in the guidelines.</a></p><p><span style="text-decoration: underline;"><strong>Page types:</strong></span></p><p>You can define several types of pages, called page layouts. You can assign elements to page layouts and control how elements and the page of a certain layout behave.</p><p>Page layouts get defined in a YAML file <strong>config/alchemy/page_layouts.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/page_layouts.html" target="_blank" data-link-target="blank">Read more about defining page layouts in the guidelines.</a></p>'
22
22
 
23
23
  # Hint texts for elements
24
24
  element_hints:
@@ -28,4 +28,4 @@ en:
28
28
  content_hints:
29
29
  headline: "This is a single line of unformatable Text"
30
30
  picture: "Pictures are stored in the library. You can assign a picture multiple times throughout your site. Alchemy has an image cropper build right in."
31
- text: "This is a rich text block powered by TinyMCE editor. You can change the configuration of the editor. See http://guides.alchemy-cms.com/stable/customize_tinymce.html"
31
+ text: "This is a rich text block powered by TinyMCE editor. You can change the configuration of the editor. See http://guides.alchemy-cms.com/customize_tinymce.html"
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require "rails/generators"
3
3
  require "alchemy/install/tasks"
4
- require "alchemy/version"
5
4
 
6
5
  module Alchemy
7
6
  module Generators
@@ -89,7 +88,7 @@ module Alchemy
89
88
  end
90
89
 
91
90
  def add_npm_package
92
- run "yarn add @alchemy_cms/admin@~#{Alchemy.version}"
91
+ run "yarn add @alchemy_cms/admin"
93
92
  end
94
93
 
95
94
  def copy_alchemy_entry_point
@@ -15,12 +15,12 @@ Dragonfly.app(:alchemy_pictures).configure do
15
15
  dragonfly_url nil
16
16
  plugin :imagemagick
17
17
  plugin :svg
18
- secret '<%= SecureRandom.hex(32) %>'
19
- url_format '/pictures/:job/:name.:ext'
18
+ secret "<%= SecureRandom.hex(32) %>"
19
+ url_format "/pictures/:job/:basename.:ext"
20
20
 
21
21
  datastore :file,
22
- root_path: Rails.root.join('uploads/pictures').to_s,
23
- server_root: Rails.root.join('public'),
22
+ root_path: Rails.root.join("uploads/pictures").to_s,
23
+ server_root: Rails.root.join("public"),
24
24
  store_meta: false
25
25
  end
26
26
 
@@ -30,6 +30,6 @@ Rails.application.middleware.use Dragonfly::Middleware, :alchemy_pictures
30
30
  # Attachments
31
31
  Dragonfly.app(:alchemy_attachments).configure do
32
32
  datastore :file,
33
- root_path: Rails.root.join('uploads/attachments').to_s,
33
+ root_path: Rails.root.join("uploads/attachments").to_s,
34
34
  store_meta: false
35
35
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :alchemy do
4
+ namespace :generate do
5
+ desc "Generates all thumbnails for Alchemy Pictures and EssencePictures."
6
+ task thumbnails: [
7
+ "alchemy_dragonfly_s3:generate:picture_thumbnails",
8
+ "alchemy_dragonfly_s3:generate:essence_picture_thumbnails",
9
+ ]
10
+
11
+ desc "Generates thumbnails for Alchemy Pictures."
12
+ task picture_thumbnails: :environment do
13
+ puts "Regenerate #{Alchemy::Picture.count} picture thumbnails."
14
+ puts "Please wait..."
15
+
16
+ Alchemy::Picture.find_each do |picture|
17
+ puts Alchemy::PictureThumb.generate_thumbs!(picture)
18
+ end
19
+
20
+ puts "Done!"
21
+ end
22
+
23
+ desc "Generates thumbnails for Alchemy EssencePictures."
24
+ task essence_picture_thumbnails: :environment do
25
+ essence_pictures = Alchemy::EssencePicture.joins(:content, :ingredient_association)
26
+ puts "Regenerate #{essence_pictures.count} essence picture thumbnails."
27
+ puts "Please wait..."
28
+
29
+ essence_pictures.find_each do |essence_picture|
30
+ puts essence_picture.picture_url
31
+ puts essence_picture.thumbnail_url
32
+ end
33
+
34
+ puts "Done!"
35
+ end
36
+ end
37
+ end
@@ -42,9 +42,6 @@ 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",
48
45
  ]
49
46
 
50
47
  desc "Install Gutentag migrations"
@@ -61,23 +58,6 @@ namespace :alchemy do
61
58
  task remove_root_page: [:environment] do
62
59
  Alchemy::Upgrader::FivePointZero.remove_root_page
63
60
  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
81
61
  end
82
62
  end
83
63
  end
data/package/admin.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import translate from "./src/i18n"
2
- import translationData from "./src/translations"
3
2
  import NodeTree from "./src/node_tree"
4
3
 
5
4
  // Global Alchemy object
@@ -11,6 +10,5 @@ if (typeof window.Alchemy === "undefined") {
11
10
  Object.assign(Alchemy, {
12
11
  // Global utility method for translating a given string
13
12
  t: translate,
14
- translations: Object.assign(Alchemy.translations || {}, translationData),
15
13
  NodeTree
16
14
  })
@@ -15,20 +15,12 @@ describe("translate", () => {
15
15
  })
16
16
 
17
17
  describe("if translation is present", () => {
18
- beforeEach(() => {
19
- Alchemy.translations = { en: { help: "Help" } }
20
- })
21
-
22
18
  it("Returns translated string", () => {
23
19
  expect(translate("help")).toEqual("Help")
24
20
  })
25
21
 
26
22
  describe("if key includes a period", () => {
27
23
  describe("that is translated", () => {
28
- beforeEach(() => {
29
- Alchemy.translations = { en: { formats: { date: "Y-m-d" } } }
30
- })
31
-
32
24
  it("splits into group", () => {
33
25
  expect(translate("formats.date")).toEqual("Y-m-d")
34
26
  })
@@ -48,10 +40,6 @@ describe("translate", () => {
48
40
  })
49
41
 
50
42
  describe("if replacement is given", () => {
51
- beforeEach(() => {
52
- Alchemy.translations = { en: { allowed_chars: "of %{number} chars" } }
53
- })
54
-
55
43
  it("replaces it", () => {
56
44
  expect(translate("allowed_chars", 5)).toEqual("of 5 chars")
57
45
  })
@@ -79,15 +67,4 @@ describe("translate", () => {
79
67
  spy.mockRestore()
80
68
  })
81
69
  })
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
- })
93
70
  })
data/package/src/i18n.js CHANGED
@@ -1,3 +1,5 @@
1
+ import translationData from "./translations"
2
+
1
3
  const KEY_SEPARATOR = /\./
2
4
 
3
5
  function currentLocale() {
@@ -9,7 +11,7 @@ function currentLocale() {
9
11
 
10
12
  function getTranslations() {
11
13
  const locale = currentLocale()
12
- const translations = Alchemy.translations && Alchemy.translations[locale]
14
+ const translations = translationData[locale]
13
15
 
14
16
  if (translations) {
15
17
  return translations
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy_cms/admin",
3
- "version": "5.0.10",
3
+ "version": "0.2.0",
4
4
  "description": "AlchemyCMS",
5
5
  "browser": "package/admin.js",
6
6
  "files": [
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.10
4
+ version: 5.1.0.beta1
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: 2022-02-28 00:00:00.000000000 Z
16
+ date: 2020-10-30 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: active_model_serializers
@@ -87,36 +87,42 @@ dependencies:
87
87
  name: coffee-rails
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - "~>"
90
+ - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: '4.0'
93
93
  - - "<"
94
94
  - !ruby/object:Gem::Version
95
- version: '5.0'
95
+ version: '6.0'
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - "~>"
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '4.0'
103
103
  - - "<"
104
104
  - !ruby/object:Gem::Version
105
- version: '5.0'
105
+ version: '6.0'
106
106
  - !ruby/object:Gem::Dependency
107
107
  name: dragonfly
108
108
  requirement: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: '1.4'
112
+ version: '1.0'
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 1.0.7
113
116
  type: :runtime
114
117
  prerelease: false
115
118
  version_requirements: !ruby/object:Gem::Requirement
116
119
  requirements:
117
120
  - - "~>"
118
121
  - !ruby/object:Gem::Version
119
- version: '1.4'
122
+ version: '1.0'
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 1.0.7
120
126
  - !ruby/object:Gem::Dependency
121
127
  name: dragonfly_svg
122
128
  requirement: !ruby/object:Gem::Requirement
@@ -471,14 +477,14 @@ dependencies:
471
477
  requirements:
472
478
  - - "~>"
473
479
  - !ruby/object:Gem::Version
474
- version: '4.0'
480
+ version: '5.0'
475
481
  type: :development
476
482
  prerelease: false
477
483
  version_requirements: !ruby/object:Gem::Requirement
478
484
  requirements:
479
485
  - - "~>"
480
486
  - !ruby/object:Gem::Version
481
- version: '4.0'
487
+ version: '5.0'
482
488
  - !ruby/object:Gem::Dependency
483
489
  name: rails-controller-testing
484
490
  requirement: !ruby/object:Gem::Requirement
@@ -590,14 +596,13 @@ files:
590
596
  - ".github/ISSUE_TEMPLATE/Bug_report.md"
591
597
  - ".github/ISSUE_TEMPLATE/Feature_request.md"
592
598
  - ".github/PULL_REQUEST_TEMPLATE.md"
593
- - ".github/workflows/ci.yml"
594
- - ".github/workflows/greetings.yml"
595
599
  - ".github/workflows/stale.yml"
596
600
  - ".gitignore"
597
601
  - ".hound.yml"
598
602
  - ".localeapp/config.rb"
599
603
  - ".prettierrc"
600
604
  - ".rubocop.yml"
605
+ - ".travis.yml"
601
606
  - ".yardopts"
602
607
  - CHANGELOG.md
603
608
  - CODE_OF_CONDUCT.md
@@ -614,6 +619,7 @@ files:
614
619
  - app/assets/images/alchemy/icon-white.svg
615
620
  - app/assets/images/alchemy/icon.svg
616
621
  - app/assets/images/alchemy/lupe.cur
622
+ - app/assets/images/alchemy/missing-image.svg
617
623
  - app/assets/javascripts/alchemy/admin.js
618
624
  - app/assets/javascripts/alchemy/alchemy.autocomplete.js.coffee
619
625
  - app/assets/javascripts/alchemy/alchemy.base.js.coffee
@@ -751,8 +757,6 @@ files:
751
757
  - app/controllers/concerns/alchemy/admin/current_language.rb
752
758
  - app/controllers/concerns/alchemy/admin/uploader_responses.rb
753
759
  - app/controllers/concerns/alchemy/legacy_page_redirects.rb
754
- - app/controllers/concerns/alchemy/locale_redirects.rb
755
- - app/controllers/concerns/alchemy/page_redirects.rb
756
760
  - app/controllers/concerns/alchemy/site_redirects.rb
757
761
  - app/decorators/alchemy/content_editor.rb
758
762
  - app/decorators/alchemy/element_editor.rb
@@ -774,6 +778,7 @@ files:
774
778
  - app/mailers/alchemy/base_mailer.rb
775
779
  - app/mailers/alchemy/messages_mailer.rb
776
780
  - app/models/alchemy/attachment.rb
781
+ - app/models/alchemy/attachment/url.rb
777
782
  - app/models/alchemy/base_record.rb
778
783
  - app/models/alchemy/content.rb
779
784
  - app/models/alchemy/content/factory.rb
@@ -809,9 +814,15 @@ files:
809
814
  - app/models/alchemy/page/page_scopes.rb
810
815
  - app/models/alchemy/page/url_path.rb
811
816
  - app/models/alchemy/picture.rb
817
+ - app/models/alchemy/picture/calculations.rb
812
818
  - app/models/alchemy/picture/preprocessor.rb
813
819
  - app/models/alchemy/picture/transformations.rb
814
820
  - app/models/alchemy/picture/url.rb
821
+ - app/models/alchemy/picture_thumb.rb
822
+ - app/models/alchemy/picture_thumb/create.rb
823
+ - app/models/alchemy/picture_thumb/signature.rb
824
+ - app/models/alchemy/picture_thumb/uid.rb
825
+ - app/models/alchemy/picture_variant.rb
815
826
  - app/models/alchemy/site.rb
816
827
  - app/models/alchemy/site/layout.rb
817
828
  - app/models/alchemy/tag.rb
@@ -1064,6 +1075,8 @@ files:
1064
1075
  - db/migrate/20200511113603_add_menu_type_to_alchemy_nodes.rb
1065
1076
  - db/migrate/20200514091507_make_page_layoutpage_null_false.rb
1066
1077
  - db/migrate/20200519073500_remove_visible_from_alchemy_pages.rb
1078
+ - db/migrate/20200617110713_create_alchemy_picture_thumbs.rb
1079
+ - db/migrate/20200907111332_remove_tri_state_booleans.rb
1067
1080
  - lib/alchemy/ability_helper.rb
1068
1081
  - lib/alchemy/admin/locale.rb
1069
1082
  - lib/alchemy/admin/preview_url.rb
@@ -1073,11 +1086,8 @@ files:
1073
1086
  - lib/alchemy/configuration_methods.rb
1074
1087
  - lib/alchemy/controller_actions.rb
1075
1088
  - lib/alchemy/deprecation.rb
1076
- - lib/alchemy/dragonfly/processors/crop_resize.rb
1077
1089
  - lib/alchemy/elements_finder.rb
1078
1090
  - lib/alchemy/engine.rb
1079
- - lib/alchemy/error_tracking.rb
1080
- - lib/alchemy/error_tracking/airbrake_handler.rb
1081
1091
  - lib/alchemy/errors.rb
1082
1092
  - lib/alchemy/essence.rb
1083
1093
  - lib/alchemy/filetypes.rb
@@ -1115,6 +1125,7 @@ files:
1115
1125
  - lib/alchemy/test_support/factories/node_factory.rb
1116
1126
  - lib/alchemy/test_support/factories/page_factory.rb
1117
1127
  - lib/alchemy/test_support/factories/picture_factory.rb
1128
+ - lib/alchemy/test_support/factories/picture_thumb_factory.rb
1118
1129
  - lib/alchemy/test_support/factories/site_factory.rb
1119
1130
  - lib/alchemy/test_support/fixtures/image.png
1120
1131
  - lib/alchemy/test_support/integration_helpers.rb
@@ -1125,7 +1136,6 @@ files:
1125
1136
  - lib/alchemy/upgrader/five_point_zero.rb
1126
1137
  - lib/alchemy/upgrader/tasks/element_views_updater.rb
1127
1138
  - lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
1128
- - lib/alchemy/userstamp.rb
1129
1139
  - lib/alchemy/version.rb
1130
1140
  - lib/alchemy_cms.rb
1131
1141
  - lib/generators/alchemy/base.rb
@@ -1172,6 +1182,7 @@ files:
1172
1182
  - lib/kaminari/scoped_pagination_url_helper.rb
1173
1183
  - lib/tasks/alchemy/db.rake
1174
1184
  - lib/tasks/alchemy/install.rake
1185
+ - lib/tasks/alchemy/thumbnails.rake
1175
1186
  - lib/tasks/alchemy/tidy.rake
1176
1187
  - lib/tasks/alchemy/upgrade.rake
1177
1188
  - package.json
@@ -1255,17 +1266,17 @@ require_paths:
1255
1266
  - lib
1256
1267
  required_ruby_version: !ruby/object:Gem::Requirement
1257
1268
  requirements:
1258
- - - "~>"
1269
+ - - ">="
1259
1270
  - !ruby/object:Gem::Version
1260
- version: '2.3'
1271
+ version: 2.3.0
1261
1272
  required_rubygems_version: !ruby/object:Gem::Requirement
1262
1273
  requirements:
1263
- - - ">="
1274
+ - - ">"
1264
1275
  - !ruby/object:Gem::Version
1265
- version: '0'
1276
+ version: 1.3.1
1266
1277
  requirements:
1267
1278
  - ImageMagick (libmagick), v6.6 or greater.
1268
- rubygems_version: 3.1.6
1279
+ rubygems_version: 3.0.3
1269
1280
  signing_key:
1270
1281
  specification_version: 4
1271
1282
  summary: A powerful, userfriendly and flexible CMS for Rails