alchemy_cms 6.0.0.pre.rc4 → 6.0.0.pre.rc7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +8 -15
  3. data/.github/workflows/stale.yml +21 -7
  4. data/.gitignore +0 -1
  5. data/.rspec +1 -0
  6. data/CHANGELOG.md +87 -0
  7. data/Gemfile +7 -6
  8. data/Rakefile +5 -1
  9. data/alchemy_cms.gemspec +2 -2
  10. data/app/assets/javascripts/alchemy/admin.js +0 -2
  11. data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +6 -1
  12. data/app/assets/javascripts/alchemy/page_select.js +13 -8
  13. data/app/assets/javascripts/alchemy/templates/index.js +1 -0
  14. data/app/assets/javascripts/alchemy/templates/page.hbs +17 -7
  15. data/app/assets/javascripts/alchemy/templates/page_folder.hbs +3 -0
  16. data/app/assets/stylesheets/alchemy/archive.scss +4 -0
  17. data/app/assets/stylesheets/alchemy/page-select.scss +29 -4
  18. data/app/assets/stylesheets/alchemy/sitemap.scss +9 -7
  19. data/app/controllers/alchemy/admin/pages_controller.rb +10 -15
  20. data/app/controllers/alchemy/api/pages_controller.rb +14 -4
  21. data/app/models/alchemy/ingredient.rb +6 -1
  22. data/app/models/alchemy/page.rb +9 -3
  23. data/app/serializers/alchemy/page_serializer.rb +7 -1
  24. data/app/serializers/alchemy/page_tree_serializer.rb +3 -3
  25. data/app/services/alchemy/tag_validations.rb +21 -0
  26. data/app/views/alchemy/admin/pages/_form.html.erb +19 -0
  27. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +16 -5
  28. data/app/views/alchemy/admin/pages/_page.html.erb +111 -133
  29. data/app/views/alchemy/admin/pages/_sitemap.html.erb +10 -16
  30. data/app/views/alchemy/admin/pages/_toolbar.html.erb +0 -12
  31. data/app/views/alchemy/admin/pages/edit.html.erb +1 -1
  32. data/app/views/alchemy/admin/pages/index.html.erb +1 -1
  33. data/app/views/alchemy/admin/pages/update.js.erb +7 -5
  34. data/app/views/alchemy/admin/partials/_routes.html.erb +8 -1
  35. data/app/views/alchemy/essences/_essence_page_editor.html.erb +1 -1
  36. data/config/locales/alchemy.en.yml +0 -4
  37. data/config/routes.rb +4 -3
  38. data/db/migrate/20200226213334_alchemy_four_point_four.rb +30 -30
  39. data/db/migrate/20200423073425_create_alchemy_essence_nodes.rb +1 -1
  40. data/db/migrate/20200504210159_remove_site_id_from_nodes.rb +1 -1
  41. data/db/migrate/20200505215518_add_language_id_foreign_key_to_alchemy_pages.rb +1 -1
  42. data/db/migrate/20200511113603_add_menu_type_to_alchemy_nodes.rb +1 -1
  43. data/db/migrate/20200514091507_make_page_layoutpage_null_false.rb +1 -1
  44. data/db/migrate/20200519073500_remove_visible_from_alchemy_pages.rb +1 -1
  45. data/db/migrate/20200617110713_create_alchemy_picture_thumbs.rb +1 -1
  46. data/db/migrate/20200907111332_remove_tri_state_booleans.rb +1 -1
  47. data/db/migrate/20201207131309_create_page_versions.rb +1 -1
  48. data/db/migrate/20201207135820_add_page_version_id_to_alchemy_elements.rb +1 -1
  49. data/lib/alchemy/engine.rb +5 -11
  50. data/lib/alchemy/permissions.rb +0 -1
  51. data/lib/alchemy/test_support/shared_ingredient_examples.rb +4 -2
  52. data/lib/alchemy/version.rb +1 -1
  53. data/lib/generators/alchemy/install/install_generator.rb +6 -1
  54. data/package/admin.js +5 -1
  55. data/package/src/image_loader.js +4 -2
  56. data/package/src/node_tree.js +13 -6
  57. data/package/src/page_publication_fields.js +28 -0
  58. data/package/src/page_sorter.js +62 -0
  59. data/package/src/picture_editors.js +4 -4
  60. data/package/src/sitemap.js +148 -0
  61. data/package/src/utils/__tests__/ajax.spec.js +52 -16
  62. data/package/src/utils/ajax.js +12 -0
  63. data/package.json +1 -1
  64. metadata +24 -24
  65. data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +0 -24
  66. data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +0 -119
  67. data/app/views/alchemy/admin/pages/fold.js.erb +0 -2
  68. data/app/views/alchemy/admin/pages/sort.html.erb +0 -19
  69. data/lib/alchemy/error_tracking/airbrake_handler.rb +0 -13
  70. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js +0 -434
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da8076b5e01533899e6c3003841940160335389c6e8a961bedec1b08839f61ba
4
- data.tar.gz: dfcd49629458243d86cb4bb49615da876b3e5bfb1b69de121f90fe6e98bb964c
3
+ metadata.gz: d81ddf40cd98c283ac6b58332e03e6ed4094de86671f0dc80692a0de5c8292ea
4
+ data.tar.gz: 1115141343d2e2310001c8ee1e58f9d8070a4c34c770226f9647a6fa09f05d7d
5
5
  SHA512:
6
- metadata.gz: a25f6e26595f7b7e218200a0a7dbc1e69ac175c1daa3736b443501f80c8f1012215c69ab2f17addeb61b397cb3288b018b87f8e175d1ec9c1399e38101018d7f
7
- data.tar.gz: 1c8cee2a1c08c70581945e25dc0745ba9bf2dea83e44220e00a096fce531df941bea97405836dcc4cf650ede4e12162e7ab6b9dc18a8e297f4ac6f71a18643d6
6
+ metadata.gz: f80e8e421037e50315254799456626f6b82ee4f30922d30920b2cec73ee7783a85fccf74b1a66a9a310fc2ca668844ad4d0daaa0b03ecca77cb4f4a1bb28c1e4
7
+ data.tar.gz: 2898baf39517e918cfdf0b99f6d79ad61836e74083922e2c496dcebb539c057ea558b03040578eba16040313bff647d0dbdb6a27221cbdfd8b1c7e8a7e69e395
@@ -9,12 +9,12 @@ jobs:
9
9
  fail-fast: false
10
10
  matrix:
11
11
  rails:
12
- - '6.0'
13
- - '6.1'
12
+ - "6.0"
13
+ - "6.1"
14
14
  ruby:
15
- - '2.6.8'
16
- - '2.7.4'
17
- - '3.0.2'
15
+ - "2.6"
16
+ - "2.7"
17
+ - "3.0"
18
18
  database:
19
19
  - mysql
20
20
  - postgresql
@@ -22,7 +22,7 @@ jobs:
22
22
  DB: ${{ matrix.database }}
23
23
  DB_USER: alchemy_user
24
24
  DB_PASSWORD: password
25
- DB_HOST: '127.0.0.1'
25
+ DB_HOST: "127.0.0.1"
26
26
  RAILS_ENV: test
27
27
  RAILS_VERSION: ${{ matrix.rails }}
28
28
  services:
@@ -32,11 +32,11 @@ jobs:
32
32
  POSTGRES_USER: alchemy_user
33
33
  POSTGRES_PASSWORD: password
34
34
  POSTGRES_DB: alchemy_cms_dummy_test
35
- ports: ['5432:5432']
35
+ ports: ["5432:5432"]
36
36
  options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
37
37
  mysql:
38
38
  image: mysql:latest
39
- ports: ['3306:3306']
39
+ ports: ["3306:3306"]
40
40
  env:
41
41
  MYSQL_USER: alchemy_user
42
42
  MYSQL_PASSWORD: password
@@ -72,13 +72,6 @@ jobs:
72
72
  sudo apt update -qq
73
73
  sudo apt install -qq --fix-missing libmysqlclient-dev -o dir::cache::archives="/home/runner/apt/cache"
74
74
  sudo chown -R runner /home/runner/apt/cache
75
- - name: Install bundler
76
- run: |
77
- gem install bundler
78
- - name: Install bundle
79
- timeout-minutes: 10
80
- run: |
81
- bundle install --jobs 4 --retry 3
82
75
  - name: Restore node modules cache
83
76
  id: yarn-cache
84
77
  uses: actions/cache@v2.1.3
@@ -2,16 +2,30 @@ name: Mark stale issues and pull requests
2
2
 
3
3
  on:
4
4
  schedule:
5
- - cron: "0 0 * * *"
5
+ - cron: "0 0 * * *"
6
6
 
7
7
  jobs:
8
8
  stale:
9
-
10
9
  runs-on: ubuntu-latest
11
10
 
12
11
  steps:
13
- - uses: actions/stale@v1
14
- with:
15
- repo-token: ${{ secrets.GITHUB_TOKEN }}
16
- stale-issue-message: 'This issue has not seen any activity in a long time. If the issue described still exists in recent versions of Alchemy, please open a new issue or preferably open a PR with a fix. Thanks for reporting.'
17
- stale-pr-message: 'This pull request has not seen any activiy in a long time. Probably because of missing tests or a necessary rebase. Please open a new PR to latest main if you want to continue working on this. Thanks for the contribution.'
12
+ - uses: actions/stale@v5
13
+ with:
14
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
15
+ stale-issue-message: |
16
+ This issue has not seen any activity in a long time.
17
+ Please create a pull request with a fix or ask someone of the community if they can help.
18
+ This issue will be closed in 7 days if no further activity happens.
19
+ close-issue-message: |
20
+ This issue has not seen any activity in a long time.
21
+ If the issue described still exists in recent versions of Alchemy,
22
+ please open a new issue with. Thanks for reporting.
23
+ stale-pr-message: |
24
+ This pull request has not seen any activiy in a long time.
25
+ Probably because of missing tests or a necessary rebase.
26
+ This PR will be closed in 7 days if no further activity happens.
27
+ close-pr-message: |
28
+ This pull request has not seen any activiy in a long time.
29
+ Probably because of missing tests or a necessary rebase.
30
+ Please open a new PR to latest main if you want to continue working on this.
31
+ Thanks for the contribution.
data/.gitignore CHANGED
@@ -33,7 +33,6 @@ spec/dummy/uploads/
33
33
  .ruby-gemset
34
34
  .ruby-version
35
35
  .env
36
- .rspec
37
36
  node_modules
38
37
  yarn-error.log
39
38
  yarn-debug.log*
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/CHANGELOG.md CHANGED
@@ -1,3 +1,44 @@
1
+ ## 6.0.0-rc7 (2022-03-28)
2
+
3
+ - fix(Sitemap): Use response data [#2272](https://github.com/AlchemyCMS/alchemy_cms/pull/2272) ([tvdeyen](https://github.com/tvdeyen))
4
+ - Revert "Ajax: Send method override" [#2271](https://github.com/AlchemyCMS/alchemy_cms/pull/2271) ([tvdeyen](https://github.com/tvdeyen))
5
+ - ImageLoader: Add error handling [#2270](https://github.com/AlchemyCMS/alchemy_cms/pull/2270) ([tvdeyen](https://github.com/tvdeyen))
6
+ - Check presence of page_public checkbox [#2269](https://github.com/AlchemyCMS/alchemy_cms/pull/2269) ([afdev82](https://github.com/afdev82))
7
+ - Use lodash-es instead of lodash [#2268](https://github.com/AlchemyCMS/alchemy_cms/pull/2268) ([afdev82](https://github.com/afdev82))
8
+ - CI: Update stale workflow [#2267](https://github.com/AlchemyCMS/alchemy_cms/pull/2267) ([tvdeyen](https://github.com/tvdeyen))
9
+ - Allow to skip db:create during install task [#2266](https://github.com/AlchemyCMS/alchemy_cms/pull/2266) ([tvdeyen](https://github.com/tvdeyen))
10
+ - CI: Fix mysql builds [#2263](https://github.com/AlchemyCMS/alchemy_cms/pull/2263) ([tvdeyen](https://github.com/tvdeyen))
11
+ - Fix new Sitemap [#2262](https://github.com/AlchemyCMS/alchemy_cms/pull/2262) ([tvdeyen](https://github.com/tvdeyen))
12
+ - [ruby - main] Allow ransack version 2.6.0 [#2259](https://github.com/AlchemyCMS/alchemy_cms/pull/2259) ([depfu](https://github.com/apps/depfu))
13
+ - Allow all pages in API again [#2258](https://github.com/AlchemyCMS/alchemy_cms/pull/2258) ([tvdeyen](https://github.com/tvdeyen))
14
+ - Fix setting default value of ingredients [#2257](https://github.com/AlchemyCMS/alchemy_cms/pull/2257) ([tvdeyen](https://github.com/tvdeyen))
15
+ - Eager load in PageTree serializer [#2256](https://github.com/AlchemyCMS/alchemy_cms/pull/2256) ([tvdeyen](https://github.com/tvdeyen))
16
+ - Revert "Merge pull request #2203 from tvdeyen/switch-to-cuprite" [#2255](https://github.com/AlchemyCMS/alchemy_cms/pull/2255) ([tvdeyen](https://github.com/tvdeyen))
17
+ - [js] New version of flatpickr (4.6.10) broke the build [#2254](https://github.com/AlchemyCMS/alchemy_cms/pull/2254) ([depfu](https://github.com/apps/depfu))
18
+ - New sortable page tree [#2252](https://github.com/AlchemyCMS/alchemy_cms/pull/2252) ([tvdeyen](https://github.com/tvdeyen))
19
+ - Use minor versions for ruby version matrix [#2251](https://github.com/AlchemyCMS/alchemy_cms/pull/2251) ([tvdeyen](https://github.com/tvdeyen))
20
+ - Precompile packs during test setup [#2250](https://github.com/AlchemyCMS/alchemy_cms/pull/2250) ([tvdeyen](https://github.com/tvdeyen))
21
+ - Allow parent page change [#2246](https://github.com/AlchemyCMS/alchemy_cms/pull/2246) ([tvdeyen](https://github.com/tvdeyen))
22
+ - Send language_id to Api::PagesController#index so Pages can be restricted to the language of the page [#2245](https://github.com/AlchemyCMS/alchemy_cms/pull/2245) ([dbwinger](https://github.com/dbwinger))
23
+
24
+ ## 6.0.0-rc6 (2022-03-05)
25
+
26
+ - Rework sitemap JS [#2249](https://github.com/AlchemyCMS/alchemy_cms/pull/2249) ([tvdeyen](https://github.com/tvdeyen))
27
+ - Remove old page layout change code from update action [#2248](https://github.com/AlchemyCMS/alchemy_cms/pull/2248) ([tvdeyen](https://github.com/tvdeyen))
28
+ - Fix rendering errors in page configure overlay [#2247](https://github.com/AlchemyCMS/alchemy_cms/pull/2247) ([tvdeyen](https://github.com/tvdeyen))
29
+ - Fix copying page with descendants to a different language [#2243](https://github.com/AlchemyCMS/alchemy_cms/pull/2243) ([dbwinger](https://github.com/dbwinger))
30
+ - Handle copying/pasting global pages [#2241](https://github.com/AlchemyCMS/alchemy_cms/pull/2241) ([dbwinger](https://github.com/dbwinger))
31
+
32
+ ## 6.0.0-rc5 (2022-02-24)
33
+
34
+ ### Changes
35
+
36
+ - Change database version to 6.0 [#2239](https://github.com/AlchemyCMS/alchemy_cms/pull/2239) ([tvdeyen](https://github.com/tvdeyen))
37
+ - Remove unused route [#2238](https://github.com/AlchemyCMS/alchemy_cms/pull/2238) ([phantomwhale](https://github.com/phantomwhale))
38
+ - Add custom gutentag tag validations class [#2232](https://github.com/AlchemyCMS/alchemy_cms/pull/2232) ([tvdeyen](https://github.com/tvdeyen))
39
+ - Touch nodes and all ancestors on page update [#2226](https://github.com/AlchemyCMS/alchemy_cms/pull/2226) ([tvdeyen](https://github.com/tvdeyen))
40
+ - Extract Airbrake error handler into extension [#2221](https://github.com/AlchemyCMS/alchemy_cms/pull/2221) ([tvdeyen](https://github.com/tvdeyen))
41
+
1
42
  ## 6.0.0-rc4 (2022-01-16)
2
43
 
3
44
  ### Changes
@@ -171,6 +212,52 @@
171
212
  - Fix delete element confirm dialog [#2023](https://github.com/AlchemyCMS/alchemy_cms/pull/2023) ([tvdeyen](https://github.com/tvdeyen))
172
213
  - Build for Ruby 3 [#1990](https://github.com/AlchemyCMS/alchemy_cms/pull/1990) ([tvdeyen](https://github.com/tvdeyen))
173
214
 
215
+ ## 5.2.7 (2022-03-01)
216
+
217
+ - Fix copying page with descendants to a different language ([dbwinger](https://github.com/dbwinger))
218
+ - Handle copying/pasting global pages ([dbwinger](https://github.com/dbwinger))
219
+
220
+ ## 5.2.6 (2022-02-28)
221
+
222
+ - Add crop_resize Dragonfly processor ([tvdeyen](https://github.com/tvdeyen))
223
+
224
+ ## 5.2.5 (2021-11-24)
225
+
226
+ - Adjust tinymce skin assets urls again ([tvdeyen](https://github.com/tvdeyen))
227
+
228
+ ## 5.2.4 (2021-11-17)
229
+
230
+ - Set stampable user_class_name without root identifier ([tvdeyen](https://github.com/tvdeyen))
231
+ - Use relative path for tinymce font-face ([tvdeyen](https://github.com/tvdeyen))
232
+
233
+ ## 5.2.3 (2021-10-26)
234
+
235
+ - Make sure to install correct npm package ([tvdeyen](https://github.com/tvdeyen))
236
+
237
+ ## 5.2.2 (2021-09-15)
238
+
239
+ - Return only pages from current site in api [#2169](https://github.com/AlchemyCMS/alchemy_cms/pull/2169) ([afdev82](https://github.com/afdev82))
240
+ - Improve cache key defaults for menus #2138 [#2160](https://github.com/AlchemyCMS/alchemy_cms/pull/2160) ([oneiros](https://github.com/oneiros))
241
+ - generate picture thumbnails only for pictures with convertible format [#2130](https://github.com/AlchemyCMS/alchemy_cms/pull/2130) ([afdev82](https://github.com/afdev82))
242
+ - Backport #2114 to v5.2 [#2116](https://github.com/AlchemyCMS/alchemy_cms/pull/2116) ([afdev82](https://github.com/afdev82))
243
+ - Add webpacker tasks to Alchemy upgrader [#2115](https://github.com/AlchemyCMS/alchemy_cms/pull/2115) ([dbwinger](https://github.com/dbwinger))
244
+
245
+ ## 5.2.1 (2021-05-13)
246
+
247
+ - Fix alchemy:generate:thumbnails task [#2092](https://github.com/AlchemyCMS/alchemy_cms/pull/2092) ([afdev82](https://github.com/afdev82))
248
+ - Do not attempt to generate thumbs for svg files. [#2090](https://github.com/AlchemyCMS/alchemy_cms/pull/2090) ([oneiros](https://github.com/oneiros))
249
+
250
+ ## 5.2.0 (2021-05-06)
251
+
252
+ - Backport #2049 to 5.2 [#2086](https://github.com/AlchemyCMS/alchemy_cms/pull/2086) ([rickythefox](https://github.com/rickythefox))
253
+ - hotfix and deprecate page_active? helper [#2073](https://github.com/AlchemyCMS/alchemy_cms/pull/2073) ([robinboening](https://github.com/robinboening))
254
+
255
+ ## 5.2.0.rc1 (2021-02-17)
256
+
257
+ ### Changes
258
+
259
+ - Change Factory loading mechanism to FactoryBots supported mechanism [#2030](https://github.com/AlchemyCMS/alchemy_cms/pull/2030) ([mamhoff](https://github.com/mamhoff))
260
+
174
261
  ## 5.2.0.b1 (2021-02-11)
175
262
 
176
263
  ### Features
data/Gemfile CHANGED
@@ -4,7 +4,13 @@ source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  rails_version = ENV.fetch("RAILS_VERSION", 6.1).to_f
7
- gem "rails", "~> #{rails_version}.0"
7
+ # Necessary until a new 6.1.5 version has been released
8
+ # https://github.com/rails/rails/pull/44691
9
+ if rails_version.to_s.match?(/6.1/)
10
+ gem "rails", git: "https://github.com/rails/rails", branch: "6-1-stable"
11
+ else
12
+ gem "rails", "~> #{rails_version}.0"
13
+ end
8
14
 
9
15
  if ENV["DB"].nil? || ENV["DB"] == "sqlite"
10
16
  gem "sqlite3", "~> 1.4.1"
@@ -40,8 +46,3 @@ group :development, :test do
40
46
  gem "brakeman", require: false
41
47
  end
42
48
  end
43
-
44
- # Necessary for system tests in Rails 6.0
45
- if ENV["RAILS_VERSION"] == "6.0"
46
- gem "selenium-webdriver"
47
- end
data/Rakefile CHANGED
@@ -41,12 +41,16 @@ namespace :alchemy do
41
41
  task :prepare do
42
42
  system(
43
43
  <<~BASH
44
+ yarn install && \
45
+ yarn link && \
44
46
  cd spec/dummy && \
45
47
  export RAILS_ENV=test && \
46
48
  bin/rake db:create && \
47
49
  bin/rake db:environment:set && \
48
50
  bin/rake db:migrate:reset && \
49
- bin/rails g alchemy:install --skip --skip-demo-files --auto-accept && \
51
+ bin/rails g alchemy:install --skip --skip-demo-files --auto-accept --skip-db-create && \
52
+ yarn link @alchemy_cms/admin && \
53
+ RAILS_ENV=test bin/webpack && \
50
54
  cd -
51
55
  BASH
52
56
  ) || fail
data/alchemy_cms.gemspec CHANGED
@@ -46,7 +46,7 @@ Gem::Specification.new do |gem|
46
46
  gem.add_runtime_dependency "kaminari", ["~> 1.1"]
47
47
  gem.add_runtime_dependency "originator", ["~> 3.1"]
48
48
  gem.add_runtime_dependency "non-stupid-digest-assets", ["~> 1.0.8"]
49
- gem.add_runtime_dependency "ransack", [">= 1.8", "<= 2.5.0"] # 2.4.2 dropped Ruby 2.5 support in a patch level release
49
+ gem.add_runtime_dependency "ransack", [">= 1.8", "<= 2.6.0"] # 2.4.2 dropped Ruby 2.5 support in a patch level release
50
50
  gem.add_runtime_dependency "request_store", ["~> 1.2"]
51
51
  gem.add_runtime_dependency "responders", [">= 2.0", "< 4.0"]
52
52
  gem.add_runtime_dependency "sassc-rails", ["~> 2.1"]
@@ -57,13 +57,13 @@ Gem::Specification.new do |gem|
57
57
 
58
58
  gem.add_development_dependency "capybara", ["~> 3.0"]
59
59
  gem.add_development_dependency "capybara-screenshot", ["~> 1.0"]
60
- gem.add_development_dependency "cuprite", ["~> 0.13"]
61
60
  gem.add_development_dependency "factory_bot_rails", ["~> 6.0"]
62
61
  gem.add_development_dependency "puma", ["~> 5.0"]
63
62
  gem.add_development_dependency "rails-controller-testing", ["~> 1.0"]
64
63
  gem.add_development_dependency "rspec-activemodel-mocks", ["~> 1.0"]
65
64
  gem.add_development_dependency "rspec-rails", [">= 4.0.0.beta2"]
66
65
  gem.add_development_dependency "simplecov", ["~> 0.20"]
66
+ gem.add_development_dependency "webdrivers", ["~> 5.0"]
67
67
  gem.add_development_dependency "webmock", ["~> 3.3"]
68
68
  gem.add_development_dependency "shoulda-matchers", ["~> 5.0"]
69
69
  gem.add_development_dependency "timecop", ["~> 0.9"]
@@ -35,10 +35,8 @@
35
35
  //= require alchemy/alchemy.link_dialog
36
36
  //= require alchemy/alchemy.list_filter
37
37
  //= require alchemy/alchemy.initializer
38
- //= require alchemy/alchemy.page_sorter
39
38
  //= require alchemy/alchemy.uploader
40
39
  //= require alchemy/alchemy.preview_window
41
- //= require alchemy/alchemy.sitemap
42
40
  //= require alchemy/alchemy.spinner
43
41
  //= require alchemy/alchemy.tinymce
44
42
  //= require alchemy/alchemy.tooltips
@@ -82,7 +82,12 @@ class window.Alchemy.Dialog
82
82
  @dialog_body.hide()
83
83
  @dialog_body.html(data)
84
84
  @init()
85
- @dialog.trigger('DialogReady.Alchemy', @dialog_body)
85
+ @dialog[0].dispatchEvent(new CustomEvent(
86
+ "DialogReady.Alchemy",
87
+ bubbles: true
88
+ detail:
89
+ body: @dialog_body[0]
90
+ ))
86
91
  if @options.ready?
87
92
  @options.ready(@dialog_body)
88
93
  @dialog_body.show('fade', 200)
@@ -1,9 +1,11 @@
1
- $.fn.alchemyPageSelect = function(options) {
1
+ $.fn.alchemyPageSelect = function (options) {
2
2
  var pageTemplate = HandlebarsTemplates.page
3
3
 
4
4
  return this.select2({
5
5
  placeholder: options.placeholder,
6
- allowClear: true,
6
+ allowClear: options.hasOwnProperty("allowClear")
7
+ ? options.allowClear
8
+ : true,
7
9
  minimumInputLength: 3,
8
10
  initSelection: function (_$el, callback) {
9
11
  if (options.initialSelection) {
@@ -12,13 +14,16 @@ $.fn.alchemyPageSelect = function(options) {
12
14
  },
13
15
  ajax: {
14
16
  url: options.url,
15
- datatype: 'json',
17
+ datatype: "json",
16
18
  quietMillis: 300,
17
19
  data: function (term, page) {
18
20
  return {
19
- q: $.extend({
20
- name_cont: term
21
- }, options.query_params),
21
+ q: $.extend(
22
+ {
23
+ name_cont: term
24
+ },
25
+ options.query_params
26
+ ),
22
27
  page: page
23
28
  }
24
29
  },
@@ -34,8 +39,8 @@ $.fn.alchemyPageSelect = function(options) {
34
39
  formatSelection: function (page) {
35
40
  return page.text || page.name
36
41
  },
37
- formatResult: function(page) {
38
- return pageTemplate({page: page})
42
+ formatResult: function (page) {
43
+ return pageTemplate({ page: page })
39
44
  }
40
45
  })
41
46
  }
@@ -2,3 +2,4 @@
2
2
  //= require alchemy/templates/page
3
3
  //= require alchemy/templates/node_folder
4
4
  //= require alchemy/templates/node
5
+ //= require alchemy/templates/page_folder
@@ -1,9 +1,19 @@
1
1
  <div class="page-select--page">
2
- <i class="icon far fa-file fa-lg"></i>
3
- <span class="page-select--page-name">
4
- {{ page.name }}
5
- </span>
6
- <span class="page-select--page-urlname">
7
- {{ page.url_path }}
8
- </span>
2
+ <div class="page-select--top">
3
+ <i class="icon far fa-file fa-lg"></i>
4
+ <span class="page-select--page-name">
5
+ {{ page.name }}
6
+ </span>
7
+ <span class="page-select--page-urlname">
8
+ {{ page.url_path }}
9
+ </span>
10
+ </div>
11
+ <div class="page-select--bottom">
12
+ <span class="page-select--site-name">
13
+ {{ page.site.name }}
14
+ </span>
15
+ <span class="page-select--language-code">
16
+ {{ page.language.name }}
17
+ </span>
18
+ </div>
9
19
  </div>
@@ -0,0 +1,3 @@
1
+ <a class="page_folder" data-page-id="{{ page.id }}">
2
+ <i class="far fa-{{#if page.folded }}plus{{else}}minus{{/if}}-square fa-fw"></i>
3
+ </a>
@@ -48,6 +48,10 @@ div#image_assign_filter_and_image_sizing {
48
48
  background-color: $thumbnail-background-color;
49
49
  width: 100%;
50
50
  height: 120px;
51
+
52
+ &:hover {
53
+ text-decoration: none;
54
+ }
51
55
  }
52
56
 
53
57
  .picture_thumbnail {
@@ -8,24 +8,49 @@
8
8
 
9
9
  .page-select--page {
10
10
  display: flex;
11
- align-items: center;
11
+ flex-direction: column;
12
12
 
13
13
  .icon {
14
14
  margin: 0 8px 0 4px;
15
15
 
16
16
  .select2-highlighted & {
17
- color: $white
17
+ color: $white;
18
18
  }
19
19
  }
20
20
  }
21
21
 
22
+ .page-select--top,
23
+ .page-select--bottom {
24
+ display: flex;
25
+ flex-direction: row;
26
+ align-items: center;
27
+ }
28
+
29
+ .page-select--bottom {
30
+ font-size: $small-font-size;
31
+ padding-left: 6 * $default-padding;
32
+ }
33
+
34
+ .page-select--language-code {
35
+ display: inline-block;
36
+ background-color: $medium-gray;
37
+ margin-left: auto;
38
+ border-radius: $default-border-radius;
39
+ padding: $default-padding / 2 $default-padding;
40
+
41
+ .select2-highlighted & {
42
+ color: $select-hover-bg-color;
43
+ background-color: white;
44
+ }
45
+ }
46
+
22
47
  .page-select--page-urlname {
23
48
  margin-left: auto;
24
- padding: $default-padding 2*$default-padding;
49
+ padding: $default-padding 2 * $default-padding;
25
50
  color: $dark-gray;
26
51
  font-size: $small-font-size;
27
52
 
28
53
  .select2-highlighted & {
29
- color: $white
54
+ color: $white;
30
55
  }
31
56
  }
@@ -23,7 +23,7 @@ $sitemap-url-xlarge-width: 350px;
23
23
 
24
24
  #sitemap-wrapper {
25
25
  position: relative;
26
- min-height: calc(100vh - 96px);
26
+ min-height: calc(100vh - 148px);
27
27
  }
28
28
 
29
29
  .sitemap_pagename_link {
@@ -142,18 +142,16 @@ $sitemap-url-xlarge-width: 350px;
142
142
  #sitemap {
143
143
  padding: 0 0 104px 0;
144
144
 
145
- &.sorting {
146
- padding-top: 100px;
147
-
148
- .page_icon {
149
- cursor: move;
150
- }
145
+ .handle {
146
+ cursor: move;
151
147
  }
152
148
 
153
149
  .page_folder {
154
150
  position: absolute;
155
151
  left: -23px;
156
152
  top: 0;
153
+ width: 16px;
154
+ height: $sitemap-line-height;
157
155
  }
158
156
 
159
157
  .placeholder {
@@ -258,3 +256,7 @@ $sitemap-url-xlarge-width: 350px;
258
256
  }
259
257
  }
260
258
  }
259
+
260
+ #search_field_clear {
261
+ cursor: pointer;
262
+ }
@@ -7,7 +7,7 @@ module Alchemy
7
7
 
8
8
  helper "alchemy/pages"
9
9
 
10
- before_action :load_resource, except: [:index, :flush, :new, :order, :create, :copy_language_tree, :link, :sort]
10
+ before_action :load_resource, except: [:index, :flush, :new, :order, :create, :copy_language_tree, :link]
11
11
 
12
12
  authorize_resource class: Alchemy::Page, except: [:index, :tree]
13
13
 
@@ -21,7 +21,7 @@ module Alchemy
21
21
  except: [:show]
22
22
 
23
23
  before_action :set_root_page,
24
- only: [:index, :show, :sort, :order]
24
+ only: [:index, :show, :order]
25
25
 
26
26
  before_action :run_on_page_layout_callbacks,
27
27
  if: :run_on_page_layout_callbacks?,
@@ -123,8 +123,7 @@ module Alchemy
123
123
  # * fetches page via before filter
124
124
  #
125
125
  def update
126
- # stores old page_layout value, because unfurtunally rails @page.changes does not work here.
127
- @old_page_layout = @page.page_layout
126
+ @old_parent_id = @page.parent_id
128
127
  if @page.update(page_params)
129
128
  @notice = Alchemy.t("Page saved", name: @page.name)
130
129
  @while_page_edit = request.referer.include?("edit")
@@ -133,7 +132,7 @@ module Alchemy
133
132
  @tree = serialized_page_tree
134
133
  end
135
134
  else
136
- configure
135
+ render :configure
137
136
  end
138
137
  end
139
138
 
@@ -169,9 +168,7 @@ module Alchemy
169
168
  def fold
170
169
  # @page is fetched via before filter
171
170
  @page.fold!(current_alchemy_user.id, !@page.folded?(current_alchemy_user.id))
172
- respond_to do |format|
173
- format.js
174
- end
171
+ render json: serialized_page_tree
175
172
  end
176
173
 
177
174
  # Leaves the page editing mode and unlocks the page for other users
@@ -204,10 +201,6 @@ module Alchemy
204
201
  redirect_to admin_pages_path
205
202
  end
206
203
 
207
- def sort
208
- @sorting = true
209
- end
210
-
211
204
  # Receives a JSON object representing a language tree to be ordered
212
205
  # and updates all pages in that language structure to their correct indexes
213
206
  def order
@@ -389,9 +382,11 @@ module Alchemy
389
382
  end
390
383
 
391
384
  def serialized_page_tree
392
- PageTreeSerializer.new(@page, ability: current_ability,
393
- user: current_alchemy_user,
394
- full: params[:full] == "true")
385
+ PageTreeSerializer.new(
386
+ @page,
387
+ ability: current_ability,
388
+ user: current_alchemy_user,
389
+ )
395
390
  end
396
391
 
397
392
  def load_languages_and_layouts
@@ -2,17 +2,19 @@
2
2
 
3
3
  module Alchemy
4
4
  class Api::PagesController < Api::BaseController
5
+ serialization_scope :current_ability
5
6
  before_action :load_page, only: [:show]
6
7
 
7
8
  # Returns all pages as json object
8
9
  #
9
10
  def index
10
11
  # Fix for cancancan not able to merge multiple AR scopes for logged in users
11
- if cannot? :edit_content, Alchemy::Page
12
- @pages = Alchemy::Page.accessible_by(current_ability, :index)
13
- @pages = @pages.where(language: Language.current)
12
+ if can? :edit_content, Alchemy::Page
13
+ @pages = Alchemy::Page.all
14
14
  else
15
- @pages = Language.current&.pages.presence || Alchemy::Page.none
15
+ language = Alchemy::Language.find_by(id: params[:language_id]) || Alchemy::Language.current
16
+ @pages = Alchemy::Page.accessible_by(current_ability, :index)
17
+ @pages = @pages.where(language: language)
16
18
  end
17
19
  @pages = @pages.includes(*page_includes)
18
20
  @pages = @pages.ransack(params[:q]).result
@@ -49,6 +51,14 @@ module Alchemy
49
51
  respond_with @page
50
52
  end
51
53
 
54
+ def move
55
+ @page = Page.find(params[:id])
56
+ authorize! :update, @page
57
+ target_parent_page = Page.find(params[:target_parent_id])
58
+ @page.move_to_child_with_index(target_parent_page, params[:new_position])
59
+ render json: @page, serializer: PageSerializer
60
+ end
61
+
52
62
  private
53
63
 
54
64
  def load_page
@@ -11,7 +11,8 @@ module Alchemy
11
11
  belongs_to :element, touch: true, class_name: "Alchemy::Element", inverse_of: :ingredients
12
12
  belongs_to :related_object, polymorphic: true, optional: true
13
13
 
14
- before_validation(on: :create) { self.value ||= default_value }
14
+ after_initialize :set_default_value,
15
+ if: -> { definition.key?(:default) && value.nil? }
15
16
 
16
17
  validates :type, presence: true
17
18
  validates :role, presence: true
@@ -161,6 +162,10 @@ module Alchemy
161
162
  role
162
163
  end
163
164
 
165
+ def set_default_value
166
+ self.value = default_value
167
+ end
168
+
164
169
  # Returns the default value from ingredient definition
165
170
  #
166
171
  # If the value is a symbol it gets passed through i18n