alchemy_cms 7.0.3 → 7.0.5

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.

Potentially problematic release.


This version of alchemy_cms might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b01898eaa0c9b209814972d61b137c1ee14f875ce1426db5cb45389ce435a1fe
4
- data.tar.gz: 9b1edbdb5096b2384187e3282f4c28a854c2139474cf1dbc452e32c177f0f65c
3
+ metadata.gz: 4eb5a0535db07358911a52c75a9d3f0552119d547f6f6b7ff0d4b64ac51e1e96
4
+ data.tar.gz: 6d9009861880e870ca5cf9617a5bdaad8bc467a87ff842ff2722a10a1b08767a
5
5
  SHA512:
6
- metadata.gz: ccf4b9760d9a8f286a245e36b399534df9b61ce6972567a5ccf4cbfd861ab037802cbcd91f74e0c62e28b7b45e108ce0c969e230430e8508e932a8c09af6751e
7
- data.tar.gz: bc750d8c231526c3f560c7c09fd45994225e730be031954a1304a52d113bb10ac313e4c1bf699e1ab076245e4caf43a7583f501bae7ef2ae775c045a6fb0b0dd
6
+ metadata.gz: 64045d0762ec1a803b87992b154a9cde5f202603e415d5086f61d74ccb16db4f9de10d80b313b37883f104f8c0877bffa83b631ad705cde329229a7a873a4dff
7
+ data.tar.gz: 5da92fe5ed83c535ffdd683fcc00d5781e5be7e2563c6767d7d972176ac995346922b70a2b20541a3a6bf51688664bc2ba5e449630d57b862f65972a75b1fe1e
data/.standard.yml CHANGED
@@ -1,3 +1,4 @@
1
1
  parallel: true
2
2
  ignore:
3
3
  - "spec/dummy/**/*"
4
+ ruby_version: 3.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.0.5 (2023-10-06)
4
+
5
+ - [7.0-stable] Merge pull request #2593 from tvdeyen/fix-turbo-redirect [#2594](https://github.com/AlchemyCMS/alchemy_cms/pull/2594) ([alchemycms-bot](https://github.com/alchemycms-bot))
6
+
7
+ ## 7.0.4 (2023-10-04)
8
+
9
+ - [7.0-stable] Merge pull request #2588 from tvdeyen/admin-js-imports [#2589](https://github.com/AlchemyCMS/alchemy_cms/pull/2589) ([alchemycms-bot](https://github.com/alchemycms-bot))
10
+ - [7.0-stable] Merge pull request #2586 from AlchemyCMS/fix-leave-dialog [#2587](https://github.com/AlchemyCMS/alchemy_cms/pull/2587) ([alchemycms-bot](https://github.com/alchemycms-bot))
11
+ - [7.0-stable] Merge pull request #2556 from mamhoff/fix-nan-ratio-error [#2580](https://github.com/AlchemyCMS/alchemy_cms/pull/2580) ([alchemycms-bot](https://github.com/alchemycms-bot))
12
+
3
13
  ## 7.0.3 (2023-08-29)
4
14
 
5
15
  - [7.0-stable] Merge pull request #2571 from tvdeyen/fix-non-stupid-digest-assets [#2572](https://github.com/AlchemyCMS/alchemy_cms/pull/2572) ([github-actions](https://github.com/apps/github-actions))
@@ -22,7 +22,7 @@ module Alchemy
22
22
  @language = Alchemy::Language.new(resource_params)
23
23
  if @language.save
24
24
  flash[:notice] = Alchemy.t("Language successfully created")
25
- redirect_to alchemy.admin_pages_path(language_id: @language)
25
+ do_redirect_to alchemy.admin_pages_path(language_id: @language)
26
26
  else
27
27
  render :new
28
28
  end
@@ -48,7 +48,7 @@ module Alchemy
48
48
  @current_site = Alchemy::Site.current
49
49
  if @current_site.nil?
50
50
  flash[:warning] = Alchemy.t("Please create a site first.")
51
- redirect_to admin_sites_path
51
+ do_redirect_to admin_sites_path
52
52
  end
53
53
  end
54
54
  end
@@ -7,7 +7,7 @@ module Alchemy
7
7
  @site = Alchemy::Site.new(resource_params)
8
8
  if @site.save
9
9
  flash[:notice] = Alchemy.t("Please create a default language for this site.")
10
- redirect_to alchemy.admin_languages_path(site_id: @site)
10
+ do_redirect_to alchemy.admin_languages_path(site_id: @site)
11
11
  else
12
12
  render :new
13
13
  end
@@ -52,7 +52,7 @@ module Alchemy
52
52
  #
53
53
  def read_definitions_file
54
54
  if ::File.exist?(definitions_file_path)
55
- ::YAML.safe_load(File.read(definitions_file_path)) || []
55
+ ::YAML.safe_load_file(definitions_file_path) || []
56
56
  else
57
57
  raise LoadError, "Could not find menus.yml file! Please run `rails generate alchemy:install`"
58
58
  end
@@ -115,6 +115,8 @@ module Alchemy
115
115
  return nil unless settings[:crop] && settings[:size]
116
116
 
117
117
  mask = inferred_dimensions_from_string(settings[:size])
118
+ return if mask.nil?
119
+
118
120
  zoom = thumbnail_zoom_factor(mask)
119
121
  return nil if zoom.zero?
120
122
 
@@ -150,6 +152,8 @@ module Alchemy
150
152
  width, height = dimensions_from_string(string)
151
153
  ratio = image_file_width.to_f / image_file_height.to_i
152
154
 
155
+ return if ratio.nan?
156
+
153
157
  if width.zero? && ratio.is_a?(Float)
154
158
  width = height * ratio
155
159
  end
@@ -1,11 +1,13 @@
1
1
  <%= render_message do %>
2
2
  <%= Alchemy.t("You are about to leave Alchemy") %>
3
3
  <% end %>
4
- <p class="buttons">
5
- <label><%= Alchemy.t("Do you want to") %></label>
6
- <%= link_to Alchemy.t('stay logged in'), alchemy.root_path, class: 'button secondary' %>
7
- </p>
8
- <%= form_tag Alchemy.logout_path, method: Alchemy.logout_method, class: 'buttons' do %>
9
- <label><%= Alchemy.t('or to completely') %></label>
10
- <%= button_tag Alchemy.t(:logout), autofocus: true %>
11
- <% end %>
4
+ <div data-turbo="false">
5
+ <p class="buttons">
6
+ <label><%= Alchemy.t("Do you want to") %></label>
7
+ <%= link_to Alchemy.t('stay logged in'), alchemy.root_path, class: 'button secondary' %>
8
+ </p>
9
+ <%= form_tag Alchemy.logout_path, method: Alchemy.logout_method, class: 'buttons' do %>
10
+ <label><%= Alchemy.t('or to completely') %></label>
11
+ <%= button_tag Alchemy.t(:logout), autofocus: true %>
12
+ <% end %>
13
+ </div>
@@ -35,6 +35,13 @@
35
35
  <%= render 'alchemy/admin/partials/routes' %>
36
36
  <%= javascript_include_tag('alchemy/admin/all', 'data-turbo-track' => true) %>
37
37
  <%= javascript_importmap_tags("alchemy_admin", importmap: Alchemy.importmap) %>
38
+ <% if Alchemy.admin_js_imports.any? %>
39
+ <script type="module">
40
+ <% Alchemy.admin_js_imports.each do |path| %>
41
+ import "<%= path %>"
42
+ <% end %>
43
+ </script>
44
+ <% end %>
38
45
  <%= yield :javascript_includes %>
39
46
  </head>
40
47
  <%= content_tag :body, id: 'alchemy', class: alchemy_body_class do %>
@@ -385,6 +385,26 @@ RSpec.shared_examples_for "having picture thumbnails" do
385
385
  size: "160x120"
386
386
  )
387
387
  end
388
+
389
+ context "with settings indicating free height" do
390
+ let(:settings) do
391
+ {
392
+ crop: true,
393
+ size: "800x"
394
+ }
395
+ end
396
+
397
+ it "returns default thumbnail options" do
398
+ is_expected.to eq(
399
+ crop: true,
400
+ crop_from: nil,
401
+ crop_size: nil,
402
+ flatten: true,
403
+ format: "jpg",
404
+ size: "160x120"
405
+ )
406
+ end
407
+ end
388
408
  end
389
409
  end
390
410
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "7.0.3"
4
+ VERSION = "7.0.5"
5
5
 
6
6
  def self.version
7
7
  VERSION
data/lib/alchemy.rb CHANGED
@@ -43,6 +43,25 @@ module Alchemy
43
43
  @_preview_sources = Array(sources)
44
44
  end
45
45
 
46
+ # Additional JS modules to be imported in the Alchemy admin UI
47
+ #
48
+ # Be sure to also pin the modules with +Alchemy.importmap+.
49
+ #
50
+ # == Example
51
+ #
52
+ # Alchemy.importmap.pin "flatpickr/de",
53
+ # to: "https://ga.jspm.io/npm:flatpickr@4.6.13/dist/l10n/de.js"
54
+ #
55
+ # Alchemy.admin_js_imports << "flatpickr/de"
56
+ #
57
+ def self.admin_js_imports
58
+ @_admin_js_imports ||= Set.new
59
+ end
60
+
61
+ def self.admin_js_imports=(sources)
62
+ @_admin_js_imports = Set[sources]
63
+ end
64
+
46
65
  # Define page publish targets
47
66
  #
48
67
  # A publish target is a ActiveJob that gets performed
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: 7.0.3
4
+ version: 7.0.5
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: 2023-08-29 00:00:00.000000000 Z
16
+ date: 2023-10-06 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: actionmailer