@raketa-cloud/admin 1.7.8 → 1.8.0
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
CHANGED
package/src/HonoAdapter.js
CHANGED
|
@@ -319,6 +319,9 @@ export default class HonoAdapter {
|
|
|
319
319
|
// Build context object
|
|
320
320
|
const _context = {
|
|
321
321
|
timezones: i18n.timezones,
|
|
322
|
+
timeLocale: i18n.timeLocale,
|
|
323
|
+
dateTimeFormat: i18n.dateTimeFormat,
|
|
324
|
+
dateFormat: i18n.dateFormat,
|
|
322
325
|
locales: ctx.locales,
|
|
323
326
|
locale: ctx.locale,
|
|
324
327
|
defaultLocale: ctx.defaultLocale,
|
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<div class="
|
|
4
|
-
|
|
5
|
-
<div class="
|
|
6
|
-
<%
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
<% if (translations.length > 0) { %>
|
|
2
|
+
|
|
3
|
+
<div class="mb-4">
|
|
4
|
+
<label for="" class="font-semibold hover:cursor-pointer body-3">Translations</label>
|
|
5
|
+
<div class="checkbox-group mb-4">
|
|
6
|
+
<% translations.filter(item => item.code !== _context.locale).forEach((item,idx)=> { %>
|
|
7
|
+
<div class="flex items-center gap-1">
|
|
8
|
+
<% if (utils.includedInCollection(item.code, _context.query["f:translations"])) { %>
|
|
9
|
+
<input type="checkbox" name="f:translations" id='locale-<%= item.code %>' checked value="<%= item.code %>" class="hover:cursor-pointer">
|
|
10
|
+
<% } else { %>
|
|
11
|
+
<input type="checkbox" name="f:translations" id='locale-<%= item.code %>' value="<%= item.code %>" class="hover:cursor-pointer">
|
|
12
|
+
<% } %>
|
|
13
|
+
<label for='locale-<%= item.code %>' class="body-2 hover:cursor-pointer"><%= item.name %></label>
|
|
14
|
+
</div>
|
|
15
|
+
<% }); %>
|
|
12
16
|
</div>
|
|
13
|
-
<% }); %>
|
|
14
17
|
</div>
|
|
15
|
-
</div>
|
|
16
18
|
|
|
17
|
-
<div class="mb-4">
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
<div class="mb-4">
|
|
20
|
+
<label for="" class="font-semibold hover:cursor-pointer body-3">Without translations</label>
|
|
21
|
+
<div class="checkbox-group mb-4">
|
|
22
|
+
<% translations.filter(item => item.code !== _context.locale).forEach((item,idx)=> { %>
|
|
23
|
+
<div class="flex items-center gap-1">
|
|
24
|
+
<% if (utils.includedInCollection(item.code, _context.query["f:without_translations"])) { %>
|
|
25
|
+
<input type="checkbox" name="f:without_translations" id='n-locale-<%= item.code %>' checked value="<%= item.code %>" class="hover:cursor-pointer">
|
|
26
|
+
<% } else { %>
|
|
27
|
+
<input type="checkbox" name="f:without_translations" id='n-locale-<%= item.code %>' value="<%= item.code %>" class="hover:cursor-pointer">
|
|
28
|
+
<% } %>
|
|
29
|
+
<label for='n-locale-<%= item.code %>' class="body-2 hover:cursor-pointer"><%= item.name %></label>
|
|
30
|
+
</div>
|
|
31
|
+
<% }); %>
|
|
28
32
|
</div>
|
|
29
|
-
<% }); %>
|
|
30
33
|
</div>
|
|
31
|
-
|
|
34
|
+
<% } %>
|
|
@@ -153,12 +153,12 @@
|
|
|
153
153
|
|
|
154
154
|
<div class="mb-4">
|
|
155
155
|
<label for="last_updated_from" class="font-semibold hover:cursor-pointer body-3">Last Updated from</label>
|
|
156
|
-
<input type="datetime-local" name="f:last_updated_from" value="<%= _context.query["f:last_updated_from"] %>"
|
|
156
|
+
<input type="datetime-local" name="f:last_updated_from" value="<%= _context.query["f:last_updated_from"] %>" />
|
|
157
157
|
</div>
|
|
158
158
|
|
|
159
159
|
<div class="mb-4">
|
|
160
160
|
<label for="last_updated_to" class="font-semibold hover:cursor-pointer body-3">Last Updated to</label>
|
|
161
|
-
<input type="datetime-local" name="f:last_updated_to" value="<%= _context.query["f:last_updated_to"] %>"
|
|
161
|
+
<input type="datetime-local" name="f:last_updated_to" value="<%= _context.query["f:last_updated_to"] %>" />
|
|
162
162
|
</div>
|
|
163
163
|
|
|
164
164
|
<%- include('./../_shared/_translations_search_input.ejs') %>
|
|
@@ -143,7 +143,6 @@
|
|
|
143
143
|
<%- body %>
|
|
144
144
|
</div>
|
|
145
145
|
|
|
146
|
-
|
|
147
146
|
<script>
|
|
148
147
|
const toggleEl = document.getElementById('expand');
|
|
149
148
|
const sidebarEl = document.getElementById('sidebar');
|
|
@@ -163,8 +162,10 @@
|
|
|
163
162
|
</script>
|
|
164
163
|
|
|
165
164
|
<script>
|
|
166
|
-
// Don't ask
|
|
167
165
|
const TIMEZONES = JSON.parse("<%= JSON.stringify(_context.timezones) %>".replaceAll(""", '"'))
|
|
166
|
+
const TIME_LOCALE = JSON.parse("<%= JSON.stringify(_context.timeLocale || 'en-GB') %>".replaceAll(""", '"'))
|
|
167
|
+
const TIME_FORMAT = JSON.parse("<%= JSON.stringify(_context.dateTimeFormat || { dateStyle: 'short', timeStyle: 'short' }) %>".replaceAll(""", '"'))
|
|
168
|
+
const DATE_FORMAT = JSON.parse("<%= JSON.stringify(_context.dateFormat || { dateStyle: 'short' }) %>".replaceAll(""", '"'))
|
|
168
169
|
|
|
169
170
|
function enhanceDateTimeInputs(input) {
|
|
170
171
|
// skew the date so it is like in UTC for the user...
|
|
@@ -176,18 +177,23 @@
|
|
|
176
177
|
parent.querySelectorAll('[data-auto="1"]').forEach(node => node.remove())
|
|
177
178
|
|
|
178
179
|
// Add user's localtime
|
|
179
|
-
const strTime = fakeUTCDate.toLocaleString(
|
|
180
|
+
const strTime = fakeUTCDate.toLocaleString(TIME_LOCALE, {});
|
|
180
181
|
|
|
181
182
|
const hint = document.createElement("div");
|
|
182
183
|
|
|
183
184
|
hint.classList.add('hint')
|
|
184
|
-
hint.innerText = `
|
|
185
|
+
hint.innerText = `Your local time: ${strTime}`;
|
|
185
186
|
hint.dataset.auto = "1";
|
|
186
187
|
|
|
187
188
|
parent.appendChild(hint)
|
|
188
189
|
|
|
190
|
+
if (!input.value) {
|
|
191
|
+
hint.innerHTML = '';
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
189
195
|
TIMEZONES.forEach(timeZone => {
|
|
190
|
-
const strTime = fakeUTCDate.toLocaleString(
|
|
196
|
+
const strTime = fakeUTCDate.toLocaleString(TIME_LOCALE, {
|
|
191
197
|
timeZone: `${timeZone.value}`
|
|
192
198
|
});
|
|
193
199
|
|
|
@@ -239,18 +245,13 @@
|
|
|
239
245
|
document.querySelectorAll('time[data-pretty-datetime]').forEach(item => {
|
|
240
246
|
const dateStr = item.getAttribute("datetime");
|
|
241
247
|
|
|
242
|
-
item.innerText = new Date(dateStr).toLocaleString(
|
|
243
|
-
dateStyle: "short",
|
|
244
|
-
timeStyle: "short"
|
|
245
|
-
})
|
|
248
|
+
item.innerText = new Date(dateStr).toLocaleString(TIME_LOCALE, TIME_FORMAT)
|
|
246
249
|
})
|
|
247
250
|
|
|
248
251
|
document.querySelectorAll('time[data-pretty-date]').forEach(item => {
|
|
249
252
|
const dateStr = item.getAttribute("datetime");
|
|
250
253
|
|
|
251
|
-
item.innerText = new Date(dateStr).toLocaleString(
|
|
252
|
-
dateStyle: "short"
|
|
253
|
-
})
|
|
254
|
+
item.innerText = new Date(dateStr).toLocaleString(TIME_LOCALE, DATE_FORMAT)
|
|
254
255
|
})
|
|
255
256
|
|
|
256
257
|
document.querySelectorAll('time[data-pretty-expiration-time]').forEach(item => {
|
|
@@ -258,10 +259,7 @@
|
|
|
258
259
|
|
|
259
260
|
const expTime = new Date(dateStr)
|
|
260
261
|
|
|
261
|
-
item.innerText = expTime.toLocaleString(
|
|
262
|
-
dateStyle: "short",
|
|
263
|
-
timeStyle: "short"
|
|
264
|
-
})
|
|
262
|
+
item.innerText = expTime.toLocaleString(TIME_LOCALE, TIME_FORMAT)
|
|
265
263
|
|
|
266
264
|
if (new Date() > expTime) {
|
|
267
265
|
item.style.color = 'red';
|