alchemy_cms 5.1.4 → 5.1.8

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: fb5c73e167cb3cf25c39472962cd945f71853738fee4405daab67521650fff31
4
- data.tar.gz: 8da805b0e45430f0db4842a73fa18bf2e3e805bb158a21eff1f9d2fc538638cd
3
+ metadata.gz: 1e7adc86a14e5c432795df556a24b1f02fd73e9d3eaff031d00a1535de603133
4
+ data.tar.gz: 55597873cf3b5dea61dc9b38a875c9758aae306a95d3cf4dd1bee60b955e5121
5
5
  SHA512:
6
- metadata.gz: 026cf4b8054b3da3c9cc4db868e415a6b988176c13a0c9653dd898b204c048d5e66058039782ada758748cb1e2171a7bf68dd09fde837467b746bdaf446d8e6c
7
- data.tar.gz: fec06dbd8ee35382c1b6a8c4c78ad0aa0888f5cfe64a8e90ba6c8f0e5d738e5a41c77c40b929a54593379094c637ac5ddb74e71f3ed8d63d7519d54b2d5c3cb8
6
+ metadata.gz: 5b4e61acf2b9f4797ca380abd4404a512698aebdcbd12d26aa3cdb97997693338ac2508a2a8656cd4ce2d276fb31d58b8758e15405f78be885a813ab07f4a3ab
7
+ data.tar.gz: 3557455993192b07cf22a13600b4d8bedd34c33d213c08911989299588b8fc84b110bff389e4cc7b58a0ecd58a0b1b4967c5da1f95b820f0d6caacd4b05266eb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## 5.1.8 (2021-11-17)
2
+
3
+ - Set stampable user_class_name without root identifier ([tvdeyen](https://github.com/tvdeyen))
4
+ - Use relative path for tinymce font-face ([tvdeyen](https://github.com/tvdeyen))
5
+
6
+ ## 5.1.7 (2021-10-26)
7
+
8
+ - Make sure to install correct npm package ([tvdeyen](https://github.com/tvdeyen))
9
+
10
+ ## 5.1.6 (2021-09-17)
11
+
12
+ - Use self_and_ancestors in page_active? helper [#2194](https://github.com/AlchemyCMS/alchemy_cms/pull/2194) ([mamhoff](https://github.com/mamhoff))
13
+
14
+ ## 5.1.5 (2021-09-15)
15
+
16
+ - generate picture thumbnails only for pictures with convertible format [#2131](https://github.com/AlchemyCMS/alchemy_cms/pull/2131) ([afdev82](https://github.com/afdev82))
17
+ - Backport #2115 to v5.1 [#2125](https://github.com/AlchemyCMS/alchemy_cms/pull/2125) ([dbwinger](https://github.com/dbwinger))
18
+ - Backport #2114 to v5.1 [#2117](https://github.com/AlchemyCMS/alchemy_cms/pull/2117) ([afdev82](https://github.com/afdev82))
19
+
1
20
  ## 5.1.4 (2021-05-13)
2
21
 
3
22
  - Fix alchemy:generate:thumbnails task [#2092](https://github.com/AlchemyCMS/alchemy_cms/pull/2092) ([afdev82](https://github.com/afdev82))
data/alchemy_cms.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.add_runtime_dependency 'awesome_nested_set', ['~> 3.1']
24
24
  gem.add_runtime_dependency 'cancancan', ['>= 2.1', '< 4.0']
25
25
  gem.add_runtime_dependency 'coffee-rails', ['>= 4.0', '< 6.0']
26
- gem.add_runtime_dependency 'dragonfly', ['~> 1.0', '>= 1.0.7']
26
+ gem.add_runtime_dependency 'dragonfly', ['~> 1.0', '>= 1.0.7', '< 1.4.0']
27
27
  gem.add_runtime_dependency 'dragonfly_svg', ['~> 0.0.4']
28
28
  gem.add_runtime_dependency 'gutentag', ['~> 2.2', '>= 2.2.1']
29
29
  gem.add_runtime_dependency 'handlebars_assets', ['~> 0.23']
@@ -1566,18 +1566,18 @@ i.mce-i-resize {
1566
1566
 
1567
1567
  @font-face {
1568
1568
  font-family: 'tinymce';
1569
- src: url('fonts/tinymce.woff') format('woff'),
1570
- url('fonts/tinymce.ttf') format('truetype'),
1571
- url('fonts/tinymce.svg#tinymce') format('svg');
1569
+ src: url('./fonts/tinymce.woff') format('woff'),
1570
+ url('./fonts/tinymce.ttf') format('truetype'),
1571
+ url('./fonts/tinymce.svg#tinymce') format('svg');
1572
1572
  font-weight: normal;
1573
1573
  font-style: normal;
1574
1574
  }
1575
1575
 
1576
1576
  @font-face {
1577
1577
  font-family: 'tinymce-small';
1578
- src: url('fonts/tinymce-small.woff') format('woff'),
1579
- url('fonts/tinymce-small.ttf') format('truetype'),
1580
- url('fonts/tinymce-small.svg#tinymce') format('svg');
1578
+ src: url('./fonts/tinymce-small.woff') format('woff'),
1579
+ url('./fonts/tinymce-small.ttf') format('truetype'),
1580
+ url('./fonts/tinymce-small.svg#tinymce') format('svg');
1581
1581
  font-weight: normal;
1582
1582
  font-style: normal;
1583
1583
  }
@@ -100,7 +100,7 @@ module Alchemy
100
100
 
101
101
  # Returns true if page is in the active branch
102
102
  def page_active?(page)
103
- @_page_ancestors ||= Page.ancestors_for(@page)
103
+ @_page_ancestors ||= @page.self_and_ancestors.contentpages
104
104
  @_page_ancestors.include?(page)
105
105
  end
106
106
 
@@ -28,7 +28,7 @@ module Alchemy
28
28
  after_assign { |f| write_attribute(:file_mime_type, f.mime_type) }
29
29
  end
30
30
 
31
- stampable stamper_class_name: Alchemy.user_class_name
31
+ stampable stamper_class_name: Alchemy.user_class.name
32
32
 
33
33
  has_many :essence_files, class_name: "Alchemy::EssenceFile", foreign_key: "attachment_id"
34
34
  has_many :contents, through: :essence_files
@@ -60,7 +60,7 @@ module Alchemy
60
60
  #
61
61
  acts_as_list scope: [:page_id, :fixed, :parent_element_id]
62
62
 
63
- stampable stamper_class_name: Alchemy.user_class_name
63
+ stampable stamper_class_name: Alchemy.user_class.name
64
64
 
65
65
  has_many :contents, dependent: :destroy, inverse_of: :element
66
66
 
@@ -7,7 +7,7 @@ module Alchemy
7
7
  before_destroy :check_if_related_essence_nodes_present
8
8
 
9
9
  acts_as_nested_set scope: "language_id", touch: true
10
- stampable stamper_class_name: Alchemy.user_class_name
10
+ stampable stamper_class_name: Alchemy.user_class.name
11
11
 
12
12
  belongs_to :language, class_name: "Alchemy::Language"
13
13
  belongs_to :page, class_name: "Alchemy::Page", optional: true, inverse_of: :nodes
@@ -82,7 +82,7 @@ module Alchemy
82
82
 
83
83
  acts_as_nested_set(dependent: :destroy, scope: [:layoutpage, :language_id])
84
84
 
85
- stampable stamper_class_name: Alchemy.user_class_name
85
+ stampable stamper_class_name: Alchemy.user_class.name
86
86
 
87
87
  belongs_to :language
88
88
 
@@ -108,7 +108,7 @@ module Alchemy
108
108
  case_sensitive: false,
109
109
  message: Alchemy.t("not a valid image")
110
110
 
111
- stampable stamper_class_name: Alchemy.user_class_name
111
+ stampable stamper_class_name: Alchemy.user_class.name
112
112
 
113
113
  scope :named, ->(name) { where("#{table_name}.name LIKE ?", "%#{name}%") }
114
114
  scope :recent, -> { where("#{table_name}.created_at > ?", Time.current - 24.hours).order(:created_at) }
@@ -1,6 +1,6 @@
1
1
  <% content = local_assigns[:content] || local_assigns[:essence_picture_view] %>
2
2
  <%= Alchemy::EssencePictureView.new(
3
3
  content,
4
- local_assigns[:options],
5
- local_assigns[:html_options]
6
- ).render %>
4
+ local_assigns[:options] || {},
5
+ local_assigns[:html_options] || {}
6
+ ).render %>
@@ -40,7 +40,7 @@ module Alchemy
40
40
  if Alchemy.user_class
41
41
  ActiveSupport.on_load(:active_record) do
42
42
  Alchemy.user_class.model_stamper
43
- Alchemy.user_class.stampable(stamper_class_name: Alchemy.user_class_name)
43
+ Alchemy.user_class.stampable(stamper_class_name: Alchemy.user_class.name)
44
44
  end
45
45
  end
46
46
  end
@@ -1,9 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "tasks/harden_gutentag_migrations"
4
+ require "rails/generators"
5
+ require "thor"
6
+ require "alchemy/install/tasks"
7
+ require "alchemy/version"
4
8
 
5
9
  module Alchemy
6
10
  class Upgrader::FivePointZero < Upgrader
11
+ include Rails::Generators::Actions
12
+ include Thor::Base
13
+ include Thor::Actions
14
+
15
+ source_root File.expand_path("../../generators/alchemy/install/files", __dir__)
16
+
7
17
  class << self
8
18
  def install_gutentag_migrations
9
19
  desc "Install Gutentag migrations"
@@ -36,6 +46,28 @@ module Alchemy
36
46
  log "Root page not found.", :skip
37
47
  end
38
48
  end
49
+
50
+ def run_webpacker_installer
51
+ # Webpacker does not create a package.json, but we need one
52
+ unless File.exist? app_root.join("package.json")
53
+ in_root { run "echo '{}' > package.json" }
54
+ end
55
+ new.rake("webpacker:install", abort_on_failure: true)
56
+ end
57
+
58
+ def add_npm_package
59
+ new.run "yarn add @alchemy_cms/admin@~#{Alchemy.version}"
60
+ end
61
+
62
+ def copy_alchemy_entry_point
63
+ webpack_config = YAML.load_file(app_root.join("config", "webpacker.yml"))[Rails.env]
64
+ new.copy_file "alchemy_admin.js",
65
+ app_root.join(webpack_config["source_path"], webpack_config["source_entry_path"], "alchemy/admin.js")
66
+ end
67
+
68
+ def app_root
69
+ @_app_root ||= Rails.root
70
+ end
39
71
  end
40
72
  end
41
73
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "5.1.4"
4
+ VERSION = "5.1.8"
5
5
 
6
6
  def self.version
7
7
  VERSION
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require "rails/generators"
3
3
  require "alchemy/install/tasks"
4
+ require "alchemy/version"
4
5
 
5
6
  module Alchemy
6
7
  module Generators
@@ -88,7 +89,7 @@ module Alchemy
88
89
  end
89
90
 
90
91
  def add_npm_package
91
- run "yarn add @alchemy_cms/admin"
92
+ run "yarn add @alchemy_cms/admin@~#{Alchemy.version}"
92
93
  end
93
94
 
94
95
  def copy_alchemy_entry_point
@@ -14,6 +14,8 @@ namespace :alchemy do
14
14
  puts "Please wait..."
15
15
 
16
16
  Alchemy::Picture.find_each do |picture|
17
+ next unless picture.has_convertible_format?
18
+
17
19
  puts Alchemy::PictureThumb.generate_thumbs!(picture)
18
20
  end
19
21
 
@@ -42,6 +42,9 @@ namespace :alchemy do
42
42
  "alchemy:upgrade:5.0:install_gutentag_migrations",
43
43
  "alchemy:upgrade:5.0:remove_layout_roots",
44
44
  "alchemy:upgrade:5.0:remove_root_page",
45
+ "alchemy:upgrade:5.0:run_webpacker_installer",
46
+ "alchemy:upgrade:5.0:add_npm_package",
47
+ "alchemy:upgrade:5.0:copy_alchemy_entry_point",
45
48
  ]
46
49
 
47
50
  desc "Install Gutentag migrations"
@@ -58,6 +61,23 @@ namespace :alchemy do
58
61
  task remove_root_page: [:environment] do
59
62
  Alchemy::Upgrader::FivePointZero.remove_root_page
60
63
  end
64
+
65
+ desc "Run webpacker installer"
66
+ task run_webpacker_installer: [:environment] do
67
+ Alchemy::Upgrader::FivePointZero.run_webpacker_installer
68
+ end
69
+
70
+ desc "Add NPM package"
71
+ task add_npm_package: [:environment] do
72
+ puts "adding npm_package..."
73
+ Alchemy::Upgrader::FivePointZero.add_npm_package
74
+ end
75
+
76
+ desc "Copy alchemy entry point"
77
+ task copy_alchemy_entry_point: [:environment] do
78
+ puts "copying alchemy entry point"
79
+ Alchemy::Upgrader::FivePointZero.copy_alchemy_entry_point
80
+ end
61
81
  end
62
82
  end
63
83
  end
data/package/admin.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import translate from "./src/i18n"
2
+ import translationData from "./src/translations"
2
3
  import NodeTree from "./src/node_tree"
3
4
 
4
5
  // Global Alchemy object
@@ -10,5 +11,6 @@ if (typeof window.Alchemy === "undefined") {
10
11
  Object.assign(Alchemy, {
11
12
  // Global utility method for translating a given string
12
13
  t: translate,
14
+ translations: Object.assign(Alchemy.translations || {}, translationData),
13
15
  NodeTree
14
16
  })
@@ -15,12 +15,20 @@ describe("translate", () => {
15
15
  })
16
16
 
17
17
  describe("if translation is present", () => {
18
+ beforeEach(() => {
19
+ Alchemy.translations = { en: { help: "Help" } }
20
+ })
21
+
18
22
  it("Returns translated string", () => {
19
23
  expect(translate("help")).toEqual("Help")
20
24
  })
21
25
 
22
26
  describe("if key includes a period", () => {
23
27
  describe("that is translated", () => {
28
+ beforeEach(() => {
29
+ Alchemy.translations = { en: { formats: { date: "Y-m-d" } } }
30
+ })
31
+
24
32
  it("splits into group", () => {
25
33
  expect(translate("formats.date")).toEqual("Y-m-d")
26
34
  })
@@ -40,6 +48,10 @@ describe("translate", () => {
40
48
  })
41
49
 
42
50
  describe("if replacement is given", () => {
51
+ beforeEach(() => {
52
+ Alchemy.translations = { en: { allowed_chars: "of %{number} chars" } }
53
+ })
54
+
43
55
  it("replaces it", () => {
44
56
  expect(translate("allowed_chars", 5)).toEqual("of 5 chars")
45
57
  })
@@ -67,4 +79,15 @@ describe("translate", () => {
67
79
  spy.mockRestore()
68
80
  })
69
81
  })
82
+
83
+ describe("if Alchemy.translations is not set", () => {
84
+ it("Returns passed string and logs a warning", () => {
85
+ const spy = jest.spyOn(console, "warn").mockImplementation(() => {})
86
+ expect(translate("help")).toEqual("help")
87
+ expect(spy.mock.calls).toEqual([
88
+ ["Translations for locale kl not found!"]
89
+ ])
90
+ spy.mockRestore()
91
+ })
92
+ })
70
93
  })
data/package/src/i18n.js CHANGED
@@ -1,5 +1,3 @@
1
- import translationData from "./translations"
2
-
3
1
  const KEY_SEPARATOR = /\./
4
2
 
5
3
  function currentLocale() {
@@ -11,7 +9,7 @@ function currentLocale() {
11
9
 
12
10
  function getTranslations() {
13
11
  const locale = currentLocale()
14
- const translations = translationData[locale]
12
+ const translations = Alchemy.translations && Alchemy.translations[locale]
15
13
 
16
14
  if (translations) {
17
15
  return translations
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy_cms/admin",
3
- "version": "0.2.0",
3
+ "version": "5.1.8",
4
4
  "description": "AlchemyCMS",
5
5
  "browser": "package/admin.js",
6
6
  "files": [
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: 5.1.4
4
+ version: 5.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -10,10 +10,10 @@ authors:
10
10
  - Hendrik Mans
11
11
  - Carsten Fregin
12
12
  - Martin Meyerhoff
13
- autorequire:
13
+ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2021-05-13 00:00:00.000000000 Z
16
+ date: 2021-11-17 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: active_model_serializers
@@ -113,6 +113,9 @@ dependencies:
113
113
  - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: 1.0.7
116
+ - - "<"
117
+ - !ruby/object:Gem::Version
118
+ version: 1.4.0
116
119
  type: :runtime
117
120
  prerelease: false
118
121
  version_requirements: !ruby/object:Gem::Requirement
@@ -123,6 +126,9 @@ dependencies:
123
126
  - - ">="
124
127
  - !ruby/object:Gem::Version
125
128
  version: 1.0.7
129
+ - - "<"
130
+ - !ruby/object:Gem::Version
131
+ version: 1.4.0
126
132
  - !ruby/object:Gem::Dependency
127
133
  name: dragonfly_svg
128
134
  requirement: !ruby/object:Gem::Requirement
@@ -1278,8 +1284,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1278
1284
  version: '0'
1279
1285
  requirements:
1280
1286
  - ImageMagick (libmagick), v6.6 or greater.
1281
- rubygems_version: 3.1.4
1282
- signing_key:
1287
+ rubygems_version: 3.1.6
1288
+ signing_key:
1283
1289
  specification_version: 4
1284
1290
  summary: A powerful, userfriendly and flexible CMS for Rails
1285
1291
  test_files: []
1292
+ ...