alchemy_cms 7.2.3 → 7.2.5

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: cf46c4d83e5dd7d012a77672441a70408bbf865f9aa5e3c3b005866fd5fa2a29
4
+ data.tar.gz: 9949271d7fd1581902220fe3bc69d81801ab3d34e6a1601da7b873a0a623ae87
5
5
  SHA512:
6
- metadata.gz: d252e2a70fc5b58e05e768446aa6ac6b1ffe1cd718d7b123aca66f53eb78ae98b628fda218e1d1e30e2a3fabd2c5b0274bdfff13092d9b546844b84432c7c959
7
- data.tar.gz: 766e765a3ae71c220adb052c2ff86d0c2f686a5a801529b2fa6ee1a1f27c6d588691632423d33ef612a51b28c663a8553a31b1b450afe3437f6474af5f9a46f9
6
+ metadata.gz: 56404d066fd58edeb6af7c6a612860a44f802a6bc05ba7ab01b7cc46cd0c1a167e83a26c801f958544a16299c72e7e5a556094b076b09e78c2433f0a0a438083
7
+ data.tar.gz: e4b58afa15303074db32f10dedb36cdd2fb6dbe1992d619a65b848acf315fb46a0e933da5f2b24a4df7d4578a0df8e76c3e13cc08c499f410ff43299275059f4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.2.5 (2024-09-04)
4
+
5
+ - [7.2-stable] Render Datetime ingredient in local time zone [#3019](https://github.com/AlchemyCMS/alchemy_cms/pull/3019) ([tvdeyen](https://github.com/tvdeyen))
6
+ - [7.2-stable] Allow to set input_type on Datetime ingredient editor [#3016](https://github.com/AlchemyCMS/alchemy_cms/pull/3016) ([tvdeyen](https://github.com/tvdeyen))
7
+
8
+ ## 7.2.4 (2024-08-10)
9
+
10
+ - [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))
11
+ - [7.2-stable] fix PictureEditor defaultCropSize [#2992](https://github.com/AlchemyCMS/alchemy_cms/pull/2992) ([alchemycms-bot](https://github.com/alchemycms-bot))
12
+ - [7.2] Resource Controller: Allow additional Ransack filters [#2985](https://github.com/AlchemyCMS/alchemy_cms/pull/2985) ([mamhoff](https://github.com/mamhoff))
13
+ - [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))
14
+ - [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))
15
+ - [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))
16
+ - [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))
17
+ - [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))
18
+
3
19
  ## 7.2.3 (2024-06-27)
4
20
 
5
21
  - [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
  }
@@ -11,10 +11,11 @@ module Alchemy
11
11
  end
12
12
 
13
13
  def call
14
+ datetime = ingredient.value.in_time_zone(Rails.application.config.time_zone)
14
15
  if date_format == "rfc822"
15
- ingredient.value.to_s(:rfc822)
16
+ datetime.to_fs(:rfc822)
16
17
  else
17
- ::I18n.l(ingredient.value, format: date_format)
18
+ ::I18n.l(datetime, format: date_format)
18
19
  end.html_safe
19
20
  end
20
21
  end
@@ -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
  }
@@ -5,7 +5,7 @@ module Alchemy
5
5
  # A datetime value
6
6
  #
7
7
  class Datetime < Alchemy::Ingredient
8
- allow_settings %i[date_format]
8
+ allow_settings %i[date_format input_type]
9
9
 
10
10
  def value
11
11
  ActiveRecord::Type::DateTime.new.cast(self[:value])
@@ -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 %>
@@ -7,7 +7,8 @@
7
7
  datetime_editor, :value, {
8
8
  name: datetime_editor.form_field_name,
9
9
  id: datetime_editor.form_field_id,
10
- value: datetime_editor.value
10
+ value: datetime_editor.value,
11
+ type: datetime_editor.settings[:input_type]
11
12
  }
12
13
  ) %>
13
14
  <% 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.5"
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.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: 2024-06-27 00:00:00.000000000 Z
16
+ date: 2024-09-04 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
@@ -1431,7 +1432,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1431
1432
  version: '0'
1432
1433
  requirements:
1433
1434
  - ImageMagick (libmagick), v6.6 or greater.
1434
- rubygems_version: 3.5.11
1435
+ rubygems_version: 3.5.16
1435
1436
  signing_key:
1436
1437
  specification_version: 4
1437
1438
  summary: A powerful, userfriendly and flexible CMS for Rails