alchemy_cms 7.2.2 → 7.2.4

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: eec1db3fc77450fd504e9366e981397f2fc0ed2057d9e2cc2051f6b4939966ca
4
- data.tar.gz: c2beac93474a39df8ae3d73e3c2ebfe7be3904cc8fee0f8b6a7cd444aee33aff
3
+ metadata.gz: 3f9a554636616ea87a438350ad7e91462a8b2196047504d81669782b8d08a6d8
4
+ data.tar.gz: 6897d00c7e23af4de0023fb6c2f63819e7de68a549274afb5c258463e3924482
5
5
  SHA512:
6
- metadata.gz: 91a00fde6f54893e9f86f89ce498c90e074a085100c813cb2b9bc1b034e570a08fde1cc671bd02b1aad4d708485f1f0100bb0ec601279df10b0db854a2848e0b
7
- data.tar.gz: 4bc2b6cda15c88984ba8ab267bbf7716b5f282266b12af337a4093f66359e9badf47f741b9737fe6aebb7c5f57fa3b2114fb441dc1b22c6a16e382ad0166bd36
6
+ metadata.gz: e446096fe1d3e1aa5dcc327ad1b7d779447b668c7294d83a4789f2694a0c7e90ee053c422e17bd8168bcaf420a0909b3614ec3302c33986235ef02459eb29074
7
+ data.tar.gz: 52851127d29b47907b9c9ea25ead515bb94060962585e7c70afc65f2cb426c7dfc63d65263e16d21e157b0f1786391fea1410327d8669bee9b5b7a3aa3c3897a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.2.4 (2024-08-10)
4
+
5
+ - [7.2-stable] Fix margin of alchemy-message in alchemy-dialog [#2993](https://github.com/AlchemyCMS/alchemy_cms/pull/2993) ([tvdeyen](https://github.com/tvdeyen))
6
+ - [7.2-stable] fix PictureEditor defaultCropSize [#2992](https://github.com/AlchemyCMS/alchemy_cms/pull/2992) ([alchemycms-bot](https://github.com/alchemycms-bot))
7
+ - [7.2] Resource Controller: Allow additional Ransack filters [#2985](https://github.com/AlchemyCMS/alchemy_cms/pull/2985) ([mamhoff](https://github.com/mamhoff))
8
+ - [7.2-stable] Fix combining search filters and pagination [#2982](https://github.com/AlchemyCMS/alchemy_cms/pull/2982) ([alchemycms-bot](https://github.com/alchemycms-bot))
9
+ - [7.2-stable] Clear current language when switching sites [#2974](https://github.com/AlchemyCMS/alchemy_cms/pull/2974) ([alchemycms-bot](https://github.com/alchemycms-bot))
10
+ - [7.2-stable] Update _autocomplete_tag_list.html.erb [#2966](https://github.com/AlchemyCMS/alchemy_cms/pull/2966) ([alchemycms-bot](https://github.com/alchemycms-bot))
11
+ - [7.2-stable] Remove call to missing content_positions task [#2963](https://github.com/AlchemyCMS/alchemy_cms/pull/2963) ([alchemycms-bot](https://github.com/alchemycms-bot))
12
+ - [7.2-stable] Fix re-render of layoutpages form if validation fails [#2954](https://github.com/AlchemyCMS/alchemy_cms/pull/2954) ([alchemycms-bot](https://github.com/alchemycms-bot))
13
+
14
+ ## 7.2.3 (2024-06-27)
15
+
16
+ - [7.2-stable] Disable Turbo Prefetch in Admin [#2947](https://github.com/AlchemyCMS/alchemy_cms/pull/2947) ([tvdeyen](https://github.com/tvdeyen))
17
+ - [7.2-stable] Prevent Javascript error if the page will be unlocked [#2946](https://github.com/AlchemyCMS/alchemy_cms/pull/2946) ([alchemycms-bot](https://github.com/alchemycms-bot))
18
+ - [7.2-stable] fix(ContactMessages): Use alchemy route proxy [#2929](https://github.com/AlchemyCMS/alchemy_cms/pull/2929) ([alchemycms-bot](https://github.com/alchemycms-bot))
19
+ - [7.2-stable] [js] Update tinymce 7.1.0 → 7.1.1 (patch) [#2921](https://github.com/AlchemyCMS/alchemy_cms/pull/2921) ([alchemycms-bot](https://github.com/alchemycms-bot))
20
+
3
21
  ## 7.2.2 (2024-06-04)
4
22
 
5
23
  - [7.2-stable] fix(RoutingConstraints): Allow Turbo Stream requests [#2916](https://github.com/AlchemyCMS/alchemy_cms/pull/2916) ([alchemycms-bot](https://github.com/alchemycms-bot))
@@ -82,13 +82,15 @@ $dialog-transition-duration: 150ms;
82
82
  }
83
83
 
84
84
  form,
85
- .info.message {
85
+ .info.message,
86
+ alchemy-message[type="info"] {
86
87
  position: absolute;
87
88
  right: 2 * $default-padding;
88
89
  width: 256px;
89
90
  }
90
91
 
91
- .info.message {
92
+ .info.message,
93
+ alchemy-message[type="info"] {
92
94
  top: 2 * $default-padding;
93
95
  margin: 0 0 0 8px;
94
96
  padding: 0 8px 0 32px;
@@ -158,14 +160,16 @@ $dialog-transition-duration: 150ms;
158
160
  position: relative;
159
161
  color: $text-color;
160
162
 
161
- .message {
163
+ .message,
164
+ alchemy-message {
162
165
  margin: 8px;
163
166
  }
164
167
 
165
168
  &.padded {
166
169
  padding: 4 * $default-padding;
167
170
 
168
- .message {
171
+ .message,
172
+ alchemy-message {
169
173
  margin: 0 0 8px 0;
170
174
  }
171
175
  }
@@ -43,4 +43,8 @@ body.error {
43
43
  max-height: 100%;
44
44
  overflow-y: scroll;
45
45
  }
46
+
47
+ alchemy-message[type="error"] {
48
+ margin: 0;
49
+ }
46
50
  }
@@ -17,6 +17,25 @@ module Alchemy
17
17
  def edit
18
18
  @page = Page.find(params[:id])
19
19
  end
20
+
21
+ def update
22
+ @page = Page.find(params[:id])
23
+ if @page.update(page_params)
24
+ @notice = Alchemy.t("Page saved", name: @page.name)
25
+ render "alchemy/admin/pages/update"
26
+ else
27
+ render :edit, status: :unprocessable_entity
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def page_params
34
+ params.require(:page).permit(
35
+ :name,
36
+ :tag_list
37
+ )
38
+ end
20
39
  end
21
40
  end
22
41
  end
@@ -200,10 +200,7 @@ module Alchemy
200
200
  def common_search_filter_includes
201
201
  search_filters = [
202
202
  {
203
- q: [
204
- resource_handler.search_field_name,
205
- :s
206
- ]
203
+ q: [:s] + permitted_ransack_search_fields
207
204
  },
208
205
  :tagged_with,
209
206
  :page,
@@ -219,6 +216,12 @@ module Alchemy
219
216
  search_filters
220
217
  end
221
218
 
219
+ def permitted_ransack_search_fields
220
+ [
221
+ resource_handler.search_field_name
222
+ ]
223
+ end
224
+
222
225
  def items_per_page
223
226
  cookies[:alchemy_items_per_page] =
224
227
  params[:per_page] || cookies[:alchemy_items_per_page] || Alchemy::Config.get(:items_per_page)
@@ -97,7 +97,7 @@ module Alchemy
97
97
  else
98
98
  Language.current_root_page.urlname
99
99
  end
100
- redirect_to show_page_path(
100
+ redirect_to alchemy.show_page_path(
101
101
  urlname: urlname,
102
102
  locale: prefix_locale? ? Current.language.code : nil
103
103
  )
@@ -6,11 +6,21 @@ module Alchemy
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  included do
9
+ # This needs to happen before BaseController#current_alchemy_site sets the session value.
10
+ prepend_before_action :clear_current_language_from_session, if: :switching_site?, only: :index
9
11
  before_action :load_current_language
10
12
  end
11
13
 
12
14
  private
13
15
 
16
+ def switching_site?
17
+ params[:site_id].present? && (params[:site_id] != session[:alchemy_site_id]&.to_s)
18
+ end
19
+
20
+ def clear_current_language_from_session
21
+ session.delete(:alchemy_language_id)
22
+ end
23
+
14
24
  def load_current_language
15
25
  @current_language = if session[:alchemy_language_id].present?
16
26
  set_alchemy_language(session[:alchemy_language_id])
@@ -8,7 +8,7 @@ const UPDATE_DELAY = 125
8
8
  const IMAGE_PLACEHOLDER = '<alchemy-icon name="image"></alchemy-icon>'
9
9
  const THUMBNAIL_SIZE = "160x120"
10
10
 
11
- class PictureEditor {
11
+ export class PictureEditor {
12
12
  constructor(container) {
13
13
  this.container = container
14
14
  this.cropFromField = container.querySelector("[data-crop-from]")
@@ -132,10 +132,10 @@ class PictureEditor {
132
132
  if (!this.imageCropperEnabled) return []
133
133
 
134
134
  const mask = this.targetSize.split("x").map((n) => parseInt(n))
135
- const zoom = max([
135
+ const zoom = max(
136
136
  mask[0] / this.imageFileWidth,
137
137
  mask[1] / this.imageFileHeight
138
- ])
138
+ )
139
139
 
140
140
  return [Math.round(mask[0] / zoom), Math.round(mask[1] / zoom)]
141
141
  }
@@ -1,4 +1,4 @@
1
- <%= alchemy_form_for [:admin, @page], class: 'edit_page' do |f| %>
1
+ <%= alchemy_form_for [:admin, @page], url: alchemy.admin_layoutpage_path(@page), class: 'edit_page' do |f| %>
2
2
  <%= f.input :name, autofocus: true %>
3
3
  <%= render Alchemy::Admin::TagsAutocomplete.new do %>
4
4
  <%= f.input :tag_list, input_html: { value: f.object.tag_list.join(",") } %>
@@ -15,6 +15,6 @@
15
15
  }
16
16
  locked_page_icon.outerHTML = locked_page_icon_content
17
17
  }
18
- document.querySelector("#page_<%= @page.id -%> .page_status.locked").remove()
18
+ document.querySelector("#page_<%= @page.id -%> .page_status.locked")?.remove()
19
19
  Alchemy.growl('<%= flash[:notice] -%>')
20
20
  })()
@@ -1,3 +1,3 @@
1
1
  <%= render Alchemy::Admin::TagsAutocomplete.new do %>
2
- <%= f.text_field :tag_list, value: object.tag_list.join(",") %>
2
+ <%= f.text_field :tag_list, value: f.object.tag_list.join(",") %>
3
3
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <%= form_tag url_for, method: :get, class: 'per-page-select-form' do |f| %>
2
2
  <% search_filter_params.reject { |k, _| k == 'page' || k == 'per_page' }.each do |key, value| %>
3
- <% if value.is_a? ActionController::Parameters %>
3
+ <% if value.respond_to?(:keys) %>
4
4
  <% value.each do |k, v| %>
5
5
  <%= hidden_field_tag "#{key}[#{k}]", v, id: nil %>
6
6
  <% end %>
@@ -8,6 +8,7 @@
8
8
  <%= csrf_meta_tag %>
9
9
  <meta name="robots" content="noindex">
10
10
  <meta name="alchemy-icon-sprite" content="<%= asset_path("remixicon.symbol.svg") %>">
11
+ <meta name="turbo-prefetch" content="false">
11
12
  <%= stylesheet_link_tag('alchemy/admin/all', media: 'screen', 'data-turbo-track' => true) %>
12
13
  <%= stylesheet_link_tag('alchemy/print', media: 'print', 'data-turbo-track' => true) %>
13
14
  <%= yield :stylesheets %>
data/config/routes.rb CHANGED
@@ -49,7 +49,7 @@ Alchemy::Engine.routes.draw do
49
49
  end
50
50
  end
51
51
 
52
- resources :layoutpages, only: [:index, :edit]
52
+ resources :layoutpages, only: [:index, :edit, :update]
53
53
 
54
54
  resources :pictures, except: [:new] do
55
55
  collection do
@@ -96,7 +96,7 @@ module Alchemy
96
96
  can :leave, :alchemy_admin
97
97
  can [:info, :help], :alchemy_admin_dashboard
98
98
  can :manage, :alchemy_admin_clipboard
99
- can :edit, :alchemy_admin_layoutpages
99
+ can :update, :alchemy_admin_layoutpages
100
100
  can :tree, :alchemy_admin_pages
101
101
 
102
102
  # Resources
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.shared_examples_for "a controller that loads current language" do |args|
4
+ context "when session has current language id key" do
5
+ let!(:site_1) { create(:alchemy_site) }
6
+ let!(:site_1_default_language) { create :alchemy_language, site: site_1, default: true }
7
+ let!(:another_site_1_language) { create :alchemy_language, site: site_1, code: :de }
8
+ let(:site_2) { create :alchemy_site, host: "another.host", languages: [build(:alchemy_language, code: :en), build(:alchemy_language, code: :de)] }
9
+
10
+ context "on index action" do
11
+ context "when switching the current site" do
12
+ before do
13
+ session[:alchemy_site_id] = site_1.id
14
+ session[:alchemy_language_id] = another_site_1_language.id
15
+ end
16
+
17
+ it "sets @current_language to the new site default language" do
18
+ get :index, params: {site_id: site_2.id}
19
+ expect(assigns(:current_language)).to eq site_2.default_language
20
+ end
21
+ end
22
+
23
+ context "when no language to set" do
24
+ it "shows flash warning with redirect" do
25
+ Alchemy::Language.destroy_all
26
+ get :index, params: {site_id: site_1.id}
27
+ expect(flash[:warning]).to eq Alchemy.t("Please create a language first.")
28
+ expect(response).to redirect_to admin_languages_path
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "7.2.2"
4
+ VERSION = "7.2.4"
5
5
 
6
6
  def self.version
7
7
  VERSION
@@ -7,7 +7,6 @@ namespace :alchemy do
7
7
  desc "Tidy up Alchemy database."
8
8
  task :up do
9
9
  Rake::Task["alchemy:tidy:element_positions"].invoke
10
- Rake::Task["alchemy:tidy:content_positions"].invoke
11
10
  Rake::Task["alchemy:tidy:remove_orphaned_records"].invoke
12
11
  Rake::Task["alchemy:tidy:remove_trashed_elements"].invoke
13
12
  Rake::Task["alchemy:tidy:remove_duplicate_legacy_urls"].invoke
data/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "flatpickr": "^4.6.13",
18
18
  "keymaster": "^1.6.2",
19
19
  "sortablejs": "^1.15.2",
20
- "tinymce": "^7.1.0"
20
+ "tinymce": "^7.1.1"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@babel/core": "^7.24.5",