alchemy_cms 6.0.0.pre.rc5 → 6.0.0

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 +16 -8
  3. data/.github/workflows/stale.yml +21 -7
  4. data/.gitignore +0 -1
  5. data/.rspec +1 -0
  6. data/CHANGELOG.md +89 -0
  7. data/Gemfile +10 -7
  8. data/Rakefile +5 -1
  9. data/alchemy_cms.gemspec +3 -3
  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/alchemy.link_dialog.js.coffee +2 -0
  13. data/app/assets/javascripts/alchemy/page_select.js +13 -8
  14. data/app/assets/javascripts/alchemy/templates/index.js +1 -0
  15. data/app/assets/javascripts/alchemy/templates/page.hbs +17 -7
  16. data/app/assets/javascripts/alchemy/templates/page_folder.hbs +3 -0
  17. data/app/assets/stylesheets/alchemy/archive.scss +9 -0
  18. data/app/assets/stylesheets/alchemy/elements.scss +4 -0
  19. data/app/assets/stylesheets/alchemy/page-select.scss +29 -4
  20. data/app/assets/stylesheets/alchemy/sitemap.scss +9 -7
  21. data/app/controllers/alchemy/admin/elements_controller.rb +2 -6
  22. data/app/controllers/alchemy/admin/pages_controller.rb +16 -18
  23. data/app/controllers/alchemy/api/contents_controller.rb +1 -5
  24. data/app/controllers/alchemy/api/elements_controller.rb +2 -6
  25. data/app/controllers/alchemy/api/pages_controller.rb +16 -10
  26. data/app/helpers/alchemy/elements_helper.rb +2 -2
  27. data/app/models/alchemy/ingredient.rb +6 -1
  28. data/app/models/alchemy/page.rb +3 -2
  29. data/app/models/alchemy/picture.rb +1 -1
  30. data/app/serializers/alchemy/page_serializer.rb +7 -1
  31. data/app/serializers/alchemy/page_tree_serializer.rb +3 -3
  32. data/app/views/alchemy/admin/pages/_form.html.erb +19 -0
  33. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +16 -5
  34. data/app/views/alchemy/admin/pages/_page.html.erb +111 -133
  35. data/app/views/alchemy/admin/pages/_sitemap.html.erb +10 -16
  36. data/app/views/alchemy/admin/pages/_toolbar.html.erb +0 -12
  37. data/app/views/alchemy/admin/pages/edit.html.erb +1 -1
  38. data/app/views/alchemy/admin/pages/index.html.erb +1 -1
  39. data/app/views/alchemy/admin/pages/update.js.erb +7 -5
  40. data/app/views/alchemy/admin/partials/_routes.html.erb +12 -1
  41. data/app/views/alchemy/admin/resources/_form.html.erb +5 -0
  42. data/app/views/alchemy/essences/_essence_page_editor.html.erb +1 -1
  43. data/config/alchemy/config.yml +1 -0
  44. data/config/locales/alchemy.en.yml +0 -4
  45. data/config/routes.rb +4 -2
  46. data/lib/alchemy/engine.rb +12 -1
  47. data/lib/alchemy/essence.rb +0 -26
  48. data/lib/alchemy/permissions.rb +0 -1
  49. data/lib/alchemy/resource.rb +16 -1
  50. data/lib/alchemy/test_support/essence_shared_examples.rb +0 -12
  51. data/lib/alchemy/test_support/shared_ingredient_examples.rb +4 -2
  52. data/lib/alchemy/upgrader/tasks/ingredients_migrator.rb +1 -1
  53. data/lib/alchemy/version.rb +1 -1
  54. data/lib/generators/alchemy/install/install_generator.rb +6 -1
  55. data/package/admin.js +5 -1
  56. data/package/src/image_loader.js +4 -2
  57. data/package/src/node_tree.js +13 -6
  58. data/package/src/page_publication_fields.js +28 -0
  59. data/package/src/page_sorter.js +62 -0
  60. data/package/src/picture_editors.js +8 -8
  61. data/package/src/sitemap.js +148 -0
  62. data/package/src/utils/__tests__/ajax.spec.js +52 -16
  63. data/package/src/utils/ajax.js +12 -0
  64. data/package.json +1 -1
  65. metadata +43 -43
  66. data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +0 -24
  67. data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +0 -119
  68. data/app/views/alchemy/admin/pages/fold.js.erb +0 -2
  69. data/app/views/alchemy/admin/pages/sort.html.erb +0 -19
  70. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js +0 -434
@@ -1,5 +1,5 @@
1
1
  import xhrMock from "xhr-mock"
2
- import ajax from "../ajax"
2
+ import { get, patch, post } from "../ajax"
3
3
 
4
4
  const token = "s3cr3t"
5
5
 
@@ -8,13 +8,13 @@ beforeEach(() => {
8
8
  xhrMock.setup()
9
9
  })
10
10
 
11
- describe("ajax('get')", () => {
11
+ describe("get", () => {
12
12
  it("sends X-CSRF-TOKEN header", async () => {
13
13
  xhrMock.get("http://localhost/users", (req, res) => {
14
14
  expect(req.header("X-CSRF-TOKEN")).toEqual(token)
15
15
  return res.status(200).body('{"message":"Ok"}')
16
16
  })
17
- await ajax("get", "/users")
17
+ await get("/users")
18
18
  })
19
19
 
20
20
  it("sends Content-Type header", async () => {
@@ -24,7 +24,7 @@ describe("ajax('get')", () => {
24
24
  )
25
25
  return res.status(200).body('{"message":"Ok"}')
26
26
  })
27
- await ajax("get", "/users")
27
+ await get("/users")
28
28
  })
29
29
 
30
30
  it("sends Accept header", async () => {
@@ -32,14 +32,14 @@ describe("ajax('get')", () => {
32
32
  expect(req.header("Accept")).toEqual("application/json")
33
33
  return res.status(200).body('{"message":"Ok"}')
34
34
  })
35
- await ajax("get", "/users")
35
+ await get("/users")
36
36
  })
37
37
 
38
38
  it("returns JSON", async () => {
39
39
  xhrMock.get("http://localhost/users", (_req, res) => {
40
40
  return res.status(200).body('{"email":"mail@example.com"}')
41
41
  })
42
- await ajax("get", "/users").then((res) => {
42
+ await get("/users").then((res) => {
43
43
  expect(res.data).toEqual({ email: "mail@example.com" })
44
44
  })
45
45
  })
@@ -49,7 +49,7 @@ describe("ajax('get')", () => {
49
49
  return res.status(200).body('email => "mail@example.com"')
50
50
  })
51
51
  expect.assertions(1)
52
- await ajax("get", "/users").catch((e) => {
52
+ await get("/users").catch((e) => {
53
53
  expect(e.message).toMatch("Unexpected token")
54
54
  })
55
55
  })
@@ -59,7 +59,7 @@ describe("ajax('get')", () => {
59
59
  return Promise.reject(new Error())
60
60
  })
61
61
  expect.assertions(1)
62
- await ajax("get", "/users").catch((e) => {
62
+ await get("/users").catch((e) => {
63
63
  expect(e.message).toEqual("An error occurred during the transaction")
64
64
  })
65
65
  })
@@ -69,7 +69,7 @@ describe("ajax('get')", () => {
69
69
  return res.status(401).body('{"error":"Unauthorized"}')
70
70
  })
71
71
  expect.assertions(1)
72
- await ajax("get", "/users").catch((e) => {
72
+ await get("/users").catch((e) => {
73
73
  expect(e.error).toEqual("Unauthorized")
74
74
  })
75
75
  })
@@ -79,7 +79,7 @@ describe("ajax('get')", () => {
79
79
  return res.status(401).body("Unauthorized")
80
80
  })
81
81
  expect.assertions(1)
82
- await ajax("get", "/users").catch((e) => {
82
+ await get("/users").catch((e) => {
83
83
  expect(e.message).toMatch("Unexpected token")
84
84
  })
85
85
  })
@@ -88,18 +88,54 @@ describe("ajax('get')", () => {
88
88
  xhrMock.get("http://localhost/users?name=foo", (_req, res) => {
89
89
  return res.status(200).body(`{"name":"foo"}`)
90
90
  })
91
- const { data } = await ajax("get", "/users", { name: "foo" })
91
+ const { data } = await get("/users", { name: "foo" })
92
92
  expect(data.name).toEqual("foo")
93
93
  })
94
94
  })
95
95
 
96
- describe("ajax('post')", () => {
96
+ describe("patch", () => {
97
+ it("sends X-CSRF-TOKEN header", async () => {
98
+ xhrMock.patch("http://localhost/users", (req, res) => {
99
+ expect(req.header("X-CSRF-TOKEN")).toEqual(token)
100
+ return res.status(200).body('{"message":"Ok"}')
101
+ })
102
+ await patch("/users")
103
+ })
104
+
105
+ it("sends Content-Type header", async () => {
106
+ xhrMock.patch("http://localhost/users", (req, res) => {
107
+ expect(req.header("Content-Type")).toEqual(
108
+ "application/json; charset=utf-8"
109
+ )
110
+ return res.status(200).body('{"message":"Ok"}')
111
+ })
112
+ await patch("/users")
113
+ })
114
+
115
+ it("sends Accept header", async () => {
116
+ xhrMock.patch("http://localhost/users", (req, res) => {
117
+ expect(req.header("Accept")).toEqual("application/json")
118
+ return res.status(200).body('{"message":"Ok"}')
119
+ })
120
+ await patch("/users")
121
+ })
122
+
123
+ it("sends JSON data", async () => {
124
+ xhrMock.patch("http://localhost/users", (req, res) => {
125
+ expect(req.body()).toEqual('{"email":"mail@example.com"}')
126
+ return res.status(200).body('{"message":"Ok"}')
127
+ })
128
+ await patch("/users", { email: "mail@example.com" })
129
+ })
130
+ })
131
+
132
+ describe("post", () => {
97
133
  it("sends X-CSRF-TOKEN header", async () => {
98
134
  xhrMock.post("http://localhost/users", (req, res) => {
99
135
  expect(req.header("X-CSRF-TOKEN")).toEqual(token)
100
136
  return res.status(200).body('{"message":"Ok"}')
101
137
  })
102
- await ajax("post", "/users")
138
+ await post("/users")
103
139
  })
104
140
 
105
141
  it("sends Content-Type header", async () => {
@@ -109,7 +145,7 @@ describe("ajax('post')", () => {
109
145
  )
110
146
  return res.status(200).body('{"message":"Ok"}')
111
147
  })
112
- await ajax("post", "/users")
148
+ await post("/users")
113
149
  })
114
150
 
115
151
  it("sends Accept header", async () => {
@@ -117,7 +153,7 @@ describe("ajax('post')", () => {
117
153
  expect(req.header("Accept")).toEqual("application/json")
118
154
  return res.status(200).body('{"message":"Ok"}')
119
155
  })
120
- await ajax("post", "/users")
156
+ await post("/users")
121
157
  })
122
158
 
123
159
  it("sends JSON data", async () => {
@@ -125,7 +161,7 @@ describe("ajax('post')", () => {
125
161
  expect(req.body()).toEqual('{"email":"mail@example.com"}')
126
162
  return res.status(200).body('{"message":"Ok"}')
127
163
  })
128
- await ajax("post", "/users", { email: "mail@example.com" })
164
+ await post("/users", { email: "mail@example.com" })
129
165
  })
130
166
  })
131
167
 
@@ -29,6 +29,18 @@ function getToken() {
29
29
  return metaTag.attributes.content.textContent
30
30
  }
31
31
 
32
+ export function get(url, params) {
33
+ return ajax("GET", url, params)
34
+ }
35
+
36
+ export function patch(url, data) {
37
+ return ajax("PATCH", url, data)
38
+ }
39
+
40
+ export function post(url, data) {
41
+ return ajax("POST", url, data)
42
+ }
43
+
32
44
  export default function ajax(method, path, data) {
33
45
  const xhr = new XMLHttpRequest()
34
46
  const promise = buildPromise(xhr)
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy_cms/admin",
3
- "version": "6.0.0-rc4",
3
+ "version": "6.0.0",
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: 6.0.0.pre.rc5
4
+ version: 6.0.0
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: 2022-02-24 00:00:00.000000000 Z
16
+ date: 2022-04-11 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: actionmailer
@@ -24,7 +24,7 @@ dependencies:
24
24
  version: '6.0'
25
25
  - - "<"
26
26
  - !ruby/object:Gem::Version
27
- version: '6.2'
27
+ version: '7.1'
28
28
  type: :runtime
29
29
  prerelease: false
30
30
  version_requirements: !ruby/object:Gem::Requirement
@@ -34,7 +34,7 @@ dependencies:
34
34
  version: '6.0'
35
35
  - - "<"
36
36
  - !ruby/object:Gem::Version
37
- version: '6.2'
37
+ version: '7.1'
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: actionpack
40
40
  requirement: !ruby/object:Gem::Requirement
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '6.0'
45
45
  - - "<"
46
46
  - !ruby/object:Gem::Version
47
- version: '6.2'
47
+ version: '7.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '6.0'
55
55
  - - "<"
56
56
  - !ruby/object:Gem::Version
57
- version: '6.2'
57
+ version: '7.1'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: actionview
60
60
  requirement: !ruby/object:Gem::Requirement
@@ -64,7 +64,7 @@ dependencies:
64
64
  version: '6.0'
65
65
  - - "<"
66
66
  - !ruby/object:Gem::Version
67
- version: '6.2'
67
+ version: '7.1'
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  version: '6.0'
75
75
  - - "<"
76
76
  - !ruby/object:Gem::Version
77
- version: '6.2'
77
+ version: '7.1'
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: activejob
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +84,7 @@ dependencies:
84
84
  version: '6.0'
85
85
  - - "<"
86
86
  - !ruby/object:Gem::Version
87
- version: '6.2'
87
+ version: '7.1'
88
88
  type: :runtime
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
@@ -94,7 +94,7 @@ dependencies:
94
94
  version: '6.0'
95
95
  - - "<"
96
96
  - !ruby/object:Gem::Version
97
- version: '6.2'
97
+ version: '7.1'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: activemodel
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -104,7 +104,7 @@ dependencies:
104
104
  version: '6.0'
105
105
  - - "<"
106
106
  - !ruby/object:Gem::Version
107
- version: '6.2'
107
+ version: '7.1'
108
108
  type: :runtime
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  version: '6.0'
115
115
  - - "<"
116
116
  - !ruby/object:Gem::Version
117
- version: '6.2'
117
+ version: '7.1'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: activerecord
120
120
  requirement: !ruby/object:Gem::Requirement
@@ -124,7 +124,7 @@ dependencies:
124
124
  version: '6.0'
125
125
  - - "<"
126
126
  - !ruby/object:Gem::Version
127
- version: '6.2'
127
+ version: '7.1'
128
128
  type: :runtime
129
129
  prerelease: false
130
130
  version_requirements: !ruby/object:Gem::Requirement
@@ -134,7 +134,7 @@ dependencies:
134
134
  version: '6.0'
135
135
  - - "<"
136
136
  - !ruby/object:Gem::Version
137
- version: '6.2'
137
+ version: '7.1'
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: activesupport
140
140
  requirement: !ruby/object:Gem::Requirement
@@ -144,7 +144,7 @@ dependencies:
144
144
  version: '6.0'
145
145
  - - "<"
146
146
  - !ruby/object:Gem::Version
147
- version: '6.2'
147
+ version: '7.1'
148
148
  type: :runtime
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ dependencies:
154
154
  version: '6.0'
155
155
  - - "<"
156
156
  - !ruby/object:Gem::Version
157
- version: '6.2'
157
+ version: '7.1'
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: railties
160
160
  requirement: !ruby/object:Gem::Requirement
@@ -164,7 +164,7 @@ dependencies:
164
164
  version: '6.0'
165
165
  - - "<"
166
166
  - !ruby/object:Gem::Version
167
- version: '6.2'
167
+ version: '7.1'
168
168
  type: :runtime
169
169
  prerelease: false
170
170
  version_requirements: !ruby/object:Gem::Requirement
@@ -174,7 +174,7 @@ dependencies:
174
174
  version: '6.0'
175
175
  - - "<"
176
176
  - !ruby/object:Gem::Version
177
- version: '6.2'
177
+ version: '7.1'
178
178
  - !ruby/object:Gem::Dependency
179
179
  name: active_model_serializers
180
180
  requirement: !ruby/object:Gem::Requirement
@@ -408,9 +408,9 @@ dependencies:
408
408
  - - ">="
409
409
  - !ruby/object:Gem::Version
410
410
  version: '1.8'
411
- - - "<="
411
+ - - "<"
412
412
  - !ruby/object:Gem::Version
413
- version: 2.5.0
413
+ version: '4.0'
414
414
  type: :runtime
415
415
  prerelease: false
416
416
  version_requirements: !ruby/object:Gem::Requirement
@@ -418,9 +418,9 @@ dependencies:
418
418
  - - ">="
419
419
  - !ruby/object:Gem::Version
420
420
  version: '1.8'
421
- - - "<="
421
+ - - "<"
422
422
  - !ruby/object:Gem::Version
423
- version: 2.5.0
423
+ version: '4.0'
424
424
  - !ruby/object:Gem::Dependency
425
425
  name: request_store
426
426
  requirement: !ruby/object:Gem::Requirement
@@ -571,20 +571,6 @@ dependencies:
571
571
  - - "~>"
572
572
  - !ruby/object:Gem::Version
573
573
  version: '1.0'
574
- - !ruby/object:Gem::Dependency
575
- name: cuprite
576
- requirement: !ruby/object:Gem::Requirement
577
- requirements:
578
- - - "~>"
579
- - !ruby/object:Gem::Version
580
- version: '0.13'
581
- type: :development
582
- prerelease: false
583
- version_requirements: !ruby/object:Gem::Requirement
584
- requirements:
585
- - - "~>"
586
- - !ruby/object:Gem::Version
587
- version: '0.13'
588
574
  - !ruby/object:Gem::Dependency
589
575
  name: factory_bot_rails
590
576
  requirement: !ruby/object:Gem::Requirement
@@ -669,6 +655,20 @@ dependencies:
669
655
  - - "~>"
670
656
  - !ruby/object:Gem::Version
671
657
  version: '0.20'
658
+ - !ruby/object:Gem::Dependency
659
+ name: webdrivers
660
+ requirement: !ruby/object:Gem::Requirement
661
+ requirements:
662
+ - - "~>"
663
+ - !ruby/object:Gem::Version
664
+ version: '5.0'
665
+ type: :development
666
+ prerelease: false
667
+ version_requirements: !ruby/object:Gem::Requirement
668
+ requirements:
669
+ - - "~>"
670
+ - !ruby/object:Gem::Version
671
+ version: '5.0'
672
672
  - !ruby/object:Gem::Dependency
673
673
  name: webmock
674
674
  requirement: !ruby/object:Gem::Requirement
@@ -731,6 +731,7 @@ files:
731
731
  - ".hound.yml"
732
732
  - ".localeapp/config.rb"
733
733
  - ".prettierrc"
734
+ - ".rspec"
734
735
  - ".rubocop.yml"
735
736
  - ".yardopts"
736
737
  - CHANGELOG.md
@@ -772,10 +773,8 @@ files:
772
773
  - app/assets/javascripts/alchemy/alchemy.initializer.js.coffee
773
774
  - app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee
774
775
  - app/assets/javascripts/alchemy/alchemy.list_filter.js.coffee
775
- - app/assets/javascripts/alchemy/alchemy.page_sorter.js
776
776
  - app/assets/javascripts/alchemy/alchemy.preview.js.coffee
777
777
  - app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee
778
- - app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee
779
778
  - app/assets/javascripts/alchemy/alchemy.spinner.js
780
779
  - app/assets/javascripts/alchemy/alchemy.string_extension.js.coffee
781
780
  - app/assets/javascripts/alchemy/alchemy.tinymce.js.coffee
@@ -789,6 +788,7 @@ files:
789
788
  - app/assets/javascripts/alchemy/templates/node.hbs
790
789
  - app/assets/javascripts/alchemy/templates/node_folder.hbs
791
790
  - app/assets/javascripts/alchemy/templates/page.hbs
791
+ - app/assets/javascripts/alchemy/templates/page_folder.hbs
792
792
  - app/assets/javascripts/alchemy/templates/spinner.hbs
793
793
  - app/assets/javascripts/tinymce/plugins/alchemy_link/plugin.min.js
794
794
  - app/assets/stylesheets/alchemy/_defaults.scss
@@ -1107,7 +1107,6 @@ files:
1107
1107
  - app/views/alchemy/admin/pages/configure.html.erb
1108
1108
  - app/views/alchemy/admin/pages/edit.html.erb
1109
1109
  - app/views/alchemy/admin/pages/flush.js.erb
1110
- - app/views/alchemy/admin/pages/fold.js.erb
1111
1110
  - app/views/alchemy/admin/pages/index.html.erb
1112
1111
  - app/views/alchemy/admin/pages/info.html.erb
1113
1112
  - app/views/alchemy/admin/pages/link.html.erb
@@ -1115,7 +1114,6 @@ files:
1115
1114
  - app/views/alchemy/admin/pages/locked.html.erb
1116
1115
  - app/views/alchemy/admin/pages/new.html.erb
1117
1116
  - app/views/alchemy/admin/pages/show.html.erb
1118
- - app/views/alchemy/admin/pages/sort.html.erb
1119
1117
  - app/views/alchemy/admin/pages/unlock.js.erb
1120
1118
  - app/views/alchemy/admin/pages/update.js.erb
1121
1119
  - app/views/alchemy/admin/partials/_autocomplete_tag_list.html.erb
@@ -1431,7 +1429,10 @@ files:
1431
1429
  - package/src/image_cropper.js
1432
1430
  - package/src/image_loader.js
1433
1431
  - package/src/node_tree.js
1432
+ - package/src/page_publication_fields.js
1433
+ - package/src/page_sorter.js
1434
1434
  - package/src/picture_editors.js
1435
+ - package/src/sitemap.js
1435
1436
  - package/src/translations.js
1436
1437
  - package/src/utils/__tests__/ajax.spec.js
1437
1438
  - package/src/utils/__tests__/events.spec.js
@@ -1456,7 +1457,6 @@ files:
1456
1457
  - vendor/assets/javascripts/flatpickr/flatpickr.min.js
1457
1458
  - vendor/assets/javascripts/jquery_plugins/jquery.Jcrop.min.js
1458
1459
  - vendor/assets/javascripts/jquery_plugins/jquery.scrollTo.min.js
1459
- - vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js
1460
1460
  - vendor/assets/javascripts/jquery_plugins/jquery.ui.tabspaging.js
1461
1461
  - vendor/assets/javascripts/jquery_plugins/select2.js
1462
1462
  - vendor/assets/javascripts/keymaster.js
@@ -1515,9 +1515,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1515
1515
  version: 2.5.0
1516
1516
  required_rubygems_version: !ruby/object:Gem::Requirement
1517
1517
  requirements:
1518
- - - ">"
1518
+ - - ">="
1519
1519
  - !ruby/object:Gem::Version
1520
- version: 1.3.1
1520
+ version: '0'
1521
1521
  requirements:
1522
1522
  - ImageMagick (libmagick), v6.6 or greater.
1523
1523
  rubygems_version: 3.1.6
@@ -1,24 +0,0 @@
1
- Alchemy.PageSorter = function () {
2
- var $sortables = $("ul#sitemap").find("ul.level_0_children")
3
-
4
- $sortables.nestedSortable({
5
- disableNesting: "no-nest",
6
- forcePlaceholderSize: true,
7
- handle: ".handle",
8
- items: "li",
9
- listType: "ul",
10
- opacity: 0.5,
11
- placeholder: "placeholder",
12
- tabSize: 16,
13
- tolerance: "pointer",
14
- toleranceElement: "> div"
15
- })
16
-
17
- $("#save_page_order").click(function (e) {
18
- e.preventDefault()
19
- Alchemy.Buttons.disable(this)
20
- $.post(Alchemy.routes.order_admin_pages_path, {
21
- set: JSON.stringify($sortables.nestedSortable("toHierarchy"))
22
- })
23
- })
24
- }
@@ -1,119 +0,0 @@
1
- window.Alchemy = {} if typeof(window.Alchemy) is 'undefined'
2
-
3
- # The admin sitemap Alchemy module
4
- Alchemy.Sitemap =
5
-
6
- # Storing some objects.
7
- init: (options) ->
8
- @search_field = $(".search_input_field")
9
- @filter_field_clear = $('.search_field_clear')
10
- @display = $('#page_filter_result')
11
- @sitemap_wrapper = $('#sitemap-wrapper p.loading')
12
- @template = Handlebars.compile($('#sitemap-template').html())
13
- list_template_regexp = new RegExp '\/' + options.page_root_id, 'g'
14
- list_template_html = $('#sitemap-list').html().replace(list_template_regexp, '/{{id}}')
15
- @list_template = Handlebars.compile(list_template_html)
16
- @items = null
17
- @options = options
18
- @watchPagePublicationState()
19
- true
20
-
21
- Handlebars.registerPartial('list', list_template_html)
22
-
23
- @fetch()
24
-
25
- # Fetches the sitemap from JSON
26
- fetch: (foldingId) ->
27
- self = Alchemy.Sitemap
28
-
29
- if foldingId
30
- spinner = new Alchemy.Spinner('small')
31
- spinTarget = $('#fold_button_' + foldingId)
32
- renderTarget = $('#page_' + foldingId)
33
- renderTemplate = @list_template
34
- pageId = foldingId
35
- else
36
- spinner = @options.spinner || new Alchemy.Spinner('medium')
37
- spinTarget = @sitemap_wrapper
38
- renderTarget = @sitemap_wrapper
39
- renderTemplate = @template
40
- pageId = @options.page_root_id
41
-
42
- spinner.spin(spinTarget[0])
43
-
44
- request = $.ajax url: @options.url, data:
45
- id: pageId
46
- full: @options.full
47
-
48
- request.done (data) ->
49
- # This will also remove the spinner
50
- renderTarget.replaceWith(renderTemplate({children: data.pages}))
51
- self.items = $(".sitemap_page", '#sitemap')
52
- self._observe()
53
-
54
- if self.options.ready
55
- self.options.ready()
56
-
57
- request.fail (jqXHR, status) ->
58
- console.warn("Request failed: " + status)
59
-
60
- # Filters the sitemap
61
- filter: (term) ->
62
- results = []
63
- self = Alchemy.Sitemap
64
- self.items.map ->
65
- item = $(this)
66
- if term != '' && item.attr('name').toLowerCase().indexOf(term) != -1
67
- item.addClass('highlight')
68
- item.removeClass('no-match')
69
- results.push item
70
- else
71
- item.addClass('no-match')
72
- item.removeClass('highlight')
73
- self.filter_field_clear.show()
74
- length = results.length
75
- if length == 1
76
- self.display.show().text("1 #{Alchemy.t('page_found')}")
77
- $.scrollTo(results[0], {duration: 400, offset: -80})
78
- else if length > 1
79
- self.display.show().text("#{length} #{Alchemy.t('pages_found')}")
80
- else
81
- self.items.removeClass('no-match highlight')
82
- self.display.hide()
83
- $.scrollTo('0', 400)
84
- self.filter_field_clear.hide()
85
-
86
- # Adds onkey up observer to search field
87
- _observe: ->
88
- filter = @filter
89
- @search_field.on 'keyup', ->
90
- term = $(this).val()
91
- filter(term.toLowerCase())
92
- @search_field.on 'focus', ->
93
- key.setScope('search')
94
- @filter_field_clear.click =>
95
- @search_field.val('')
96
- filter('')
97
- false
98
-
99
- # Handles the page publication date fields
100
- watchPagePublicationState: ->
101
- $(document).on 'DialogReady.Alchemy', (e, $dialog) ->
102
- $public_on_field = $('#page_public_on', $dialog)
103
- $public_until_field = $('#page_public_until', $dialog)
104
- $publication_date_fields = $('.page-publication-date-fields', $dialog)
105
-
106
- $('#page_public', $dialog).click ->
107
- $checkbox = $(this)
108
- format = $checkbox.data('date-format')
109
- now = new Date()
110
- if $checkbox.is(':checked')
111
- $publication_date_fields.removeClass('hidden')
112
- $public_on_field[0]._flatpickr.setDate(now)
113
- else
114
- $publication_date_fields.addClass('hidden')
115
- $public_on_field.val('')
116
- $public_until_field.val('')
117
- true
118
-
119
- return
@@ -1,2 +0,0 @@
1
- $('#fold_button_<%= @page.id %>').css('background', 'none');
2
- Alchemy.Sitemap.fetch(<%= @page.id %>);
@@ -1,19 +0,0 @@
1
- <% content_for :toolbar do %>
2
- <div class="button_with_label">
3
- <%= link_to alchemy.admin_pages_path, class: 'icon_button' do %>
4
- <%= render_icon 'angle-double-left' %>
5
- <% end %>
6
- <label><%= Alchemy.t(:cancel) %></label>
7
- </div>
8
- <% end %>
9
-
10
- <div id="sort_panel">
11
- <%= render_message do %>
12
- <%= Alchemy.t(:explain_sitemap_dragndrop_sorting) %>
13
- <% end %>
14
- <div class="buttons">
15
- <%= button_tag Alchemy.t('save order'), id: 'save_page_order' %>
16
- </div>
17
- </div>
18
-
19
- <%= render 'sitemap', page_partial: 'page', full: true %>