@raketa-cloud/admin 0.0.91 → 0.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/handlers/article_revisions/PublishesHandler.js +2 -1
- package/src/handlers/event_revisions/PublishesHandler.js +2 -1
- package/src/handlers/page_revisions/PublishesHandler.js +2 -1
- package/src/helpers/FormBuilder.js +6 -1
- package/src/tests/handlers/article_revisions/PublishesHandler.test/create.test.js +8 -0
- package/src/tests/handlers/article_revisions/PublishesHandler.test/create_form.test.js +1 -0
- package/src/tests/handlers/event_revisions/PublishesHandler.test/create.test.js +8 -0
- package/src/tests/handlers/event_revisions/PublishesHandler.test/create_form.test.js +1 -0
- package/src/tests/handlers/page_revisions/PublishesHandler.test/create.test.js +8 -0
- package/src/tests/handlers/page_revisions/PublishesHandler.test/create_form.test.js +1 -0
- package/src/views/article_revisions/publishes/_form.ejs +30 -3
- package/src/views/articles/show.ejs +0 -8
- package/src/views/event_revisions/publishes/_form.ejs +37 -3
- package/src/views/events/show.ejs +0 -8
- package/src/views/page_revisions/publishes/_form.ejs +36 -3
- package/src/views/pages/show.ejs +0 -8
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@ const create_form = async (ctx) => {
|
|
|
18
18
|
visibility: revision.visibility,
|
|
19
19
|
username: revision.settings?.credentials?.user,
|
|
20
20
|
password: revision.settings?.credentials?.password,
|
|
21
|
+
type: "now",
|
|
21
22
|
},
|
|
22
23
|
visibilityOptions: ctx.client.articles.visibilityOptions(),
|
|
23
24
|
errors: {},
|
|
@@ -49,7 +50,7 @@ function publishArticleParams(
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
async function publishRevision(ctx, revision, publishing) {
|
|
52
|
-
if (publishing.mergeAt) {
|
|
53
|
+
if (publishing.mergeAt && publishing.type === "later") {
|
|
53
54
|
return await ctx.client.articleRevisions.schedule(
|
|
54
55
|
revision.id,
|
|
55
56
|
ctx.locale,
|
|
@@ -15,6 +15,7 @@ const create_form = async (ctx) => {
|
|
|
15
15
|
visibility: revision.visibility,
|
|
16
16
|
username: revision.settings?.credentials?.user,
|
|
17
17
|
password: revision.settings?.credentials?.password,
|
|
18
|
+
type: "now",
|
|
18
19
|
},
|
|
19
20
|
visibilityOptions: ctx.client.events.visibilityOptions(),
|
|
20
21
|
errors: {},
|
|
@@ -46,7 +47,7 @@ function publishEventParams(
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
async function publishRevision(ctx, revision, publishing) {
|
|
49
|
-
if (publishing.mergeAt) {
|
|
50
|
+
if (publishing.mergeAt && publishing.type === "later") {
|
|
50
51
|
return await ctx.client.eventRevisions.schedule(
|
|
51
52
|
revision.id,
|
|
52
53
|
ctx.locale,
|
|
@@ -15,6 +15,7 @@ const create_form = async (ctx) => {
|
|
|
15
15
|
visibility: revision.visibility,
|
|
16
16
|
username: revision.settings?.credentials?.user,
|
|
17
17
|
password: revision.settings?.credentials?.password,
|
|
18
|
+
type: "now",
|
|
18
19
|
},
|
|
19
20
|
visibilityOptions: ctx.client.pages.visibilityOptions(),
|
|
20
21
|
errors: {},
|
|
@@ -46,7 +47,7 @@ function publishPageParams(
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
async function publishRevision(ctx, revision, publishing) {
|
|
49
|
-
if (publishing.mergeAt) {
|
|
50
|
+
if (publishing.mergeAt && publishing.type === "later") {
|
|
50
51
|
return await ctx.client.pageRevisions.schedule(
|
|
51
52
|
revision.id,
|
|
52
53
|
ctx.locale,
|
|
@@ -385,7 +385,12 @@ export default class FormBuilder extends HTMLBuilder {
|
|
|
385
385
|
});
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
-
|
|
388
|
+
let defaultLabel = this.__getDefaultLabel(name);
|
|
389
|
+
|
|
390
|
+
if (Object.hasOwn(opts, "label")) {
|
|
391
|
+
defaultLabel = opts?.label;
|
|
392
|
+
}
|
|
393
|
+
|
|
389
394
|
const htmlID = this.__getID(name);
|
|
390
395
|
const error = this.__getError(name);
|
|
391
396
|
|
|
@@ -29,6 +29,7 @@ describe("Publish article revision", () => {
|
|
|
29
29
|
visibility: "protected",
|
|
30
30
|
username: "admin",
|
|
31
31
|
password: "admin123!@#",
|
|
32
|
+
type: "now",
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
const ctx = buildCtx(revision, {
|
|
@@ -86,6 +87,7 @@ describe("Publish article revision", () => {
|
|
|
86
87
|
title: "A new revision!",
|
|
87
88
|
description: "Nice!",
|
|
88
89
|
visibility: "public",
|
|
90
|
+
type: "now",
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
const ctx = buildCtx(revision, {
|
|
@@ -128,6 +130,7 @@ describe("Publish article revision", () => {
|
|
|
128
130
|
visibility: publishing.visibility,
|
|
129
131
|
username: publishing.username,
|
|
130
132
|
password: publishing.password,
|
|
133
|
+
type: publishing.type,
|
|
131
134
|
},
|
|
132
135
|
visibilityOptions: ctx.client.articles.visibilityOptions(),
|
|
133
136
|
errors: {
|
|
@@ -149,6 +152,7 @@ describe("Publish article revision", () => {
|
|
|
149
152
|
visibility: "protected",
|
|
150
153
|
username: "admin",
|
|
151
154
|
password: "admin123!@#",
|
|
155
|
+
type: "later",
|
|
152
156
|
};
|
|
153
157
|
|
|
154
158
|
const ctx = buildCtx(revision, {
|
|
@@ -204,6 +208,7 @@ describe("Publish article revision", () => {
|
|
|
204
208
|
title: "A new revision!",
|
|
205
209
|
description: "Nice!",
|
|
206
210
|
visibility: "public",
|
|
211
|
+
type: "later",
|
|
207
212
|
};
|
|
208
213
|
|
|
209
214
|
const ctx = buildCtx(revision, {
|
|
@@ -249,6 +254,7 @@ describe("Publish article revision", () => {
|
|
|
249
254
|
visibility: publishing.visibility,
|
|
250
255
|
username: publishing.username,
|
|
251
256
|
password: publishing.password,
|
|
257
|
+
type: publishing.type,
|
|
252
258
|
},
|
|
253
259
|
visibilityOptions: ctx.client.articles.visibilityOptions(),
|
|
254
260
|
articleErrors: {
|
|
@@ -267,6 +273,7 @@ describe("Publish article revision", () => {
|
|
|
267
273
|
title: "A new revision!",
|
|
268
274
|
description: "Nice!",
|
|
269
275
|
visibility: "public",
|
|
276
|
+
type: "later",
|
|
270
277
|
};
|
|
271
278
|
|
|
272
279
|
const ctx = buildCtx(revision, {
|
|
@@ -312,6 +319,7 @@ describe("Publish article revision", () => {
|
|
|
312
319
|
visibility: publishing.visibility,
|
|
313
320
|
username: publishing.username,
|
|
314
321
|
password: publishing.password,
|
|
322
|
+
type: publishing.type,
|
|
315
323
|
},
|
|
316
324
|
visibilityOptions: ctx.client.articles.visibilityOptions(),
|
|
317
325
|
errors: {
|
|
@@ -37,6 +37,7 @@ describe("Publish article revision", () => {
|
|
|
37
37
|
visibility: revision.visibility,
|
|
38
38
|
username: revision.settings?.credentials?.user,
|
|
39
39
|
password: revision.settings?.credentials?.password,
|
|
40
|
+
type: "now",
|
|
40
41
|
},
|
|
41
42
|
visibilityOptions: ctx.client.articles.visibilityOptions(),
|
|
42
43
|
errors: {},
|
|
@@ -29,6 +29,7 @@ describe("Publish event revision", () => {
|
|
|
29
29
|
visibility: "protected",
|
|
30
30
|
username: "admin",
|
|
31
31
|
password: "admin123!@#",
|
|
32
|
+
type: "now",
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
const ctx = buildCtx(revision, {
|
|
@@ -86,6 +87,7 @@ describe("Publish event revision", () => {
|
|
|
86
87
|
title: "A new revision!",
|
|
87
88
|
description: "Nice!",
|
|
88
89
|
visibility: "public",
|
|
90
|
+
type: "now",
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
const ctx = buildCtx(revision, {
|
|
@@ -128,6 +130,7 @@ describe("Publish event revision", () => {
|
|
|
128
130
|
visibility: publishing.visibility,
|
|
129
131
|
username: publishing.username,
|
|
130
132
|
password: publishing.password,
|
|
133
|
+
type: publishing.type,
|
|
131
134
|
},
|
|
132
135
|
visibilityOptions: ctx.client.events.visibilityOptions(),
|
|
133
136
|
errors: {
|
|
@@ -149,6 +152,7 @@ describe("Publish event revision", () => {
|
|
|
149
152
|
visibility: "protected",
|
|
150
153
|
username: "admin",
|
|
151
154
|
password: "admin123!@#",
|
|
155
|
+
type: "later",
|
|
152
156
|
};
|
|
153
157
|
|
|
154
158
|
const ctx = buildCtx(revision, {
|
|
@@ -204,6 +208,7 @@ describe("Publish event revision", () => {
|
|
|
204
208
|
title: "A new revision!",
|
|
205
209
|
description: "Nice!",
|
|
206
210
|
visibility: "public",
|
|
211
|
+
type: "later",
|
|
207
212
|
};
|
|
208
213
|
|
|
209
214
|
const ctx = buildCtx(revision, {
|
|
@@ -249,6 +254,7 @@ describe("Publish event revision", () => {
|
|
|
249
254
|
visibility: publishing.visibility,
|
|
250
255
|
username: publishing.username,
|
|
251
256
|
password: publishing.password,
|
|
257
|
+
type: publishing.type,
|
|
252
258
|
},
|
|
253
259
|
visibilityOptions: ctx.client.events.visibilityOptions(),
|
|
254
260
|
eventErrors: {
|
|
@@ -267,6 +273,7 @@ describe("Publish event revision", () => {
|
|
|
267
273
|
title: "A new revision!",
|
|
268
274
|
description: "Nice!",
|
|
269
275
|
visibility: "public",
|
|
276
|
+
type: "later",
|
|
270
277
|
};
|
|
271
278
|
|
|
272
279
|
const ctx = buildCtx(revision, {
|
|
@@ -312,6 +319,7 @@ describe("Publish event revision", () => {
|
|
|
312
319
|
visibility: publishing.visibility,
|
|
313
320
|
username: publishing.username,
|
|
314
321
|
password: publishing.password,
|
|
322
|
+
type: publishing.type,
|
|
315
323
|
},
|
|
316
324
|
visibilityOptions: ctx.client.events.visibilityOptions(),
|
|
317
325
|
errors: {
|
|
@@ -37,6 +37,7 @@ describe("Publish event revision", () => {
|
|
|
37
37
|
visibility: revision.visibility,
|
|
38
38
|
username: revision.settings?.credentials?.user,
|
|
39
39
|
password: revision.settings?.credentials?.password,
|
|
40
|
+
type: "now",
|
|
40
41
|
},
|
|
41
42
|
visibilityOptions: ctx.client.events.visibilityOptions(),
|
|
42
43
|
errors: {},
|
|
@@ -29,6 +29,7 @@ describe("Publish page revision", () => {
|
|
|
29
29
|
visibility: "protected",
|
|
30
30
|
username: "admin",
|
|
31
31
|
password: "admin123!@#",
|
|
32
|
+
type: "now",
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
const ctx = buildCtx(revision, {
|
|
@@ -86,6 +87,7 @@ describe("Publish page revision", () => {
|
|
|
86
87
|
title: "A new revision!",
|
|
87
88
|
description: "Nice!",
|
|
88
89
|
visibility: "public",
|
|
90
|
+
type: "now",
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
const ctx = buildCtx(revision, {
|
|
@@ -128,6 +130,7 @@ describe("Publish page revision", () => {
|
|
|
128
130
|
visibility: publishing.visibility,
|
|
129
131
|
username: publishing.username,
|
|
130
132
|
password: publishing.password,
|
|
133
|
+
type: publishing.type,
|
|
131
134
|
},
|
|
132
135
|
visibilityOptions: ctx.client.pages.visibilityOptions(),
|
|
133
136
|
errors: {
|
|
@@ -149,6 +152,7 @@ describe("Publish page revision", () => {
|
|
|
149
152
|
visibility: "protected",
|
|
150
153
|
username: "admin",
|
|
151
154
|
password: "admin123!@#",
|
|
155
|
+
type: "later",
|
|
152
156
|
};
|
|
153
157
|
|
|
154
158
|
const ctx = buildCtx(revision, {
|
|
@@ -204,6 +208,7 @@ describe("Publish page revision", () => {
|
|
|
204
208
|
title: "A new revision!",
|
|
205
209
|
description: "Nice!",
|
|
206
210
|
visibility: "public",
|
|
211
|
+
type: "later",
|
|
207
212
|
};
|
|
208
213
|
|
|
209
214
|
const ctx = buildCtx(revision, {
|
|
@@ -249,6 +254,7 @@ describe("Publish page revision", () => {
|
|
|
249
254
|
visibility: publishing.visibility,
|
|
250
255
|
username: publishing.username,
|
|
251
256
|
password: publishing.password,
|
|
257
|
+
type: publishing.type,
|
|
252
258
|
},
|
|
253
259
|
visibilityOptions: ctx.client.pages.visibilityOptions(),
|
|
254
260
|
pageErrors: {
|
|
@@ -267,6 +273,7 @@ describe("Publish page revision", () => {
|
|
|
267
273
|
title: "A new revision!",
|
|
268
274
|
description: "Nice!",
|
|
269
275
|
visibility: "public",
|
|
276
|
+
type: "later",
|
|
270
277
|
};
|
|
271
278
|
|
|
272
279
|
const ctx = buildCtx(revision, {
|
|
@@ -312,6 +319,7 @@ describe("Publish page revision", () => {
|
|
|
312
319
|
visibility: publishing.visibility,
|
|
313
320
|
username: publishing.username,
|
|
314
321
|
password: publishing.password,
|
|
322
|
+
type: publishing.type,
|
|
315
323
|
},
|
|
316
324
|
visibilityOptions: ctx.client.pages.visibilityOptions(),
|
|
317
325
|
errors: {
|
|
@@ -37,6 +37,7 @@ describe("Publish page revision", () => {
|
|
|
37
37
|
visibility: revision.visibility,
|
|
38
38
|
username: revision.settings?.credentials?.user,
|
|
39
39
|
password: revision.settings?.credentials?.password,
|
|
40
|
+
type: "now",
|
|
40
41
|
},
|
|
41
42
|
visibilityOptions: ctx.client.pages.visibilityOptions(),
|
|
42
43
|
errors: {},
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
<div class="mb-4 text-red-500">A page with this URL already exists</div>
|
|
5
5
|
<% } %>
|
|
6
6
|
|
|
7
|
-
<%- f.field('publishing.
|
|
8
|
-
<%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
|
|
9
|
-
|
|
7
|
+
<%- f.field('publishing.type', { as: 'radio_group', label: "", options: [["now", "Publish now"], ["later", "Schedule for a date"]] }) %>
|
|
10
8
|
<%- f.field('publishing.mergeAt', { type: 'datetime-local', label: 'Publish revision at (UTC)' }) %>
|
|
11
9
|
|
|
10
|
+
<%- f.field('publishing.title'), { required: true, hint: "Appears in the history of changes" } %>
|
|
11
|
+
<%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
|
|
12
12
|
<%- f.field('publishing.visibility', { as: 'select', required: true, options: visibilityOptions }) %>
|
|
13
13
|
<%- f.field('publishing.username', { required: true }) %>
|
|
14
14
|
<%- f.field('publishing.password', { required: true }) %>
|
|
@@ -23,6 +23,33 @@
|
|
|
23
23
|
</form>
|
|
24
24
|
<% }) %>
|
|
25
25
|
|
|
26
|
+
<script>
|
|
27
|
+
// Takes care of the publishint time!
|
|
28
|
+
const typeEl = document.getElementById("f_publishing_type")
|
|
29
|
+
const mergeAtEl = document.getElementById("f_publishing_mergeAt")
|
|
30
|
+
|
|
31
|
+
function radioGroupValue(radioGroup) {
|
|
32
|
+
let val = "";
|
|
33
|
+
radioGroup.querySelectorAll('input[type="radio"]').forEach(input => {
|
|
34
|
+
if (input.checked) {
|
|
35
|
+
val = input.value
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
return val;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function handleTypeChange(value) {
|
|
42
|
+
const shouldShowMergeAt = value === "later"
|
|
43
|
+
if (shouldShowMergeAt) {
|
|
44
|
+
mergeAtEl.parentNode.classList.remove('hidden')
|
|
45
|
+
} else {
|
|
46
|
+
mergeAtEl.parentNode.classList.add('hidden')
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
typeEl.addEventListener("change", (e) => handleTypeChange(e.target.value))
|
|
50
|
+
handleTypeChange(radioGroupValue(typeEl))
|
|
51
|
+
</script>
|
|
52
|
+
|
|
26
53
|
<script>
|
|
27
54
|
const visibilityEl = document.getElementById("f_publishing_visibility");
|
|
28
55
|
const usernameEl = document.getElementById("f_publishing_username").parentElement;
|
|
@@ -191,14 +191,6 @@
|
|
|
191
191
|
<%- f.submit('Remove schedule', { class: 'btn-text' }) %>
|
|
192
192
|
</form>
|
|
193
193
|
|
|
194
|
-
<button hx-delete="<%= `/${_context.locale}/${_context.resourceConfig.articleType}_revisions/${revision.id}` %>" hx-confirm="Are you sure?" type="button" class="btn-danger has-icon <%= revision.meta && revision.meta.locked ? 'cursor-not-allowed text-gray-400 pointer-events-none' : '' %>">
|
|
195
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
|
|
196
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
|
197
|
-
</svg>
|
|
198
|
-
|
|
199
|
-
Delete
|
|
200
|
-
</button>
|
|
201
|
-
|
|
202
194
|
<a href="/remote/login?redirect_to=/<%= _context.locale %>/admin/<%= _context.resourceConfig.articleType %>-revisions/<%= revision.id %>/preview" target="_blank" class="btn-text has-icon">
|
|
203
195
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
|
|
204
196
|
<path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" />
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
<div class="mb-4 text-red-500">A page with this URL already exists</div>
|
|
5
5
|
<% } %>
|
|
6
6
|
|
|
7
|
-
<%- f.field('publishing.
|
|
8
|
-
<%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
|
|
9
|
-
|
|
7
|
+
<%- f.field('publishing.type', { as: 'radio_group', label: "", options: [["now", "Publish now"], ["later", "Schedule for a date"]] }) %>
|
|
10
8
|
<%- f.field('publishing.mergeAt', { type: 'datetime-local', label: 'Publish revision at (UTC)' }) %>
|
|
11
9
|
|
|
10
|
+
<%- f.field('publishing.title'), { required: true, hint: "Appears in the history of changes" } %>
|
|
11
|
+
<%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
|
|
12
12
|
<%- f.field('publishing.visibility', { as: 'select', required: true, options: visibilityOptions }) %>
|
|
13
13
|
<%- f.field('publishing.username', { required: true }) %>
|
|
14
14
|
<%- f.field('publishing.password', { required: true }) %>
|
|
@@ -23,6 +23,40 @@
|
|
|
23
23
|
</form>
|
|
24
24
|
<% }) %>
|
|
25
25
|
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
// Takes care of the publishint time!
|
|
29
|
+
const typeEl = document.getElementById("f_publishing_type")
|
|
30
|
+
const mergeAtEl = document.getElementById("f_publishing_mergeAt")
|
|
31
|
+
|
|
32
|
+
function radioGroupValue(radioGroup) {
|
|
33
|
+
let val = "";
|
|
34
|
+
|
|
35
|
+
radioGroup.querySelectorAll('input[type="radio"]').forEach(input => {
|
|
36
|
+
|
|
37
|
+
if (input.checked) {
|
|
38
|
+
val = input.value
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
return val;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function handleTypeChange(value) {
|
|
47
|
+
const shouldShowMergeAt = value === "later"
|
|
48
|
+
|
|
49
|
+
if (shouldShowMergeAt) {
|
|
50
|
+
mergeAtEl.parentNode.classList.remove('hidden')
|
|
51
|
+
} else {
|
|
52
|
+
mergeAtEl.parentNode.classList.add('hidden')
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
typeEl.addEventListener("change", (e) => handleTypeChange(e.target.value))
|
|
57
|
+
handleTypeChange(radioGroupValue(typeEl))
|
|
58
|
+
</script>
|
|
59
|
+
|
|
26
60
|
<script>
|
|
27
61
|
const visibilityEl = document.getElementById("f_publishing_visibility");
|
|
28
62
|
const usernameEl = document.getElementById("f_publishing_username").parentElement;
|
|
@@ -191,14 +191,6 @@
|
|
|
191
191
|
<%- f.submit('Remove schedule', { class: 'btn-text' }) %>
|
|
192
192
|
</form>
|
|
193
193
|
|
|
194
|
-
<button hx-delete="<%= `/${_context.locale}/${_context.resourceConfig.eventType}_revisions/${revision.id}` %>" hx-confirm="Are you sure?" type="button" class="btn-danger has-icon <%= revision.meta && revision.meta.locked ? 'cursor-not-allowed text-gray-400 pointer-events-none' : '' %>">
|
|
195
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
|
|
196
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
|
197
|
-
</svg>
|
|
198
|
-
|
|
199
|
-
Delete
|
|
200
|
-
</button>
|
|
201
|
-
|
|
202
194
|
<a href="/remote/login?redirect_to=/<%= _context.locale %>/admin/<%= _context.resourceConfig.eventType %>-revisions/<%= revision.id %>/preview" target="_blank" class="btn-text has-icon">
|
|
203
195
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
|
|
204
196
|
<path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" />
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
<div class="mb-4 text-red-500">A page with this URL already exists</div>
|
|
5
5
|
<% } %>
|
|
6
6
|
|
|
7
|
-
<%- f.field('publishing.
|
|
8
|
-
<%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
|
|
9
|
-
|
|
7
|
+
<%- f.field('publishing.type', { as: 'radio_group', label: "", options: [["now", "Publish now"], ["later", "Schedule for a date"]] }) %>
|
|
10
8
|
<%- f.field('publishing.mergeAt', { type: 'datetime-local', label: 'Publish revision at (UTC)' }) %>
|
|
11
9
|
|
|
10
|
+
<%- f.field('publishing.title'), { required: true, hint: "Appears in the history of changes" } %>
|
|
11
|
+
<%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
|
|
12
12
|
<%- f.field('publishing.visibility', { as: 'select', required: true, options: visibilityOptions }) %>
|
|
13
13
|
<%- f.field('publishing.username', { required: true }) %>
|
|
14
14
|
<%- f.field('publishing.password', { required: true }) %>
|
|
@@ -23,6 +23,39 @@
|
|
|
23
23
|
</form>
|
|
24
24
|
<% }) %>
|
|
25
25
|
|
|
26
|
+
<script>
|
|
27
|
+
// Takes care of the publishint time!
|
|
28
|
+
const typeEl = document.getElementById("f_publishing_type")
|
|
29
|
+
const mergeAtEl = document.getElementById("f_publishing_mergeAt")
|
|
30
|
+
|
|
31
|
+
function radioGroupValue(radioGroup) {
|
|
32
|
+
let val = "";
|
|
33
|
+
|
|
34
|
+
radioGroup.querySelectorAll('input[type="radio"]').forEach(input => {
|
|
35
|
+
|
|
36
|
+
if (input.checked) {
|
|
37
|
+
val = input.value
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
return val;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function handleTypeChange(value) {
|
|
46
|
+
const shouldShowMergeAt = value === "later"
|
|
47
|
+
|
|
48
|
+
if (shouldShowMergeAt) {
|
|
49
|
+
mergeAtEl.parentNode.classList.remove('hidden')
|
|
50
|
+
} else {
|
|
51
|
+
mergeAtEl.parentNode.classList.add('hidden')
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
typeEl.addEventListener("change", (e) => handleTypeChange(e.target.value))
|
|
56
|
+
handleTypeChange(radioGroupValue(typeEl))
|
|
57
|
+
</script>
|
|
58
|
+
|
|
26
59
|
<script>
|
|
27
60
|
const visibilityEl = document.getElementById("f_publishing_visibility");
|
|
28
61
|
const usernameEl = document.getElementById("f_publishing_username").parentElement;
|
package/src/views/pages/show.ejs
CHANGED
|
@@ -192,14 +192,6 @@
|
|
|
192
192
|
<%- f.submit('Remove schedule', { class: 'btn-text' }) %>
|
|
193
193
|
</form>
|
|
194
194
|
|
|
195
|
-
<button hx-delete="<%= `/${_context.locale}/${_context.resourceConfig.pageType}_revisions/${revision.id}` %>" hx-confirm="Are you sure?" type="button" class="btn-danger has-icon <%= revision.meta && revision.meta.locked ? 'cursor-not-allowed text-gray-400 pointer-events-none' : '' %>">
|
|
196
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
|
|
197
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
|
198
|
-
</svg>
|
|
199
|
-
|
|
200
|
-
Delete
|
|
201
|
-
</button>
|
|
202
|
-
|
|
203
195
|
<a href="/remote/login?redirect_to=/<%= _context.locale %>/admin/<%= _context.resourceConfig.pageType %>-revisions/<%= revision.id %>/preview" target="_blank" class="btn-text has-icon">
|
|
204
196
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
|
|
205
197
|
<path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" />
|