alchemy_cms 7.4.5 → 7.4.6

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: 9cf8a86e227213b067edafe887d14b0790eb1a0ec77d94791de2f035b638409e
4
- data.tar.gz: 35ff4c4c0204fdef6aa184ae4fdb2dc2e044a35da404cdd7369c809705932857
3
+ metadata.gz: dac52b8382bc65dd200d1e8c0217e0a53b7e5774f2b074c6a3bc6716da242e41
4
+ data.tar.gz: ddbd1426fedc2282cb82b3ece15d1d6b1a9553c0da5b7f640b84198599c6eca9
5
5
  SHA512:
6
- metadata.gz: 5920cb9a46fb4a13ce9a968c9f2347fe4dbea1b7331c4f6e7dfbde992e525c5e9cf093053422656d8685b1923acd28d4284a44cf29a5f5bec39e5afa370f1c59
7
- data.tar.gz: 419af4444c3f5ccb167d05a61ca07f8a1286557674c21137637ead61bdd14c479ad0d91ab688e4802c09b4a531a60f3deabea5d3bfb42450ee93a8405728e66f
6
+ metadata.gz: 213cf6190790413cfd04f8e0b6fc9f8c45fe718d2474a5c2aa097cbb455986989491cf149ffcf8d2bad15e0d21fff2c2894d7eb3fedb5f5acab743e38d9c6d53
7
+ data.tar.gz: b6f588b2940581cd18a33bc1e126d8b128f5ce78c403ec79db66e320605df8088fa84d856efe6e84912d3909e40fed4d7ea5764b68f99c304c04e173fb00ab99
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.4.6 (2025-27-06)
4
+
5
+ - [7.4-stable] Fix multi language picture descriptions [#3293](https://github.com/AlchemyCMS/alchemy_cms/pull/3293) ([alchemycms-bot](https://github.com/alchemycms-bot))
6
+ - [7.4-stable] Add server error turbo_stream template [#3292](https://github.com/AlchemyCMS/alchemy_cms/pull/3292) ([alchemycms-bot](https://github.com/alchemycms-bot))
7
+ - [7.4-stable] Remove non visual custom elements after connect [#3291](https://github.com/AlchemyCMS/alchemy_cms/pull/3291) ([alchemycms-bot](https://github.com/alchemycms-bot))
8
+
3
9
  ## 7.4.5 (2025-06-04)
4
10
 
5
11
  - [7.4] Fix attachment overlay list overflow [#3261](https://github.com/AlchemyCMS/alchemy_cms/pull/3261) ([tvdeyen](https://github.com/tvdeyen))
@@ -1,8 +1,12 @@
1
1
  module Alchemy
2
2
  module Admin
3
3
  class PictureDescriptionsController < Alchemy::Admin::ResourcesController
4
+ include PictureDescriptionsFormHelper
5
+
4
6
  def edit
5
- @picture_description = @picture.descriptions.find_or_initialize_by(language_id: params[:language_id])
7
+ @picture_description = @picture.descriptions.find_or_initialize_by(
8
+ language_id: params[:language_id]
9
+ )
6
10
  end
7
11
 
8
12
  private
@@ -6,6 +6,7 @@ module Alchemy
6
6
  include UploaderResponses
7
7
  include ArchiveOverlay
8
8
  include CurrentLanguage
9
+ include PictureDescriptionsFormHelper
9
10
 
10
11
  helper "alchemy/admin/tags"
11
12
 
@@ -0,0 +1,16 @@
1
+ module Alchemy
2
+ module Admin
3
+ module PictureDescriptionsFormHelper
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ helper_method :description_field_name_prefix
8
+ end
9
+
10
+ def description_field_name_prefix
11
+ picture_description_counter = @picture.descriptions.index(@picture_description)
12
+ "picture[descriptions_attributes][#{picture_description_counter}]"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -25,6 +25,8 @@ class Action extends HTMLElement {
25
25
  } else {
26
26
  console.error(`Unknown Alchemy action: ${this.name}`)
27
27
  }
28
+
29
+ this.remove()
28
30
  }
29
31
 
30
32
  get name() {
@@ -3,6 +3,7 @@ import { growl } from "alchemy_admin/growler"
3
3
  class Growl extends HTMLElement {
4
4
  connectedCallback() {
5
5
  growl(this.message, this.getAttribute("type") || "notice")
6
+ this.remove()
6
7
  }
7
8
 
8
9
  get message() {
@@ -1,11 +1,9 @@
1
- <% field_name_prefix = "picture[descriptions_attributes][#{picture_description_counter}]" %>
2
-
3
1
  <% if picture_description.persisted? %>
4
- <%= hidden_field field_name_prefix, :id, value: picture_description.id %>
2
+ <%= hidden_field description_field_name_prefix, :id, value: picture_description.id %>
5
3
  <% else %>
6
- <%= hidden_field field_name_prefix, :language_id, value: picture_description.language_id %>
7
- <%= hidden_field field_name_prefix, :picture_id, value: picture_description.picture_id %>
4
+ <%= hidden_field description_field_name_prefix, :language_id, value: picture_description.language_id %>
5
+ <%= hidden_field description_field_name_prefix, :picture_id, value: picture_description.picture_id %>
8
6
  <% end %>
9
7
 
10
- <%= label field_name_prefix, :text, Alchemy::PictureDescription.human_attribute_name(:text), class: "control-label" %>
11
- <%= text_area field_name_prefix, :text, value: picture_description.text, rows: 3 %>
8
+ <%= label description_field_name_prefix, :text, Alchemy::PictureDescription.human_attribute_name(:text), class: "control-label" %>
9
+ <%= text_area description_field_name_prefix, :text, value: picture_description.text, rows: 5 %>
@@ -1,6 +1,6 @@
1
1
  <turbo-frame id="picture_descriptions">
2
2
  <%= render "form", {
3
- picture_description: @picture_description,
4
- picture_description_counter: @picture.descriptions.index(@picture_description)
3
+ description_field_name_prefix: description_field_name_prefix,
4
+ picture_description: @picture_description
5
5
  } %>
6
6
  </turbo-frame>
@@ -1,7 +1,7 @@
1
1
  <%= turbo_frame_tag(@picture) do %>
2
- <%= alchemy_form_for [:admin, @picture] do |f| %>
2
+ <%= alchemy_form_for [alchemy, :admin, @picture] do |f| %>
3
3
  <%= f.input :name %>
4
- <%= render "picture_description_field", f: f %>
4
+ <%= render "alchemy/admin/pictures/picture_description_field", f: f %>
5
5
  <%= render Alchemy::Admin::TagsAutocomplete.new(additional_class: "input") do %>
6
6
  <%= f.label :tag_list %>
7
7
  <%= f.text_field :tag_list, value: f.object.tag_list.join(",") %>
@@ -2,30 +2,38 @@
2
2
  <% if Alchemy::Language.published.many? %>
3
3
  <label class="inline-label" style="float: right">
4
4
  <%= Alchemy::Language.model_name.human %>
5
- <%= select_tag :language_id, options_from_collection_for_select(
5
+ <%= select description_field_name_prefix, :language_id, options_from_collection_for_select(
6
6
  Alchemy::Language.published, :id, ->(l) { l.code.upcase },
7
7
  selected: @picture_description.language_id,
8
- ), data: {
9
- url: alchemy.edit_admin_picture_description_url(id: "__ID__", picture_id: @picture)
8
+ ),
9
+ {},
10
+ id: "picture_description_select",
11
+ data: {
12
+ url: alchemy.edit_admin_picture_description_url(
13
+ id: @picture_description.id || "__ID__",
14
+ picture_id: @picture
15
+ )
10
16
  } %>
11
17
  </label>
12
18
  <% end %>
13
19
 
14
20
  <turbo-frame id="picture_descriptions">
15
21
  <%= render "alchemy/admin/picture_descriptions/form",
16
- picture_description_counter: @picture.descriptions.index(@picture_description),
22
+ description_field_name_prefix: description_field_name_prefix,
17
23
  picture_description: @picture_description %>
18
24
  </turbo-frame>
19
25
  </div>
20
26
 
21
- <script type="module">
22
- const select = document.querySelector("#language_id")
27
+ <script>
28
+ (function ($) {
29
+ const select = $.getElementById("picture_description_select")
23
30
 
24
- if (select) {
25
- select.addEventListener("change", () => {
26
- const url = new URL(select.dataset.url)
27
- url.searchParams.set("language_id", select.value)
28
- Turbo.visit(url, { frame: "picture_descriptions" })
29
- })
30
- }
31
+ if (select) {
32
+ select.addEventListener("change", () => {
33
+ const url = new URL(select.dataset.url)
34
+ url.searchParams.set("language_id", select.value)
35
+ Turbo.visit(url, { frame: "picture_descriptions" })
36
+ })
37
+ }
38
+ })(document)
31
39
  </script>
@@ -0,0 +1,3 @@
1
+ <alchemy-growl type="error">
2
+ <%= @notice %>
3
+ </alchemy-growl>
@@ -0,0 +1,7 @@
1
+ class AddUniqueIndexToPictureDescriptions < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_index :alchemy_picture_descriptions, [:picture_id, :language_id],
4
+ name: "alchemy_picture_descriptions_on_picture_id_and_language_id",
5
+ unique: true
6
+ end
7
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "7.4.5"
4
+ VERSION = "7.4.6"
5
5
 
6
6
  def self.version
7
7
  VERSION
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.4.5
4
+ version: 7.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -801,6 +801,7 @@ files:
801
801
  - app/controllers/concerns/alchemy/admin/archive_overlay.rb
802
802
  - app/controllers/concerns/alchemy/admin/crop_action.rb
803
803
  - app/controllers/concerns/alchemy/admin/current_language.rb
804
+ - app/controllers/concerns/alchemy/admin/picture_descriptions_form_helper.rb
804
805
  - app/controllers/concerns/alchemy/admin/uploader_responses.rb
805
806
  - app/controllers/concerns/alchemy/legacy_page_redirects.rb
806
807
  - app/controllers/concerns/alchemy/site_redirects.rb
@@ -1135,6 +1136,7 @@ files:
1135
1136
  - app/views/alchemy/attachments/show.html.erb
1136
1137
  - app/views/alchemy/base/403.html.erb
1137
1138
  - app/views/alchemy/base/500.html.erb
1139
+ - app/views/alchemy/base/500.turbo_stream.erb
1138
1140
  - app/views/alchemy/base/error_notice.html.erb
1139
1141
  - app/views/alchemy/base/error_notice.js.erb
1140
1142
  - app/views/alchemy/base/permission_denied.js.erb
@@ -1223,6 +1225,7 @@ files:
1223
1225
  - db/migrate/20230505132743_add_indexes_to_alchemy_pictures.rb
1224
1226
  - db/migrate/20231113104432_create_page_mutexes.rb
1225
1227
  - db/migrate/20240314105244_create_alchemy_picture_descriptions.rb
1228
+ - db/migrate/20250626160259_add_unique_index_to_picture_descriptions.rb
1226
1229
  - eslint.config.js
1227
1230
  - lib/alchemy.rb
1228
1231
  - lib/alchemy/ability_helper.rb