@raketa-cloud/admin 0.0.103 → 1.0.1

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.
Files changed (63) hide show
  1. package/package.json +1 -1
  2. package/src/cloud/ArticleRevisions.js +2 -2
  3. package/src/cloud/Articles.js +3 -3
  4. package/src/cloud/EventRevisions.js +2 -2
  5. package/src/cloud/Events.js +8 -3
  6. package/src/handlers/article_revisions/CodeHandler.js +3 -3
  7. package/src/handlers/article_revisions/GeneralHandler.js +3 -3
  8. package/src/handlers/article_revisions/MetaHandler.js +3 -3
  9. package/src/handlers/article_revisions/TagHandler.js +3 -3
  10. package/src/handlers/article_revisions/VisualHandler.js +3 -3
  11. package/src/handlers/articles/ArticlesHandler.js +2 -2
  12. package/src/handlers/event_revisions/CodeHandler.js +3 -3
  13. package/src/handlers/event_revisions/GeneralHandler.js +3 -3
  14. package/src/handlers/event_revisions/MetaHandler.js +3 -3
  15. package/src/handlers/event_revisions/TagHandler.js +3 -3
  16. package/src/handlers/event_revisions/VisualHandler.js +3 -3
  17. package/src/handlers/events/EventsHandler.js +2 -2
  18. package/src/helpers/utils.js +19 -0
  19. package/src/tests/handlers/article_revisions/CodesHandler.test/edit_form.test.js +1 -1
  20. package/src/tests/handlers/article_revisions/CodesHandler.test/update.test.js +1 -1
  21. package/src/tests/handlers/article_revisions/GeneralHandler.test/edit_form.test.js +1 -1
  22. package/src/tests/handlers/article_revisions/GeneralHandler.test/update.test.js +5 -5
  23. package/src/tests/handlers/article_revisions/MetaHandler.test/edit_form.test.js +1 -1
  24. package/src/tests/handlers/article_revisions/MetaHandler.test/update.test.js +1 -1
  25. package/src/tests/handlers/article_revisions/TagHandler.test/edit_form.test.js +1 -1
  26. package/src/tests/handlers/article_revisions/TagHandler.test/update.test.js +1 -1
  27. package/src/tests/handlers/article_revisions/VisualHandler.test.test/edit_form.test.js +1 -1
  28. package/src/tests/handlers/article_revisions/VisualHandler.test.test/update.test.js +1 -1
  29. package/src/tests/handlers/articles/ArticlesHandler.test/create.test.js +5 -5
  30. package/src/tests/handlers/event_revisions/CodesHandler.test/edit_form.test.js +1 -1
  31. package/src/tests/handlers/event_revisions/CodesHandler.test/update.test.js +1 -1
  32. package/src/tests/handlers/event_revisions/GeneralHandler.test/edit_form.test.js +1 -1
  33. package/src/tests/handlers/event_revisions/GeneralHandler.test/update.test.js +5 -5
  34. package/src/tests/handlers/event_revisions/MetaHandler.test/edit_form.test.js +1 -1
  35. package/src/tests/handlers/event_revisions/MetaHandler.test/update.test.js +1 -1
  36. package/src/tests/handlers/event_revisions/TagHandler.test/edit_form.test.js +1 -1
  37. package/src/tests/handlers/event_revisions/TagHandler.test/update.test.js +1 -1
  38. package/src/tests/handlers/event_revisions/VisualHandler.test.test/edit_form.test.js +1 -1
  39. package/src/tests/handlers/event_revisions/VisualHandler.test.test/update.test.js +1 -1
  40. package/src/tests/handlers/events/EventsHandler.test/create.test.js +5 -5
  41. package/src/utils.js +29 -2
  42. package/src/views/article_revisions/_nav.ejs +10 -1
  43. package/src/views/article_revisions/general/_form.ejs +2 -2
  44. package/src/views/articles/_form.ejs +2 -2
  45. package/src/views/articles/_shared/history_table.ejs +2 -2
  46. package/src/views/articles/history/index.ejs +0 -7
  47. package/src/views/articles/index.ejs +4 -11
  48. package/src/views/articles/show.ejs +2 -2
  49. package/src/views/event_revisions/_nav.ejs +10 -1
  50. package/src/views/event_revisions/general/_form.ejs +2 -2
  51. package/src/views/events/_form.ejs +2 -2
  52. package/src/views/events/_shared/history_table.ejs +2 -2
  53. package/src/views/events/history/index.ejs +0 -7
  54. package/src/views/events/index.ejs +4 -11
  55. package/src/views/events/show.ejs +2 -2
  56. package/src/views/layouts/application.ejs +45 -0
  57. package/src/views/page_revisions/_nav.ejs +10 -1
  58. package/src/views/pages/_shared/history_table.ejs +2 -2
  59. package/src/views/pages/history/index.ejs +0 -7
  60. package/src/views/pages/index.ejs +2 -9
  61. package/src/views/pages/show.ejs +2 -2
  62. package/src/views/redirects/index.ejs +1 -1
  63. package/src/views/redirects/show.ejs +2 -2
@@ -134,7 +134,7 @@ describe("Event revision meta settings", () => {
134
134
  assigns: {
135
135
  resource: {
136
136
  ...revision,
137
- publishAt: "2024-10-10T07:05:00",
137
+ publishAt: "2024-10-10",
138
138
  startsAt: "2024-10-10T07:15:00",
139
139
  endsAt: "2024-10-10T07:25:00",
140
140
  settings: {
@@ -48,7 +48,7 @@ describe("Event revision tags settings", () => {
48
48
  assigns: {
49
49
  resource: {
50
50
  ...revision,
51
- publishAt: "2024-10-10T07:00:00",
51
+ publishAt: "2024-10-10",
52
52
  startsAt: "2024-10-10T07:05:00",
53
53
  endsAt: "2024-10-10T07:15:00",
54
54
  tags: [tags[0].id],
@@ -129,7 +129,7 @@ describe("Event revision tags settings", () => {
129
129
  assigns: {
130
130
  resource: {
131
131
  ...revision,
132
- publishAt: "2024-10-10T07:00:00",
132
+ publishAt: "2024-10-10",
133
133
  startsAt: "2024-10-10T07:05:00",
134
134
  endsAt: "2024-10-10T07:15:00",
135
135
  tags: updateSettings.tags,
@@ -34,7 +34,7 @@ describe("Event revision visuals settings", () => {
34
34
  assigns: {
35
35
  resource: {
36
36
  ...revision,
37
- publishAt: "2024-10-10T21:00:00",
37
+ publishAt: "2024-10-10",
38
38
  startsAt: "2024-10-10T21:05:00",
39
39
  endsAt: "2024-10-10T21:10:00",
40
40
  },
@@ -120,7 +120,7 @@ describe("Event revision visuals settings", () => {
120
120
  assigns: {
121
121
  resource: {
122
122
  ...revision,
123
- publishAt: "2024-10-10T07:00:00",
123
+ publishAt: "2024-10-10",
124
124
  startsAt: "2024-10-10T07:05:00",
125
125
  endsAt: "2024-10-10T07:10:00",
126
126
  settings: {
@@ -28,7 +28,7 @@ describe("Events Handler", () => {
28
28
  title: "event title",
29
29
  slug: "url",
30
30
  visibility: "public",
31
- publishAt: "2024-10-10T06:40",
31
+ publishAt: "2024-10-10",
32
32
  startsAt: "2024-10-10T06:50",
33
33
  endsAt: "2024-10-10T06:59",
34
34
  settings: {
@@ -59,7 +59,7 @@ describe("Events Handler", () => {
59
59
  title: params.title,
60
60
  slug: params.slug,
61
61
  visibility: params.visibility,
62
- publishAt: "2024-10-10T06:40:00Z",
62
+ publishAt: "2024-10-10T00:00:00Z",
63
63
  startsAt: "2024-10-10T06:50:00Z",
64
64
  endsAt: "2024-10-10T06:59:00Z",
65
65
  settings: {
@@ -87,7 +87,7 @@ describe("Events Handler", () => {
87
87
  const params = {
88
88
  title: "event title",
89
89
  slug: "",
90
- publishAt: "2024-10-10T06:40",
90
+ publishAt: "2024-10-10",
91
91
  startsAt: "2024-10-10T06:50",
92
92
  endsAt: "2024-10-10T06:59",
93
93
  visibility: "public",
@@ -127,7 +127,7 @@ describe("Events Handler", () => {
127
127
  title: params.title,
128
128
  slug: "",
129
129
  visibility: params.visibility,
130
- publishAt: "2024-10-10T06:40:00Z",
130
+ publishAt: "2024-10-10T00:00:00Z",
131
131
  startsAt: "2024-10-10T06:50:00Z",
132
132
  endsAt: "2024-10-10T06:59:00Z",
133
133
  settings: {
@@ -149,7 +149,7 @@ describe("Events Handler", () => {
149
149
  assigns: {
150
150
  resource: {
151
151
  ...params,
152
- publishAt: "2024-10-10T06:40:00",
152
+ publishAt: "2024-10-10",
153
153
  startsAt: "2024-10-10T06:50:00",
154
154
  endsAt: "2024-10-10T06:59:00",
155
155
  settings: {
package/src/utils.js CHANGED
@@ -1,8 +1,35 @@
1
- export function toUTCISO8601String(inputDate) {
1
+ export function toUTCISO8601String(inputDateTime) {
2
2
  // The format coming from the datetie-local input is YYYY-mm-ddTHH:MM
3
3
  // e.g. 2024-10-10T14:25
4
4
  // Currently we will just use that as a UTC value and show some explanation in the UI!
5
- return `${inputDate}:00Z`;
5
+ return `${inputDateTime}:00Z`;
6
+ }
7
+
8
+ export function dateToUTCISO8601String(inputDate) {
9
+ // The format coming from the datetie-local input is YYYY-mm-ddTHH:MM
10
+ // e.g. 2024-10-10
11
+ // Currently we will just use that as a UTC value and show some explanation in the UI!
12
+ return `${inputDate}T00:00:00Z`;
13
+ }
14
+
15
+ export function toDateInput(initialDate = null) {
16
+ if (typeof initialDate === "string") {
17
+ // The case where it comes from the DB it is in UTC. We are going to directly feed it to the
18
+ // datetime-local input and add explanations in the UI!
19
+ return initialDate.slice(0, 10);
20
+ }
21
+
22
+ // Directly use the current time for to feed the datetime-local input.
23
+ // show UI hints that this is going to be used as UTC time.
24
+ const now = new Date();
25
+
26
+ return [
27
+ now.getFullYear(),
28
+ "-",
29
+ (now.getMonth() + 1).toString().padStart(2, "0"),
30
+ "-",
31
+ now.getDate().toString().padStart(2, "0"),
32
+ ].join("");
6
33
  }
7
34
 
8
35
  export function toDateTimeInput(initialDate = null) {
@@ -7,7 +7,7 @@
7
7
  const inactiveClass = "relative top-0.5 px-4 border-b-2 border-transparent pb-4";
8
8
  %>
9
9
 
10
- <div class="flex w-full pb-4">
10
+ <div class="flex gap-4 w-full pb-4">
11
11
  <div class="flex items-center justify-between mb-4">
12
12
  <div class="flex items-center border-b-2">
13
13
  <div class=" <%= active === 'general' ? activeClass : inactiveClass %>">
@@ -41,4 +41,13 @@
41
41
  </div>
42
42
  </div>
43
43
  </div>
44
+
45
+ <div>
46
+ <a href="/remote/login?redirect_to=/<%= _context.locale %>/admin/<%= _context.resourceConfig.articleType %>-revisions/<%= resource.id %>/builder" class="btn-secondary has-icon <%= resource.meta && resource.meta.locked ? 'cursor-not-allowed text-gray-400 pointer-events-none' : '' %>">
47
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
48
+ <path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125" />
49
+ </svg>
50
+ Edit content
51
+ </a>
52
+ </div>
44
53
  </div>
@@ -2,7 +2,7 @@
2
2
  <form action="<%= `/${_context.locale}/${_context.resourceConfig.articleType}_revisions/${resource.id}/general` %>" method="POST" class="form">
3
3
  <%- f.field('resource.title', { required: true }) %>
4
4
  <%- f.field('resource.slug', { label: "URL", required: true, hint: "Only lowercase letters, numbers and dash allowed. E.g: celebrate-friday-13" }) %>
5
- <%- f.field('resource.publishAt', { required: true, type: 'datetime-local', label: 'Publish at (UTC)' }) %>
5
+ <%- f.field('resource.publishAt', { required: true, type: 'date', label: `${Inflector.capitalize(_context.resourceConfig.articleType)} post date` }) %>
6
6
  <%- f.field('resource.visibility', { as: 'select', required: true, options: visibilityOptions }) %>
7
7
 
8
8
  <%- include('../../_shared/_credentials_input.ejs', { f, visibilityFieldId: "f_resource_visibility"}) %>
@@ -14,4 +14,4 @@
14
14
  </div>
15
15
  </div>
16
16
  </form>
17
- <% }) %>
17
+ <% }) %>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <%- f.field('resource.title', { required: true }) %>
6
6
  <%- f.field('resource.slug', { label: "URL", required: true, hint: "Only lowercase letters, numbers and dash allowed. Ex: celebrate-friday-13" }) %>
7
- <%- f.field('resource.publishAt', { required: true, type: 'datetime-local', label: 'Publish at (UTC)' }) %>
7
+ <%- f.field('resource.publishAt', { required: true, type: 'date', label: `${Inflector.capitalize(_context.resourceConfig.articleType)} post date` }) %>
8
8
  <%- f.field('resource.visibility', { as: 'select', required: true, options: visibilityOptions }) %>
9
9
 
10
10
  <%- include('../_shared/_credentials_input.ejs', { f, visibilityFieldId: "f_resource_visibility"}) %>
@@ -42,4 +42,4 @@
42
42
  <% } %>
43
43
  </div>
44
44
  </form>
45
- <% }) %>
45
+ <% }) %>
@@ -25,7 +25,7 @@
25
25
  <td class="whitespace-nowrap">
26
26
  <div class="body-3 text-raketa-foreground/50">
27
27
  <div class="flex items-center gap-1">
28
- <time data-pretty-datetime datetime="<%= change.insertedAt %>"><%= change.insertedAt %></time>
28
+ <time data-pretty-datetime datetime="<%= change.insertedAt %>"><%= utils.formattedDateTime(change.insertedAt) %></time>
29
29
  </div>
30
30
  </div>
31
31
  </td>
@@ -65,4 +65,4 @@
65
65
  <% if (!skipPagination) { %>
66
66
  <%- pagination(changes.pagination, _context) %>
67
67
  <% } %>
68
- </div>
68
+ </div>
@@ -78,10 +78,3 @@
78
78
  </form>
79
79
  </div>
80
80
 
81
- <script>
82
- const sidebar = document.querySelector("[data-sidebar]");
83
- const searchToggle = document.querySelector('[data-toggle-sidebar]');
84
- searchToggle.addEventListener('click', () => {
85
- sidebar.classList.toggle('hidden');
86
- });
87
- </script>
@@ -20,7 +20,7 @@
20
20
  <tr>
21
21
  <th><%- sort_button("Title", "title", _context) %></th>
22
22
  <th>Visibility</th>
23
- <th><%- sort_button("Publish at", "publish_at", _context) %></th>
23
+ <th><%- sort_button(`${Inflector.capitalize(_context.resourceConfig.articleType)} post date`, "publish_at", _context) %></th>
24
24
  <th><%- sort_button("Last change", "updated_at", _context) %></th>
25
25
  <th>Translations</th>
26
26
  </tr>
@@ -47,7 +47,7 @@
47
47
  </td>
48
48
 
49
49
  <td>
50
- <div class="flex itemx-center gap-1 whitespace-nowrap">
50
+ <div class="flex items-center gap-1 whitespace-nowrap">
51
51
  <span class="text-raketa-foreground/30" title="<%= visibilityOptions.find(opt => opt[0] === item.visibility)[1] %>">
52
52
  <% if (item.visibility === 'public') { %>
53
53
  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
@@ -78,7 +78,7 @@
78
78
  </td>
79
79
 
80
80
  <td>
81
- <time data-pretty-datetime datetime="<%= item.publishAt %>"><%= item.publishAt %></time>
81
+ <time data-pretty-date datetime="<%= item.publishAt %>"><%= utils.formattedDate(item.publishAt) %></time>
82
82
  </td>
83
83
 
84
84
  <td>
@@ -87,7 +87,7 @@
87
87
  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4 text-raketa-foreground">
88
88
  <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
89
89
  </svg>
90
- <time data-pretty-datetime datetime="<%= item.updatedAt %>"><%= item.updatedAt %></time>
90
+ <time data-pretty-datetime datetime="<%= item.updatedAt %>"><%= utils.formattedDateTime(item.updatedAt) %></time>
91
91
  </div>
92
92
 
93
93
  <div class="flex items-center gap-1" title="<%= item.changes[0]?.operatorMeta?.name %>">
@@ -162,10 +162,3 @@
162
162
  </form>
163
163
  </div>
164
164
 
165
- <script>
166
- const sidebar = document.querySelector("[data-sidebar]");
167
- const searchToggle = document.querySelector('[data-toggle-sidebar]');
168
- searchToggle.addEventListener('click', () => {
169
- sidebar.classList.toggle('hidden');
170
- });
171
- </script>
@@ -103,7 +103,7 @@
103
103
  <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
104
104
  </svg>
105
105
 
106
- <time data-pretty-datetime datetime="<%= revision.insertedAt %>"><%= revision.insertedAt %></time>
106
+ <time data-pretty-datetime datetime="<%= revision.insertedAt %>"><%= utils.formattedDateTime(revision.insertedAt) %></time>
107
107
  </div>
108
108
  </div>
109
109
  </td>
@@ -231,4 +231,4 @@
231
231
  Full page history
232
232
  </a>
233
233
  </div>
234
- </div>
234
+ </div>
@@ -7,7 +7,7 @@
7
7
  const inactiveClass = "relative top-0.5 px-4 border-b-2 border-transparent pb-4";
8
8
  %>
9
9
 
10
- <div class="flex w-full pb-4">
10
+ <div class="flex gap-4 w-full pb-4">
11
11
  <div class="flex items-center justify-between mb-4">
12
12
  <div class="flex items-center border-b-2">
13
13
  <div class=" <%= active === 'general' ? activeClass : inactiveClass %>">
@@ -41,4 +41,13 @@
41
41
  </div>
42
42
  </div>
43
43
  </div>
44
+
45
+ <div>
46
+ <a href="/remote/login?redirect_to=/<%= _context.locale %>/admin/<%= _context.resourceConfig.eventType %>-revisions/<%= resource.id %>/builder" class="btn-secondary has-icon <%= resource.meta && resource.meta.locked ? 'cursor-not-allowed text-gray-400 pointer-events-none' : '' %>">
47
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
48
+ <path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125" />
49
+ </svg>
50
+ Edit content
51
+ </a>
52
+ </div>
44
53
  </div>
@@ -2,7 +2,7 @@
2
2
  <form action="<%= `/${_context.locale}/${_context.resourceConfig.eventType}_revisions/${resource.id}/general` %>" method="POST" class="form">
3
3
  <%- f.field('resource.title', { required: true }) %>
4
4
  <%- f.field('resource.slug', { label: "URL", required: true, hint: "Only lowercase letters, numbers and dash allowed. E.g: celebrate-friday-13" }) %>
5
- <%- f.field('resource.publishAt', { required: true, type: 'datetime-local', label: 'Publish at (UTC)' }) %>
5
+ <%- f.field('resource.publishAt', { required: true, type: 'date', label: `${Inflector.capitalize(_context.resourceConfig.eventType)} post date` }) %>
6
6
  <%- f.field('resource.startsAt', { required: true, type: 'datetime-local', label: 'Starts at (UTC)' }) %>
7
7
  <%- f.field('resource.endsAt', { required: true, type: 'datetime-local', label: 'Ends at (UTC)' }) %>
8
8
  <%- f.field('resource.visibility', { as: 'select', required: true, options: visibilityOptions }) %>
@@ -16,4 +16,4 @@
16
16
  </div>
17
17
  </div>
18
18
  </form>
19
- <% }) %>
19
+ <% }) %>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <%- f.field('resource.title', { required: true }) %>
6
6
  <%- f.field('resource.slug', { label: "URL", required: true, hint: "Only lowercase letters, numbers and dash allowed. Ex: celebrate-friday-13" }) %>
7
- <%- f.field('resource.publishAt', { required: true, type: 'datetime-local', label: 'Publish at (UTC)' }) %>
7
+ <%- f.field('resource.publishAt', { required: true, type: 'date', label: `${Inflector.capitalize(_context.resourceConfig.eventType)} post date` }) %>
8
8
  <%- f.field('resource.startsAt', { required: true, type: 'datetime-local', label: 'Starts at (UTC)' }) %>
9
9
  <%- f.field('resource.endsAt', { required: true, type: 'datetime-local', label: 'Ends at (UTC)' }) %>
10
10
  <%- f.field('resource.visibility', { as: 'select', required: true, options: visibilityOptions }) %>
@@ -44,4 +44,4 @@
44
44
  <% } %>
45
45
  </div>
46
46
  </form>
47
- <% }) %>
47
+ <% }) %>
@@ -25,7 +25,7 @@
25
25
  <td class="whitespace-nowrap">
26
26
  <div class="body-3 text-raketa-foreground/50">
27
27
  <div class="flex items-center gap-1">
28
- <time data-pretty-datetime datetime="<%= change.insertedAt %>"><%= change.insertedAt %></time>
28
+ <time data-pretty-datetime datetime="<%= change.insertedAt %>"><%= utils.formattedDateTime(change.insertedAt) %></time>
29
29
  </div>
30
30
  </div>
31
31
  </td>
@@ -65,4 +65,4 @@
65
65
  <% if (!skipPagination) { %>
66
66
  <%- pagination(changes.pagination, _context) %>
67
67
  <% } %>
68
- </div>
68
+ </div>
@@ -78,10 +78,3 @@
78
78
  </form>
79
79
  </div>
80
80
 
81
- <script>
82
- const sidebar = document.querySelector("[data-sidebar]");
83
- const searchToggle = document.querySelector('[data-toggle-sidebar]');
84
- searchToggle.addEventListener('click', () => {
85
- sidebar.classList.toggle('hidden');
86
- });
87
- </script>
@@ -20,7 +20,7 @@
20
20
  <tr>
21
21
  <th><%- sort_button("Title", "title", _context) %></th>
22
22
  <th>Visibility</th>
23
- <th><%- sort_button("Publish at", "publish_at", _context) %></th>
23
+ <th><%- sort_button(`${Inflector.capitalize(_context.resourceConfig.eventType)} post date`, "publish_at", _context) %></th>
24
24
  <th><%- sort_button("Last change", "updated_at", _context) %></th>
25
25
  <th>Translations</th>
26
26
  </tr>
@@ -47,7 +47,7 @@
47
47
  </td>
48
48
 
49
49
  <td>
50
- <div class="flex itemx-center gap-1 whitespace-nowrap">
50
+ <div class="flex items-center gap-1 whitespace-nowrap">
51
51
  <span class="text-raketa-foreground/30" title="<%= visibilityOptions.find(opt => opt[0] === item.visibility)[1] %>">
52
52
  <% if (item.visibility === 'public') { %>
53
53
  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
@@ -78,7 +78,7 @@
78
78
  </td>
79
79
 
80
80
  <td>
81
- <time data-pretty-datetime datetime="<%= item.publishAt %>"><%= item.publishAt %></time>
81
+ <time data-pretty-date datetime="<%= item.publishAt %>"><%= utils.formattedDate(item.publishAt) %></time>
82
82
  </td>
83
83
 
84
84
  <td>
@@ -87,7 +87,7 @@
87
87
  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4 text-raketa-foreground">
88
88
  <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
89
89
  </svg>
90
- <time data-pretty-datetime datetime="<%= item.updatedAt %>"><%= item.updatedAt %></time>
90
+ <time data-pretty-datetime datetime="<%= item.updatedAt %>"><%= utils.formattedDateTime(item.updatedAt) %></time>
91
91
  </div>
92
92
 
93
93
  <div class="flex items-center gap-1" title="<%= item.changes[0]?.operatorMeta?.name %>">
@@ -162,10 +162,3 @@
162
162
  </form>
163
163
  </div>
164
164
 
165
- <script>
166
- const sidebar = document.querySelector("[data-sidebar]");
167
- const searchToggle = document.querySelector('[data-toggle-sidebar]');
168
- searchToggle.addEventListener('click', () => {
169
- sidebar.classList.toggle('hidden');
170
- });
171
- </script>
@@ -103,7 +103,7 @@
103
103
  <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
104
104
  </svg>
105
105
 
106
- <time data-pretty-datetime datetime="<%= revision.insertedAt %>"><%= revision.insertedAt %></time>
106
+ <time data-pretty-datetime datetime="<%= revision.insertedAt %>"><%= utils.formattedDateTime(revision.insertedAt) %></time>
107
107
  </div>
108
108
  </div>
109
109
  </td>
@@ -231,4 +231,4 @@
231
231
  Full page history
232
232
  </a>
233
233
  </div>
234
- </div>
234
+ </div>
@@ -218,6 +218,14 @@
218
218
  })
219
219
  })
220
220
 
221
+ document.querySelectorAll('time[data-pretty-date]').forEach(item => {
222
+ const dateStr = item.getAttribute("datetime");
223
+
224
+ item.innerText = new Date(dateStr).toLocaleString('en-GB', {
225
+ dateStyle: "short"
226
+ })
227
+ })
228
+
221
229
  document.querySelectorAll('time[data-pretty-expiration-time]').forEach(item => {
222
230
  const dateStr = item.getAttribute("datetime");
223
231
 
@@ -234,6 +242,43 @@
234
242
  })
235
243
  })
236
244
  </script>
245
+
246
+ <script>
247
+ const sidebar = document.querySelector("[data-sidebar]");
248
+
249
+ if (sidebar) {
250
+ const searchToggle = document.querySelector('[data-toggle-sidebar]');
251
+ const firstField = document.querySelector('[data-sidebar] input:not([type=hidden]), [data-sidebar] select, [data-sidebar] textarea');
252
+ searchToggle.addEventListener('click', () => {
253
+ sidebar.classList.toggle('hidden');
254
+ firstField.focus();
255
+ });
256
+ }
257
+ </script>
258
+
259
+ <script>
260
+ const forms = document.querySelectorAll('form');
261
+
262
+ if (forms.length > 0) {
263
+ forms.forEach((form) => {
264
+ const fields = form.querySelectorAll('input, select, textarea');
265
+ fields.forEach((field) => {
266
+ field.addEventListener('change', () => {
267
+ form.setAttribute('data-changed', 1);
268
+ });
269
+ });
270
+ });
271
+
272
+ window.addEventListener('beforeunload', (e) => {
273
+ const changedForms = document.querySelector('form[data-changed]');
274
+
275
+ if (changedForms) {
276
+ e.preventDefault();
277
+ return "You have unsaved changes. Are you sure you want to leave this page? ";
278
+ }
279
+ });
280
+ }
281
+ </script>
237
282
  </body>
238
283
 
239
284
  </html>
@@ -7,7 +7,7 @@
7
7
  const inactiveClass = "relative top-0.5 px-4 border-b-2 border-transparent pb-4";
8
8
  %>
9
9
 
10
- <div class="flex w-full pb-4">
10
+ <div class="flex gap-4 w-full pb-4">
11
11
  <div class="flex items-center justify-between mb-4">
12
12
  <div class="flex items-center border-b-2">
13
13
  <div class=" <%= active === 'general' ? activeClass : inactiveClass %>">
@@ -41,4 +41,13 @@
41
41
  </div>
42
42
  </div>
43
43
  </div>
44
+
45
+ <div>
46
+ <a href="/remote/login?redirect_to=/<%= _context.locale %>/admin/<%= _context.resourceConfig.pageType %>-revisions/<%= resource.id %>/builder" class="btn-secondary has-icon <%= resource.meta && resource.meta.locked ? 'cursor-not-allowed text-gray-400 pointer-events-none' : '' %>">
47
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
48
+ <path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125" />
49
+ </svg>
50
+ Edit content
51
+ </a>
52
+ </div>
44
53
  </div>
@@ -25,7 +25,7 @@
25
25
  <td class="whitespace-nowrap">
26
26
  <div class="body-3 text-raketa-foreground/50">
27
27
  <div class="flex items-center gap-1">
28
- <time data-pretty-datetime datetime="<%= change.insertedAt %>"><%= change.insertedAt %></time>
28
+ <time data-pretty-datetime datetime="<%= change.insertedAt %>"><%= utils.formattedDateTime(change.insertedAt) %></time>
29
29
  </div>
30
30
  </div>
31
31
  </td>
@@ -65,4 +65,4 @@
65
65
  <% if (!skipPagination) { %>
66
66
  <%- pagination(changes.pagination, _context) %>
67
67
  <% } %>
68
- </div>
68
+ </div>
@@ -78,10 +78,3 @@
78
78
  </form>
79
79
  </div>
80
80
 
81
- <script>
82
- const sidebar = document.querySelector("[data-sidebar]");
83
- const searchToggle = document.querySelector('[data-toggle-sidebar]');
84
- searchToggle.addEventListener('click', () => {
85
- sidebar.classList.toggle('hidden');
86
- });
87
- </script>
@@ -46,7 +46,7 @@
46
46
  </td>
47
47
 
48
48
  <td>
49
- <div class="flex itemx-center gap-1 whitespace-nowrap">
49
+ <div class="flex items-center gap-1 whitespace-nowrap">
50
50
  <span class="text-raketa-foreground/30" title="<%= visibilityOptions.find(opt => opt[0] === item.visibility)[1] %>">
51
51
  <% if (item.visibility === 'public') { %>
52
52
  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
@@ -82,7 +82,7 @@
82
82
  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4 text-raketa-foreground">
83
83
  <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
84
84
  </svg>
85
- <time data-pretty-datetime datetime="<%= item.updatedAt %>"><%= item.updatedAt %></time>
85
+ <time data-pretty-datetime datetime="<%= item.updatedAt %>"><%= utils.formattedDateTime(item.updatedAt) %></time>
86
86
  </div>
87
87
 
88
88
  <div class="flex items-center gap-1" title="<%= item.changes[0]?.operatorMeta?.name %>">
@@ -157,10 +157,3 @@
157
157
  </form>
158
158
  </div>
159
159
 
160
- <script>
161
- const sidebar = document.querySelector("[data-sidebar]");
162
- const searchToggle = document.querySelector('[data-toggle-sidebar]');
163
- searchToggle.addEventListener('click', () => {
164
- sidebar.classList.toggle('hidden');
165
- });
166
- </script>
@@ -104,7 +104,7 @@
104
104
  <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
105
105
  </svg>
106
106
 
107
- <time data-pretty-datetime datetime="<%= revision.insertedAt %>"><%= revision.insertedAt %></time>
107
+ <time data-pretty-datetime datetime="<%= revision.insertedAt %>"><%= utils.formattedDateTime(revision.insertedAt) %></time>
108
108
  </div>
109
109
  </div>
110
110
  </td>
@@ -232,4 +232,4 @@
232
232
  Full page history
233
233
  </a>
234
234
  </div>
235
- </div>
235
+ </div>
@@ -54,7 +54,7 @@
54
54
  <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
55
55
  </svg>
56
56
 
57
- <time data-pretty-datetime datetime="<%= item.updatedAt %>"><%= item.updatedAt %></time>
57
+ <time data-pretty-datetime datetime="<%= item.updatedAt %>"><%= utils.formattedDateTime(item.updatedAt) %></time>
58
58
  </div>
59
59
  </td>
60
60
  <td class="actions">
@@ -29,7 +29,7 @@
29
29
  </tr>
30
30
  <tr>
31
31
  <th class="w-1 whitespace-nowrap">Updated at</th>
32
- <time data-pretty-datetime datetime="<%= item.updatedAt %>"><%= item.updatedAt %></time>
32
+ <time data-pretty-datetime datetime="<%= item.updatedAt %>"><%= utils.formattedDateTime(item.updatedAt) %></time>
33
33
  </tr>
34
34
  </tbody>
35
35
  </table>
@@ -52,7 +52,7 @@
52
52
  <td><%= item.version %></td>
53
53
  <td><%= item.title %></td>
54
54
  <td><%= item.operatorMeta.name %></td>
55
- <td><time data-pretty-datetime datetime="<%= item.insertedAt %>"><%= item.insertedAt %></time></td>
55
+ <td><time data-pretty-datetime datetime="<%= item.insertedAt %>"><%= utils.formattedDateTime(item.insertedAt) %></time></td>
56
56
  </tr>
57
57
  <% }) %>
58
58
  </tbody>