Skip to content

Commit

Permalink
Merge branch '5.0-stable' of github.com:AlchemyCMS/alchemy_cms into a…
Browse files Browse the repository at this point in the history
…ctive-storage-integration

* '5.0-stable' of github.com:AlchemyCMS/alchemy_cms: (34 commits)
  Bump version to v5.0.10
  Add crop_resize Dragonfly processor
  make the admin error tracker customizable
  Bump npm package
  Bump version to v5.0.9
  Adjust tinymce skin assets urls again
  Bump npm package version to v5.0.8
  Bump version to v5.0.8
  Set stampable user_class_name without root identifier
  Use relative path for tinymce font-face
  Bump version to v5.0.7
  Make sure to install correct npm package
  Bump version to v5.0.6
  Use self_and_ancestors in page_active? helper
  Bump version to v5.0.5
  Bump NPM package version to 5.0.4
  Backport AlchemyCMS#2115 to v5.0
  Fixes i18n Jest specs
  expose translations in global Alchemy js object, AlchemyCMS#2113
  Fixate Dragonfly to < 1.4
  ...
  • Loading branch information
gr8bit committed Apr 12, 2022
2 parents 8e5da4f + 325d500 commit c4c134a
Show file tree
Hide file tree
Showing 48 changed files with 442 additions and 91 deletions.
28 changes: 10 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
- '5.2'
- '6.0'
ruby:
- '2.5.x'
- '2.6.x'
- '2.7.x'
database:
- mysql
- postgresql
Expand Down Expand Up @@ -43,14 +43,14 @@ jobs:
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2.3.4
- name: Set up Ruby
uses: actions/setup-ruby@v1
uses: actions/setup-ruby@v1.1.2
with:
ruby-version: ${{ matrix.ruby }}
- name: Restore apt cache
id: apt-cache
uses: actions/cache@preview
uses: actions/cache@v2.1.3
with:
path: /home/runner/apt/cache
key: ${{ runner.os }}-apt-${{ matrix.database }}
Expand All @@ -75,7 +75,7 @@ jobs:
gem install bundler
- name: Restore Ruby Gems cache
id: cache
uses: actions/cache@preview
uses: actions/cache@v2.1.3
with:
path: vendor/bundle
key: ${{ runner.os }}-bundle-${{ matrix.ruby }}-${{ matrix.rails }}-${{ matrix.database }}-${{ hashFiles('**/Gemfile') }}
Expand All @@ -87,7 +87,7 @@ jobs:
bundle install --jobs 4 --retry 3 --path vendor/bundle
- name: Restore node modules cache
id: yarn-cache
uses: actions/cache@preview
uses: actions/cache@v2.1.3
with:
path: spec/dummy/node_modules
key: ${{ runner.os }}-yarn-dummy-${{ hashFiles('./package.json') }}
Expand All @@ -97,12 +97,12 @@ jobs:
run: |
bundle exec rake alchemy:spec:prepare
- name: Run tests & publish code coverage
uses: paambaati/codeclimate-action@v2.5.7
uses: paambaati/codeclimate-action@v2.7.5
env:
CC_TEST_REPORTER_ID: bca4349e32f97919210ac8a450b04904b90683fcdd57d65a22c0f5065482bc22
with:
coverageCommand: bundle exec rspec
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@main
if: failure()
with:
name: Screenshots
Expand All @@ -112,9 +112,9 @@ jobs:
env:
NODE_ENV: test
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2.3.4
- name: Restore node modules cache
uses: actions/cache@preview
uses: actions/cache@v2.1.3
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('./package.json') }}
Expand All @@ -124,11 +124,3 @@ jobs:
run: yarn install
- name: Run jest
run: yarn jest
- name: Run jest & publish code coverage
uses: paambaati/codeclimate-action@v2.5.7
env:
CC_TEST_REPORTER_ID: bca4349e32f97919210ac8a450b04904b90683fcdd57d65a22c0f5065482bc22
with:
coverageLocations:
./coverage/lcov.info:lcov
coverageCommand: yarn jest --collectCoverage --coverageDirectory=coverage
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
## 5.0.10 (2022-02-28)

- Add crop_resize Dragonfly processor ([tvdeyen](https://github.com/tvdeyen))

## 5.0.9 (2021-11-24)

- Adjust tinymce skin assets urls again ([tvdeyen](https://github.com/tvdeyen))

## 5.0.8 (2021-11-17)

- Set stampable user_class_name without root identifier ([tvdeyen](https://github.com/tvdeyen))
- Use relative path for tinymce font-face ([tvdeyen](https://github.com/tvdeyen))

## 5.0.7 (2021-10-26)

- Make sure to install correct npm package ([tvdeyen](https://github.com/tvdeyen))

## 5.0.6 (2021-09-17)

- Use self_and_ancestors in page_active? helper [#2193](https://github.com/AlchemyCMS/alchemy_cms/pull/2193) ([mamhoff](https://github.com/mamhoff))

## 5.0.5 (2021-09-15)

- Backport #2115 to v5.0 [#2126](https://github.com/AlchemyCMS/alchemy_cms/pull/2126) ([dbwinger](https://github.com/dbwinger))
- Fixate Dragonfly to < 1.4 [#2122](https://github.com/AlchemyCMS/alchemy_cms/pull/2122) ([tvdeyen](https://github.com/tvdeyen))
- Backport #2114 to v5.0 [#2118](https://github.com/AlchemyCMS/alchemy_cms/pull/2118) ([afdev82](https://github.com/afdev82))

## 5.0.4 (2021-05-06)

- Use symbols in polymorphic routes for resources [#2087](https://github.com/AlchemyCMS/alchemy_cms/pull/2087) ([tvdeyen](https://github.com/tvdeyen))

## 5.0.3 (2021-01-12)

- Fix copy element feature [#1996](https://github.com/AlchemyCMS/alchemy_cms/pull/1996) ([tvdeyen](https://github.com/tvdeyen))

## 5.0.2 (2020-12-18)

- Fix page sorting [#1984](https://github.com/AlchemyCMS/alchemy_cms/pull/1984) ([tvdeyen](https://github.com/tvdeyen))

## 5.0.1 (2020-09-29)

- Better image alt text support [#1940](https://github.com/AlchemyCMS/alchemy_cms/pull/1940) ([tvdeyen](https://github.com/tvdeyen))

## 5.0.0 (2020-07-17)

- Do not convert JPEG images into JPG [#1904](https://github.com/AlchemyCMS/alchemy_cms/pull/1904) ([tvdeyen](https://github.com/tvdeyen))
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if ENV["DB"].nil? || ENV["DB"] == "sqlite"
gem "sqlite3", "~> 1.4.1"
end
gem "mysql2", "~> 0.5.1" if ENV["DB"] == "mysql"
gem "pg", "~> 1.0" if ENV["DB"] == "postgresql"
gem "pg", "~> 1.0" if ENV["DB"] == "postgresql"

group :development, :test do
if ENV["GITHUB_ACTIONS"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# AlchemyCMS

[![Gem Version](https://badge.fury.io/rb/alchemy_cms.svg)](http://badge.fury.io/rb/alchemy_cms)
[![Build Status](https://github.com/AlchemyCMS/alchemy_cms/workflows/CI/badge.svg?branch=master)](https://github.com/AlchemyCMS/alchemy_cms/actions)
[![Build Status](https://github.com/AlchemyCMS/alchemy_cms/workflows/CI/badge.svg?branch=main)](https://github.com/AlchemyCMS/alchemy_cms/actions)
[![Maintainability](https://api.codeclimate.com/v1/badges/196c56c56568ed24a697/maintainability)](https://codeclimate.com/github/AlchemyCMS/alchemy_cms/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/196c56c56568ed24a697/test_coverage)](https://codeclimate.com/github/AlchemyCMS/alchemy_cms/test_coverage)
[![Depfu](https://badges.depfu.com/badges/ebe56d2dd7b7044a8ae700cc81212a8e/overview.svg)](https://depfu.com/github/AlchemyCMS/alchemy_cms?project_id=4600)
Expand Down
4 changes: 2 additions & 2 deletions alchemy_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
gem.summary = 'A powerful, userfriendly and flexible CMS for Rails'
gem.description = 'Alchemy is a powerful, userfriendly and flexible Rails CMS.'
gem.requirements << 'ImageMagick (libmagick), v6.6 or greater.'
gem.required_ruby_version = '>= 2.3.0'
gem.required_ruby_version = '~> 2.3'
gem.license = 'BSD New'
gem.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
gem.require_paths = ['lib']
Expand All @@ -24,7 +24,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency 'awesome_nested_set', ['~> 3.1']
gem.add_runtime_dependency 'cancancan', ['>= 2.1', '< 4.0']
gem.add_runtime_dependency 'coffee-rails', ['~> 4.0', '< 5.0']
gem.add_runtime_dependency 'dragonfly', ['~> 1.0', '>= 1.0.7']
gem.add_runtime_dependency 'dragonfly', ['~> 1.4']
gem.add_runtime_dependency 'dragonfly_svg', ['~> 0.0.4']
gem.add_runtime_dependency 'gutentag', ['~> 2.2', '>= 2.2.1']
gem.add_runtime_dependency 'handlebars_assets', ['~> 0.23']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ td,th {

.mce-object {
border: 1px dotted #3a3a3a;
background: #d5d5d5 url(img/object.gif) no-repeat center;
background: #d5d5d5 url('tinymce/skins/alchemy/fonts/img/object.gif') no-repeat center;
}

.mce-pagebreak {
Expand All @@ -55,7 +55,7 @@ td,th {
width: 9px!important;
height: 9px!important;
border: 1px dotted #3a3a3a;
background: #d5d5d5 url(img/anchor.gif) no-repeat center;
background: #d5d5d5 url('tinymce/skins/alchemy/fonts/img/anchor.gif') no-repeat center;
}

.mce-nbsp {
Expand All @@ -77,7 +77,7 @@ hr {
}

.mce-spellchecker-word {
background: url(img/wline.gif) repeat-x bottom left;
background: url('tinymce/skins/alchemy/fonts/img/wline.gif') repeat-x bottom left;
cursor: default;
}

Expand Down
14 changes: 7 additions & 7 deletions app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1561,23 +1561,23 @@ i.mce-i-resize {
opacity: 0.6;
filter: alpha(opacity=60);
zoom: 1;
background: #fff url('img/loader.gif') no-repeat center center;
background: #fff url('tinymce/skins/alchemy/fonts/img/loader.gif') no-repeat center center;
}

@font-face {
font-family: 'tinymce';
src: url('fonts/tinymce.woff') format('woff'),
url('fonts/tinymce.ttf') format('truetype'),
url('fonts/tinymce.svg#tinymce') format('svg');
src: url('tinymce/skins/alchemy/fonts/tinymce.woff') format('woff'),
url('tinymce/skins/alchemy/fonts/tinymce.ttf') format('truetype'),
url('tinymce/skins/alchemy/fonts/tinymce.svg#tinymce') format('svg');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'tinymce-small';
src: url('fonts/tinymce-small.woff') format('woff'),
url('fonts/tinymce-small.ttf') format('truetype'),
url('fonts/tinymce-small.svg#tinymce') format('svg');
src: url('tinymce/skins/alchemy/fonts/tinymce-small.woff') format('woff'),
url('tinymce/skins/alchemy/fonts/tinymce-small.ttf') format('truetype'),
url('tinymce/skins/alchemy/fonts/tinymce-small.svg#tinymce') format('svg');
font-weight: normal;
font-style: normal;
}
Expand Down
12 changes: 9 additions & 3 deletions app/controllers/alchemy/admin/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ def set_layout
def exception_handler(error)
exception_logger(error)
show_error_notice(error)
if defined?(Airbrake)
notify_airbrake(error) unless Rails.env.development? || Rails.env.test?
end
notify_error_tracker(error)
end

# Displays an error notice in the Alchemy backend.
Expand Down Expand Up @@ -147,6 +145,14 @@ def current_alchemy_site
site
end
end

def notify_error_tracker(exception)
if ::Alchemy::ErrorTracking.notification_handler.respond_to?(:call)
::Alchemy::ErrorTracking.notification_handler.call(exception)
else
Rails.logger.warn("To use the Alchemy::ErrorTracking.notification_handler, it must respond to #call.")
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/helpers/alchemy/pages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def render_menu(menu_type, options = {})

# Returns true if page is in the active branch
def page_active?(page)
@_page_ancestors ||= Page.ancestors_for(@page)
@_page_ancestors ||= @page.self_and_ancestors.contentpages
@_page_ancestors.include?(page)
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/alchemy/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Attachment < BaseRecord
after_assign { |f| write_attribute(:file_mime_type, f.mime_type) }
end

stampable stamper_class_name: Alchemy.user_class_name
stampable stamper_class_name: Alchemy.user_class.name

has_many :essence_files, class_name: "Alchemy::EssenceFile", foreign_key: "attachment_id"
has_many :contents, through: :essence_files
Expand Down
2 changes: 1 addition & 1 deletion app/models/alchemy/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Element < BaseRecord
#
acts_as_list scope: [:page_id, :fixed, :parent_element_id]

stampable stamper_class_name: Alchemy.user_class_name
stampable stamper_class_name: Alchemy.user_class.name

has_many :contents, dependent: :destroy, inverse_of: :element

Expand Down
6 changes: 5 additions & 1 deletion app/models/alchemy/essence_picture_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def caption
def img_tag
@_img_tag ||= image_tag(
essence.picture_url(options.except(*DEFAULT_OPTIONS.keys)), {
alt: essence.alt_tag.presence,
alt: alt_text,
title: essence.title.presence,
class: caption ? nil : essence.css_class.presence,
srcset: srcset.join(", ").presence,
Expand All @@ -79,5 +79,9 @@ def srcset
width.present? ? "#{url} #{width}w" : "#{url} #{height}h"
end
end

def alt_text
essence.alt_tag.presence || html_options.delete(:alt) || essence.picture.name&.humanize
end
end
end
2 changes: 1 addition & 1 deletion app/models/alchemy/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Node < BaseRecord
before_destroy :check_if_related_essence_nodes_present

acts_as_nested_set scope: "language_id", touch: true
stampable stamper_class_name: Alchemy.user_class_name
stampable stamper_class_name: Alchemy.user_class.name

belongs_to :language, class_name: "Alchemy::Language"
belongs_to :page, class_name: "Alchemy::Page", optional: true, inverse_of: :nodes
Expand Down
2 changes: 1 addition & 1 deletion app/models/alchemy/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Page < BaseRecord

acts_as_nested_set(dependent: :destroy, scope: [:layoutpage, :language_id])

stampable stamper_class_name: Alchemy.user_class_name
stampable stamper_class_name: Alchemy.user_class.name

belongs_to :language

Expand Down
2 changes: 1 addition & 1 deletion app/models/alchemy/picture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def allowed_filetypes
case_sensitive: false,
message: Alchemy.t("not a valid image")

stampable stamper_class_name: Alchemy.user_class_name
stampable stamper_class_name: Alchemy.user_class.name

scope :named, ->(name) { where("#{table_name}.name LIKE ?", "%#{name}%") }
scope :recent, -> { where("#{table_name}.created_at > ?", Time.current - 24.hours).order(:created_at) }
Expand Down
6 changes: 3 additions & 3 deletions app/models/alchemy/picture/transformations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,12 @@ def center_crop(dimensions, upsample)
# Use imagemagick to custom crop an image. Uses -thumbnail for better performance when resizing.
#
def xy_crop_resize(dimensions, top_left, crop_dimensions, upsample)
crop_argument = "-crop #{dimensions_to_string(crop_dimensions)}"
crop_argument = dimensions_to_string(crop_dimensions)
crop_argument += "+#{top_left[:x]}+#{top_left[:y]}"

resize_argument = "-resize #{dimensions_to_string(dimensions)}"
resize_argument = dimensions_to_string(dimensions)
resize_argument += ">" unless upsample
image_file.convert "#{crop_argument} #{resize_argument}"
image_file.crop_resize(crop_argument, resize_argument)
end

# Used when centercropping.
Expand Down
8 changes: 4 additions & 4 deletions app/serializers/alchemy/page_tree_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ def pages

level = path.count + base_level

path.last[:children] << page_hash(page, has_children, level, folded)
path.last[:children] << page_hash(page, level, folded)
end

tree
end

protected

def page_hash(page, has_children, level, folded)
def page_hash(page, level, folded)
p_hash = {
id: page.id,
name: page.name,
Expand All @@ -59,8 +59,8 @@ def page_hash(page, has_children, level, folded)
urlname: page.urlname,
url_path: page.url_path,
level: level,
root: page.depth == 1,
root_or_leaf: page.depth == 1 || !has_children,
root: page.root?,
root_or_leaf: page.root? || page.leaf?,
children: [],
}

Expand Down
2 changes: 1 addition & 1 deletion app/views/alchemy/admin/elements/_element_toolbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% remarkable_type = element.class.name.demodulize.underscore.pluralize %>
<% remarkable_type = "elements" %>
<div class="element-toolbar">
<span class="element_tools">
<div class="button_with_label">
Expand Down
6 changes: 3 additions & 3 deletions app/views/alchemy/essences/_essence_picture_view.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% content = local_assigns[:content] || local_assigns[:essence_picture_view] %>
<%= Alchemy::EssencePictureView.new(
content,
local_assigns[:options],
local_assigns[:html_options]
).render %>
local_assigns[:options] || {},
local_assigns[:html_options] || {}
).render %>
Loading

0 comments on commit c4c134a

Please sign in to comment.