alchemy_cms 7.0.0.pre.b → 7.0.0.pre.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +21 -1
- data/.github/workflows/{ci.yml → test.yml} +1 -1
- data/.gitignore +0 -5
- data/CHANGELOG.md +7 -0
- data/Gemfile +0 -1
- data/README.md +3 -3
- data/Rakefile +0 -19
- data/alchemy_cms.gemspec +2 -1
- data/app/assets/config/alchemy_manifest.js +1 -0
- data/app/assets/javascripts/alchemy/admin.js +0 -2
- data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +0 -21
- data/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +5 -12
- data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +1 -6
- data/app/assets/stylesheets/alchemy/base.scss +2 -2
- data/app/controllers/alchemy/api/pages_controller.rb +0 -2
- data/app/controllers/alchemy/base_controller.rb +0 -7
- data/{package/src → app/javascript/alchemy_admin}/node_tree.js +2 -2
- data/{package/src → app/javascript/alchemy_admin}/page_publication_fields.js +1 -1
- data/{package/src → app/javascript/alchemy_admin}/page_sorter.js +1 -1
- data/{package/src → app/javascript/alchemy_admin}/picture_editors.js +2 -2
- data/{package/src → app/javascript/alchemy_admin}/sitemap.js +4 -4
- data/app/javascript/alchemy_admin.js +34 -0
- data/app/models/alchemy/element.rb +5 -4
- data/app/views/alchemy/_menubar.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/_replace_button.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/destroy.js.erb +1 -1
- data/app/views/alchemy/admin/nodes/index.html.erb +4 -2
- data/app/views/alchemy/admin/pages/_page_layout_filter.html.erb +1 -1
- data/app/views/alchemy/admin/pages/edit.html.erb +3 -4
- data/app/views/alchemy/admin/pages/index.html.erb +1 -1
- data/app/views/alchemy/admin/pages/update.js.erb +2 -2
- data/app/views/alchemy/admin/resources/_filter_bar.html.erb +1 -1
- data/app/views/alchemy/admin/styleguide/index.html.erb +1 -1
- data/app/views/alchemy/admin/uploader/_button.html.erb +1 -1
- data/app/views/alchemy/base/permission_denied.js.erb +1 -1
- data/app/views/alchemy/base/redirect.js.erb +1 -1
- data/app/views/alchemy/ingredients/shared/_link_tools.html.erb +0 -1
- data/app/views/alchemy/ingredients/shared/_picture_tools.html.erb +0 -1
- data/app/views/layouts/alchemy/admin.html.erb +4 -8
- data/bin/importmap +4 -0
- data/bin/setup +0 -9
- data/bin/start +1 -1
- data/config/brakeman.ignore +0 -46
- data/config/importmap.rb +8 -0
- data/lib/alchemy/engine.rb +14 -0
- data/lib/alchemy/permissions.rb +4 -4
- data/lib/alchemy/upgrader/seven_point_zero.rb +13 -23
- data/lib/alchemy/upgrader.rb +0 -11
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy.rb +5 -0
- data/lib/alchemy_cms.rb +2 -1
- data/lib/generators/alchemy/install/files/application.html.erb +2 -2
- data/lib/generators/alchemy/install/install_generator.rb +0 -24
- data/lib/tasks/alchemy/upgrade.rake +6 -12
- data/package.json +6 -26
- metadata +44 -29
- data/app/assets/javascripts/alchemy/alchemy.browser.js.coffee +0 -22
- data/app/assets/javascripts/alchemy/alchemy.html5.js +0 -22
- data/package/admin.js +0 -34
- data/package/dist/admin.js +0 -16
- data/package/dist/admin.js.map +0 -7
- data/package/src/__tests__/i18n.spec.js +0 -93
- data/package/src/utils/__tests__/ajax.spec.js +0 -168
- data/package/src/utils/__tests__/events.spec.js +0 -38
- /data/{package/src → app/javascript/alchemy_admin}/datepicker.js +0 -0
- /data/{package/src → app/javascript/alchemy_admin}/file_editors.js +0 -0
- /data/{package/src → app/javascript/alchemy_admin}/i18n.js +0 -0
- /data/{package/src → app/javascript/alchemy_admin}/image_cropper.js +0 -0
- /data/{package/src → app/javascript/alchemy_admin}/image_loader.js +0 -0
- /data/{package/src → app/javascript/alchemy_admin}/ingredient_anchor_link.js +0 -0
- /data/{package/src → app/javascript/alchemy_admin}/tinymce.js +0 -0
- /data/{package/src → app/javascript/alchemy_admin}/translations.js +0 -0
- /data/{package/src → app/javascript/alchemy_admin}/utils/ajax.js +0 -0
- /data/{package/src → app/javascript/alchemy_admin}/utils/events.js +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf26638792221ec3a204abb8ca19d221b16f6548d6d4a4d0cb01434962c90814
|
4
|
+
data.tar.gz: b7ad6adcb58b64e1355fd47d70d7622de73f2fc4016db83b06ffb2631c4fc837
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca9665f36097d622e848dc13a5eda0cdc9061e0ac07a319fca261ecfd8572a6c47d9d0ece22672012935e4a83c66768bdd86509ffe05e61e647806a98ed133a4
|
7
|
+
data.tar.gz: 85740399b154064e2070e87779abc09c2c44e08bb0b0bb119b12962bc038bd6375ca4d962951b32b3369ac535bf4f83aa714d5605ddbfbaf3e8faf46cb42e8fd
|
data/.github/workflows/lint.yml
CHANGED
@@ -3,7 +3,7 @@ name: Lint
|
|
3
3
|
on: [pull_request]
|
4
4
|
|
5
5
|
jobs:
|
6
|
-
|
6
|
+
Standard:
|
7
7
|
runs-on: ubuntu-latest
|
8
8
|
steps:
|
9
9
|
- name: Checkout code
|
@@ -15,3 +15,23 @@ jobs:
|
|
15
15
|
bundler-cache: true
|
16
16
|
- name: Lint Ruby files
|
17
17
|
run: bundle exec standardrb
|
18
|
+
Prettier:
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
steps:
|
21
|
+
- name: Checkout
|
22
|
+
uses: actions/checkout@v3
|
23
|
+
- name: Setup Node
|
24
|
+
uses: actions/setup-node@v3
|
25
|
+
with:
|
26
|
+
node-version: "18"
|
27
|
+
- name: Restore node_modules cache
|
28
|
+
uses: actions/cache@v3
|
29
|
+
with:
|
30
|
+
path: node_modules
|
31
|
+
key: ${{ runner.os }}-node-modules-${{ hashFiles('package.json') }}
|
32
|
+
restore-keys: |
|
33
|
+
${{ runner.os }}-node-modules
|
34
|
+
- name: Install dependencies
|
35
|
+
run: yarn install
|
36
|
+
- name: Lint code
|
37
|
+
run: yarn lint
|
data/.gitignore
CHANGED
@@ -9,15 +9,10 @@ pkg
|
|
9
9
|
tmp
|
10
10
|
log
|
11
11
|
.sass-cache
|
12
|
-
spec/dummy/app/assets/builds/*.js*
|
13
|
-
spec/dummy/app/javascript/
|
14
12
|
spec/dummy/config/alchemy/config.yml
|
15
13
|
spec/dummy/db/*.sqlite3*
|
16
|
-
spec/dummy/package.json
|
17
14
|
spec/dummy/postcss.config.js
|
18
15
|
spec/dummy/public/assets/
|
19
|
-
spec/dummy/public/packs/
|
20
|
-
spec/dummy/public/packs-test/
|
21
16
|
spec/dummy/uploads/
|
22
17
|
.rvmrc
|
23
18
|
/coverage/
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
## 7.0.0 (unreleased)
|
4
4
|
|
5
|
+
- Allow to create element with warning in definition [#2507](https://github.com/AlchemyCMS/alchemy_cms/pull/2507) ([tvdeyen](https://github.com/tvdeyen))
|
6
|
+
- Remove unused javascript [#2506](https://github.com/AlchemyCMS/alchemy_cms/pull/2506) ([sascha-karnatz](https://github.com/sascha-karnatz))
|
7
|
+
- Allow authors to link to all pages again [#2504](https://github.com/AlchemyCMS/alchemy_cms/pull/2504) ([tvdeyen](https://github.com/tvdeyen))
|
8
|
+
- Lint JS code with Prettier [#2503](https://github.com/AlchemyCMS/alchemy_cms/pull/2503) ([tvdeyen](https://github.com/tvdeyen))
|
9
|
+
- Use absolute imports in modules [#2502](https://github.com/AlchemyCMS/alchemy_cms/pull/2502) ([tvdeyen](https://github.com/tvdeyen))
|
10
|
+
- Replace turbolinks with turbo [#2499](https://github.com/AlchemyCMS/alchemy_cms/pull/2499) ([sascha-karnatz](https://github.com/sascha-karnatz))
|
11
|
+
- Use Importmaps for admin JS [#2498](https://github.com/AlchemyCMS/alchemy_cms/pull/2498) ([tvdeyen](https://github.com/tvdeyen))
|
5
12
|
- Fix TinyMCE loading behavior after page change [#2494](https://github.com/AlchemyCMS/alchemy_cms/pull/2494) ([sascha-karnatz](https://github.com/sascha-karnatz))
|
6
13
|
- [js] Update esbuild → 0.18.4 (unknown) [#2492](https://github.com/AlchemyCMS/alchemy_cms/pull/2492) ([depfu](https://github.com/apps/depfu))
|
7
14
|
- Add ransackable attributes to tags [#2487](https://github.com/AlchemyCMS/alchemy_cms/pull/2487) ([tvdeyen](https://github.com/tvdeyen))
|
data/Gemfile
CHANGED
@@ -20,7 +20,6 @@ group :development, :test do
|
|
20
20
|
# in our case the culprit is `handlebars-assets`. The changes between 2.7.0 and 2.8.0 are
|
21
21
|
# minimal, but breaking.
|
22
22
|
gem "execjs", "= 2.8.1"
|
23
|
-
gem "jsbundling-rails", "~> 1.1"
|
24
23
|
gem "rubocop", require: false
|
25
24
|
gem "standard", "~> 1.25", require: false
|
26
25
|
|
data/README.md
CHANGED
@@ -340,7 +340,7 @@ $ bin/start
|
|
340
340
|
|
341
341
|
### Bump version
|
342
342
|
|
343
|
-
Bump the version number in
|
343
|
+
Bump the version number in `lib/alchemy/version.rb`.
|
344
344
|
|
345
345
|
### Update the changelog
|
346
346
|
|
@@ -357,11 +357,11 @@ $ git commit -am "Bump version to vX.Y.Z"
|
|
357
357
|
|
358
358
|
### Release a new version
|
359
359
|
|
360
|
-
This task will publish
|
360
|
+
This task will publish the ruby gem.
|
361
361
|
It also tags the latest commit.
|
362
362
|
|
363
363
|
```bash
|
364
|
-
$ bundle exec rake
|
364
|
+
$ bundle exec rake release
|
365
365
|
```
|
366
366
|
|
367
367
|
## ❓Getting Help
|
data/Rakefile
CHANGED
@@ -41,17 +41,12 @@ namespace :alchemy do
|
|
41
41
|
task :prepare do
|
42
42
|
system(
|
43
43
|
<<~BASH
|
44
|
-
yarn install && \
|
45
|
-
yarn link && \
|
46
44
|
cd spec/dummy && \
|
47
45
|
export RAILS_ENV=test && \
|
48
46
|
bin/rake db:create && \
|
49
47
|
bin/rake db:environment:set && \
|
50
48
|
bin/rake db:migrate:reset && \
|
51
|
-
bin/rails javascript:install:esbuild && \
|
52
49
|
bin/rails g alchemy:install --skip --skip-demo-files --auto-accept --skip-db-create && \
|
53
|
-
yarn link @alchemy_cms/admin && \
|
54
|
-
bin/rails javascript:build && \
|
55
50
|
cd -
|
56
51
|
BASH
|
57
52
|
) || fail
|
@@ -81,18 +76,4 @@ namespace :alchemy do
|
|
81
76
|
File.delete(backup)
|
82
77
|
end
|
83
78
|
end
|
84
|
-
|
85
|
-
desc "Release a new Ruby gem and npm package in one command"
|
86
|
-
task :release do
|
87
|
-
require "json"
|
88
|
-
require_relative "lib/alchemy/version"
|
89
|
-
package = File.read("package.json")
|
90
|
-
unless JSON.parse(package)["version"] == Alchemy.version
|
91
|
-
abort "Ruby gem and npm package versions are out of sync! Please fix."
|
92
|
-
end
|
93
|
-
# Release the Ruby gem with bundler
|
94
|
-
Rake::Task["release"].invoke
|
95
|
-
# Publish npm package via CLI
|
96
|
-
system "npm publish"
|
97
|
-
end
|
98
79
|
end
|
data/alchemy_cms.gemspec
CHANGED
@@ -41,6 +41,7 @@ Gem::Specification.new do |gem|
|
|
41
41
|
gem.add_runtime_dependency "dragonfly_svg", ["~> 0.0.4"]
|
42
42
|
gem.add_runtime_dependency "gutentag", ["~> 2.2", ">= 2.2.1"]
|
43
43
|
gem.add_runtime_dependency "handlebars_assets", ["~> 0.23"]
|
44
|
+
gem.add_runtime_dependency "importmap-rails", ["~> 1.2", ">= 1.2.1"]
|
44
45
|
gem.add_runtime_dependency "jquery-rails", ["~> 4.0", ">= 4.0.4"]
|
45
46
|
gem.add_runtime_dependency "jquery-ui-rails", ["~> 6.0"]
|
46
47
|
gem.add_runtime_dependency "kaminari", ["~> 1.1"]
|
@@ -51,7 +52,7 @@ Gem::Specification.new do |gem|
|
|
51
52
|
gem.add_runtime_dependency "sassc-rails", ["~> 2.1"]
|
52
53
|
gem.add_runtime_dependency "simple_form", [">= 4.0", "< 6"]
|
53
54
|
gem.add_runtime_dependency "sprockets", [">= 3.0", "< 5"]
|
54
|
-
gem.add_runtime_dependency "
|
55
|
+
gem.add_runtime_dependency "turbo-rails", [">= 1.4"]
|
55
56
|
gem.add_runtime_dependency "view_component", ["~> 3.0"]
|
56
57
|
|
57
58
|
gem.add_development_dependency "capybara", ["~> 3.0"]
|
@@ -2,7 +2,6 @@
|
|
2
2
|
// ------------------------------
|
3
3
|
//= require jquery2
|
4
4
|
//= require jquery_ujs
|
5
|
-
//= require turbolinks
|
6
5
|
//= require jquery-ui/effects/effect-fade
|
7
6
|
//= require jquery-ui/widgets/draggable
|
8
7
|
//= require jquery-ui/widgets/sortable
|
@@ -17,7 +16,6 @@
|
|
17
16
|
//= require alchemy/templates
|
18
17
|
//= require alchemy/alchemy.base
|
19
18
|
//= require alchemy/alchemy.autocomplete
|
20
|
-
//= require alchemy/alchemy.browser
|
21
19
|
//= require alchemy/alchemy.buttons
|
22
20
|
//= require alchemy/alchemy.dialog
|
23
21
|
//= require alchemy/alchemy.char_counter
|
@@ -50,25 +50,4 @@ $.extend Alchemy,
|
|
50
50
|
dropdownAutoWidth: true
|
51
51
|
return
|
52
52
|
|
53
|
-
getUrlParam: (name) ->
|
54
|
-
results = new RegExp("[\\?&]" + name + "=([^&#]*)").exec(window.location.href)
|
55
|
-
results[1] or 0 if results
|
56
|
-
return
|
57
|
-
|
58
|
-
isiPhone: navigator.userAgent.match(/iPhone/i) isnt null
|
59
|
-
isiPad: navigator.userAgent.match(/iPad/i) isnt null
|
60
|
-
isiPod: navigator.userAgent.match(/iPod/i) isnt null
|
61
|
-
isiOS: navigator.userAgent.match(/iPad|iPhone|iPod/i) isnt null
|
62
|
-
isFirefox: navigator.userAgent.match(/Firefox/i) isnt null
|
63
|
-
isChrome: navigator.userAgent.match(/Chrome/i) isnt null
|
64
|
-
isSafari: navigator.userAgent.match(/Safari/i) isnt null
|
65
|
-
isIE: navigator.userAgent.match(/MSIE/i) isnt null
|
66
|
-
|
67
|
-
Alchemy.getBrowserVersion = (browser) ->
|
68
|
-
(if Alchemy["is" + browser] then parseInt(navigator.userAgent.match(new RegExp(browser + ".[0-9]+", "i"))[0].replace(new RegExp(browser + "."), ""), 10) else null)
|
69
|
-
return
|
70
53
|
|
71
|
-
Alchemy.ChromeVersion = Alchemy.getBrowserVersion("Chrome")
|
72
|
-
Alchemy.FirefoxVersion = Alchemy.getBrowserVersion("Firefox")
|
73
|
-
Alchemy.SafariVersion = Alchemy.getBrowserVersion("Safari")
|
74
|
-
Alchemy.IEVersion = Alchemy.getBrowserVersion("MSIE")
|
@@ -40,7 +40,7 @@ $.extend Alchemy,
|
|
40
40
|
$form.submit()
|
41
41
|
else if $(element).is("a")
|
42
42
|
callback = ->
|
43
|
-
|
43
|
+
Turbo.visit(element.pathname)
|
44
44
|
if Alchemy.isPageDirty()
|
45
45
|
Alchemy.openConfirmDialog Alchemy.t('page_dirty_notice'),
|
46
46
|
title: Alchemy.t('warning')
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Initialize all onload scripts at once.
|
2
2
|
#
|
3
|
-
# Called at jQuery ready event and
|
3
|
+
# Called at jQuery ready event and Turbo page change event.
|
4
4
|
#
|
5
5
|
Alchemy.Initializer = ->
|
6
6
|
|
@@ -26,13 +26,13 @@ Alchemy.Initializer = ->
|
|
26
26
|
$('select#change_locale').on 'change', (e) ->
|
27
27
|
url = window.location.pathname
|
28
28
|
delimiter = if url.match(/\?/) then '&' else '?'
|
29
|
-
|
29
|
+
Turbo.visit "#{url}#{delimiter}admin_locale=#{$(this).val()}"
|
30
30
|
|
31
31
|
# Site select handler
|
32
32
|
$('select#change_site').on 'change', (e) ->
|
33
33
|
url = window.location.pathname
|
34
34
|
delimiter = if url.match(/\?/) then '&' else '?'
|
35
|
-
|
35
|
+
Turbo.visit "#{url}#{delimiter}site_id=#{$(this).val()}"
|
36
36
|
|
37
37
|
# Submit forms of selects with `data-autosubmit="true"`
|
38
38
|
$('select[data-auto-submit="true"]').on 'change', (e) ->
|
@@ -46,18 +46,11 @@ Alchemy.Initializer = ->
|
|
46
46
|
tagName = (event.target || event.srcElement).tagName
|
47
47
|
key.isPressed('esc') || !(tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA')
|
48
48
|
|
49
|
-
|
50
|
-
Turbolinks.enableProgressBar() if Turbolinks.enableProgressBar
|
51
|
-
|
52
|
-
# Turbolinks DOM Ready.
|
53
|
-
# Handle both v2.5(page:change), and v.5.0 (turbolinks:load)
|
54
|
-
$(document).on 'page:change turbolinks:load', ->
|
49
|
+
$(document).on 'turbo:load', ->
|
55
50
|
Alchemy.Initializer()
|
56
51
|
return
|
57
52
|
|
58
|
-
|
59
|
-
# Handle both v2.5(page:receive), and v.5.0 (turbolinks:request-end)
|
60
|
-
$(document).on 'page:receive turbolinks:request-end', ->
|
53
|
+
$(document).on 'turbo:before-fetch-request', ->
|
61
54
|
# Ensure that all tinymce editors get removed before parsing a new page
|
62
55
|
Alchemy.Tinymce.removeFrom $('.has_tinymce')
|
63
56
|
return
|
@@ -59,17 +59,12 @@ class window.Alchemy.LinkDialog extends Alchemy.Dialog
|
|
59
59
|
initPageSelect: ->
|
60
60
|
pageTemplate = HandlebarsTemplates.page
|
61
61
|
element_anchor_placeholder = @$element_anchor.attr('placeholder')
|
62
|
-
if @link_object.dataset.languageId
|
63
|
-
api_url = "#{Alchemy.routes.api_pages_path}?language_id=#{@link_object.dataset.languageId}"
|
64
|
-
else
|
65
|
-
api_url = Alchemy.routes.api_pages_path
|
66
|
-
|
67
62
|
@$internal_link.select2
|
68
63
|
placeholder: Alchemy.t('Search page')
|
69
64
|
allowClear: true
|
70
65
|
minimumInputLength: 3
|
71
66
|
ajax:
|
72
|
-
url:
|
67
|
+
url: Alchemy.routes.api_pages_path
|
73
68
|
datatype: 'json'
|
74
69
|
quietMillis: 300
|
75
70
|
data: (term, page) ->
|
@@ -8,9 +8,7 @@ module Alchemy
|
|
8
8
|
# Returns all pages as json object
|
9
9
|
#
|
10
10
|
def index
|
11
|
-
language = Alchemy::Language.find_by(id: params[:language_id]) || Alchemy::Language.current
|
12
11
|
@pages = Alchemy::Page.accessible_by(current_ability, :index)
|
13
|
-
@pages = @pages.where(language: language)
|
14
12
|
@pages = @pages.includes(*page_includes)
|
15
13
|
@pages = @pages.ransack(params[:q]).result
|
16
14
|
|
@@ -9,13 +9,6 @@ module Alchemy
|
|
9
9
|
include Alchemy::ControllerActions
|
10
10
|
include Alchemy::Modules
|
11
11
|
|
12
|
-
# Include Turbolinks explicitly in case Alchemy is embedded into a
|
13
|
-
# larger application that doesn't work with Turbolinks. The app
|
14
|
-
# can then set config.turbolinks.auto_include = false so that
|
15
|
-
# Turbolinks is not included in the app controllers.
|
16
|
-
include Turbolinks::Controller
|
17
|
-
::ActionDispatch::Assertions.include ::Turbolinks::Assertions
|
18
|
-
|
19
12
|
protect_from_forgery
|
20
13
|
|
21
14
|
before_action :mailer_set_url_options
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import Sortable from "sortablejs"
|
2
|
-
import { patch } from "
|
3
|
-
import { on } from "
|
2
|
+
import { patch } from "alchemy_admin/utils/ajax"
|
3
|
+
import { on } from "alchemy_admin/utils/events"
|
4
4
|
|
5
5
|
function displayNodeFolders() {
|
6
6
|
document.querySelectorAll("li.menu-item").forEach((el) => {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import debounce from "lodash-es/debounce"
|
2
2
|
import max from "lodash-es/max"
|
3
|
-
import { get } from "
|
4
|
-
import ImageLoader from "
|
3
|
+
import { get } from "alchemy_admin/utils/ajax"
|
4
|
+
import ImageLoader from "alchemy_admin/image_loader"
|
5
5
|
|
6
6
|
const UPDATE_DELAY = 125
|
7
7
|
const IMAGE_PLACEHOLDER = '<i class="icon far fa-image fa-fw"></i>'
|
@@ -1,8 +1,8 @@
|
|
1
1
|
// The admin sitemap Alchemy class
|
2
|
-
import PageSorter from "
|
3
|
-
import { on } from "
|
4
|
-
import { get, patch } from "
|
5
|
-
import { createSortables, displayPageFolders } from "
|
2
|
+
import PageSorter from "alchemy_admin/page_sorter"
|
3
|
+
import { on } from "alchemy_admin/utils/events"
|
4
|
+
import { get, patch } from "alchemy_admin/utils/ajax"
|
5
|
+
import { createSortables, displayPageFolders } from "alchemy_admin/page_sorter"
|
6
6
|
|
7
7
|
export default class Sitemap {
|
8
8
|
// Storing some objects.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import "@hotwired/turbo-rails"
|
2
|
+
|
3
|
+
import translate from "alchemy_admin/i18n"
|
4
|
+
import translationData from "alchemy_admin/translations"
|
5
|
+
import fileEditors from "alchemy_admin/file_editors"
|
6
|
+
import IngredientAnchorLink from "alchemy_admin/ingredient_anchor_link"
|
7
|
+
import pictureEditors from "alchemy_admin/picture_editors"
|
8
|
+
import ImageLoader from "alchemy_admin/image_loader"
|
9
|
+
import ImageCropper from "alchemy_admin/image_cropper"
|
10
|
+
import Datepicker from "alchemy_admin/datepicker"
|
11
|
+
import Sitemap from "alchemy_admin/sitemap"
|
12
|
+
import Tinymce from "alchemy_admin/tinymce"
|
13
|
+
import PagePublicationFields from "alchemy_admin/page_publication_fields"
|
14
|
+
|
15
|
+
// Global Alchemy object
|
16
|
+
if (typeof window.Alchemy === "undefined") {
|
17
|
+
window.Alchemy = {}
|
18
|
+
}
|
19
|
+
|
20
|
+
// Enhance the global Alchemy object with imported features
|
21
|
+
Object.assign(Alchemy, {
|
22
|
+
// Global utility method for translating a given string
|
23
|
+
t: translate,
|
24
|
+
translations: Object.assign(Alchemy.translations || {}, translationData),
|
25
|
+
fileEditors,
|
26
|
+
pictureEditors,
|
27
|
+
ImageLoader: ImageLoader.init,
|
28
|
+
ImageCropper,
|
29
|
+
IngredientAnchorLink,
|
30
|
+
Datepicker,
|
31
|
+
Sitemap,
|
32
|
+
Tinymce,
|
33
|
+
PagePublicationFields
|
34
|
+
})
|
@@ -35,13 +35,14 @@ module Alchemy
|
|
35
35
|
FORBIDDEN_DEFINITION_ATTRIBUTES = [
|
36
36
|
"amount",
|
37
37
|
"autogenerate",
|
38
|
-
"
|
38
|
+
"compact",
|
39
|
+
"deprecated",
|
39
40
|
"hint",
|
40
41
|
"ingredients",
|
41
|
-
"taggable",
|
42
|
-
"compact",
|
43
42
|
"message",
|
44
|
-
"
|
43
|
+
"nestable_elements",
|
44
|
+
"taggable",
|
45
|
+
"warning"
|
45
46
|
].freeze
|
46
47
|
|
47
48
|
# All Elements that share the same page version and parent element and are fixed or not are considered a list.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% if !@preview_mode && @page && can?(:edit_content, @page) %>
|
2
|
-
<div id="alchemy_menubar" style="display: none" data-
|
2
|
+
<div id="alchemy_menubar" style="display: none" data-turbo="false">
|
3
3
|
<ul>
|
4
4
|
<li><%= link_to Alchemy.t(:to_alchemy), alchemy.admin_dashboard_url %></li>
|
5
5
|
<li><%= link_to Alchemy.t(:edit_page), alchemy.edit_admin_page_url(@page) %></li>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
selector: '#replace_<%= dom_id(object) %>',
|
18
18
|
file_types: '<%= file_types.join("|") %>',
|
19
19
|
complete: function() {
|
20
|
-
|
20
|
+
Turbo.visit('<%= redirect_url.html_safe %>');
|
21
21
|
}
|
22
22
|
};
|
23
23
|
Alchemy.Uploader(options);
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Turbo.visit('<%= @url %>');
|
@@ -23,7 +23,7 @@
|
|
23
23
|
$("#page_layout").on("change", function(e) {
|
24
24
|
var url = "<%= alchemy.admin_pages_path(search_filter_params.except(:page_layout, :page).merge(view: "list")) %>";
|
25
25
|
delimiter = url.match(/\?/) ? "&" : "?";
|
26
|
-
|
26
|
+
Turbo.visit(url + delimiter + "page_layout=" + encodeURIComponent($(this).val()));
|
27
27
|
});
|
28
28
|
});
|
29
29
|
</script>
|
@@ -81,7 +81,7 @@
|
|
81
81
|
host: @page.site.host == "*" ? request.host : @page.site.host,
|
82
82
|
),
|
83
83
|
title: Alchemy.t("Visit page"),
|
84
|
-
data: {
|
84
|
+
data: { turbo: false },
|
85
85
|
target: "_blank",
|
86
86
|
class: 'icon_button' do %>
|
87
87
|
<%= render_icon('external-link-alt') %>
|
@@ -140,12 +140,11 @@
|
|
140
140
|
<% content_for :javascripts do %>
|
141
141
|
|
142
142
|
<% content_for :javascript_includes do %>
|
143
|
-
<meta name="
|
143
|
+
<meta name="turbo-cache-control" content="no-cache">
|
144
144
|
<% end %>
|
145
145
|
|
146
146
|
<script type="text/javascript" charset="utf-8">
|
147
|
-
|
148
|
-
$(function() {
|
147
|
+
$(document).one('turbo:load', function() {
|
149
148
|
$('#unlock_page_form, #publish_page_form').on('submit', function(event) {
|
150
149
|
var not_dirty = Alchemy.checkPageDirtyness(this);
|
151
150
|
if (!not_dirty) Alchemy.pleaseWaitOverlay(false);
|
@@ -31,11 +31,11 @@
|
|
31
31
|
Alchemy.growl("<%= j @notice %>");
|
32
32
|
Alchemy.closeCurrentDialog();
|
33
33
|
} else {
|
34
|
-
document.addEventListener('
|
34
|
+
document.addEventListener('turbo:load', function () {
|
35
35
|
Alchemy.growl("<%= j @notice %>");
|
36
36
|
}, { once: true })
|
37
37
|
Alchemy.closeCurrentDialog(function() {
|
38
|
-
|
38
|
+
Turbo.visit(location.toString(), { action: "replace" });
|
39
39
|
});
|
40
40
|
}
|
41
41
|
|
@@ -5,7 +5,6 @@
|
|
5
5
|
onclick: 'new Alchemy.LinkDialog(this).open(); return false;',
|
6
6
|
class: "icon_button#{ingredient_editor.linked? ? ' linked' : ''} link-ingredient",
|
7
7
|
"data-parent-selector": "[data-ingredient-id='#{ingredient_editor.id}']",
|
8
|
-
"data-language-id": ingredient_editor.page&.language_id,
|
9
8
|
title: Alchemy.t(:place_link),
|
10
9
|
id: "edit_link_#{ingredient_editor.id}"
|
11
10
|
) %>
|
@@ -34,7 +34,6 @@
|
|
34
34
|
class: picture_editor.linked? ? "linked" : nil,
|
35
35
|
title: Alchemy.t(:link_image),
|
36
36
|
"data-parent-selector": "[data-ingredient-id='#{picture_editor.id}']",
|
37
|
-
"data-language-id": picture_editor.page&.language_id,
|
38
37
|
id: "edit_link_#{picture_editor.id}"
|
39
38
|
} do %>
|
40
39
|
<span class="disabled" tabindex="-1"><%= render_icon(:link) %></span>
|
@@ -7,8 +7,8 @@
|
|
7
7
|
<link rel="shortcut icon" href="<%= asset_path('alchemy/favicon.ico') %>">
|
8
8
|
<%= csrf_meta_tag %>
|
9
9
|
<meta name="robots" content="noindex">
|
10
|
-
<%= stylesheet_link_tag('alchemy/admin/all', media: 'screen', 'data-
|
11
|
-
<%= stylesheet_link_tag('alchemy/print', media: 'print', 'data-
|
10
|
+
<%= stylesheet_link_tag('alchemy/admin/all', media: 'screen', 'data-turbo-track' => true) %>
|
11
|
+
<%= stylesheet_link_tag('alchemy/print', media: 'print', 'data-turbo-track' => true) %>
|
12
12
|
<%= yield :stylesheets %>
|
13
13
|
<script>
|
14
14
|
// Global Alchemy JavaScript object.
|
@@ -33,12 +33,8 @@
|
|
33
33
|
};
|
34
34
|
</script>
|
35
35
|
<%= render 'alchemy/admin/partials/routes' %>
|
36
|
-
<%= javascript_include_tag('alchemy/admin/all', 'data-
|
37
|
-
|
38
|
-
<%= javascript_pack_tag('alchemy/admin', 'data-turbolinks-track' => true) %>
|
39
|
-
<% else %>
|
40
|
-
<%= javascript_include_tag('alchemy_admin', 'data-turbolinks-track' => true) %>
|
41
|
-
<% end %>
|
36
|
+
<%= javascript_include_tag('alchemy/admin/all', 'data-turbo-track' => true) %>
|
37
|
+
<%= javascript_importmap_tags("alchemy_admin", importmap: Alchemy.importmap) %>
|
42
38
|
<%= yield :javascript_includes %>
|
43
39
|
</head>
|
44
40
|
<%= content_tag :body, id: 'alchemy', class: alchemy_body_class do %>
|
data/bin/importmap
ADDED