alchemy_cms 7.2.3 → 7.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb22c2991c573b8ad8fe7460295352de9721226f3a3674dc3eac1cd73034874a
4
- data.tar.gz: 63b4185e81621b66282b928a4b127a1a722264a4f0e69483cd15cdc176f642d2
3
+ metadata.gz: 3f9a554636616ea87a438350ad7e91462a8b2196047504d81669782b8d08a6d8
4
+ data.tar.gz: 6897d00c7e23af4de0023fb6c2f63819e7de68a549274afb5c258463e3924482
5
5
  SHA512:
6
- metadata.gz: d252e2a70fc5b58e05e768446aa6ac6b1ffe1cd718d7b123aca66f53eb78ae98b628fda218e1d1e30e2a3fabd2c5b0274bdfff13092d9b546844b84432c7c959
7
- data.tar.gz: 766e765a3ae71c220adb052c2ff86d0c2f686a5a801529b2fa6ee1a1f27c6d588691632423d33ef612a51b28c663a8553a31b1b450afe3437f6474af5f9a46f9
6
+ metadata.gz: e446096fe1d3e1aa5dcc327ad1b7d779447b668c7294d83a4789f2694a0c7e90ee053c422e17bd8168bcaf420a0909b3614ec3302c33986235ef02459eb29074
7
+ data.tar.gz: 52851127d29b47907b9c9ea25ead515bb94060962585e7c70afc65f2cb426c7dfc63d65263e16d21e157b0f1786391fea1410327d8669bee9b5b7a3aa3c3897a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
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
+
3
14
  ## 7.2.3 (2024-06-27)
4
15
 
5
16
  - [7.2-stable] Disable Turbo Prefetch in Admin [#2947](https://github.com/AlchemyCMS/alchemy_cms/pull/2947) ([tvdeyen](https://github.com/tvdeyen))
@@ -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)
@@ -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(",") } %>
@@ -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 %>
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.3"
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
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.2.3
4
+ version: 7.2.4
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: 2024-06-27 00:00:00.000000000 Z
16
+ date: 2024-08-10 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: actionmailer
@@ -1296,6 +1296,7 @@ files:
1296
1296
  - lib/alchemy/test_support.rb
1297
1297
  - lib/alchemy/test_support/capybara_helpers.rb
1298
1298
  - lib/alchemy/test_support/config_stubbing.rb
1299
+ - lib/alchemy/test_support/current_language_shared_examples.rb
1299
1300
  - lib/alchemy/test_support/factories/attachment_factory.rb
1300
1301
  - lib/alchemy/test_support/factories/dummy_user_factory.rb
1301
1302
  - lib/alchemy/test_support/factories/element_factory.rb