@saltcorn/server 0.6.4-beta.1 → 0.6.4-beta.5
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/app.js +3 -1
- package/auth/resetpw.js +7 -7
- package/auth/routes.js +1 -1
- package/locales/en.json +7 -1
- package/package.json +18 -15
- package/public/flatpickr.min.js +2 -2
- package/public/gridedit.js +169 -221
- package/public/luxon.min.js +1 -0
- package/public/saltcorn.js +83 -15
- package/public/tabulator.min.js +3 -0
- package/public/tabulator_bootstrap4.min.css +2 -0
- package/restart_watcher.js +1 -1
- package/routes/admin.js +2 -2
- package/routes/fields.js +31 -2
- package/routes/homepage.js +1 -1
- package/routes/list.js +176 -89
- package/routes/packs.js +1 -1
- package/routes/pageedit.js +1 -1
- package/routes/plugins.js +3 -1
- package/routes/scapi.js +1 -1
- package/routes/tenant.js +19 -9
- package/routes/viewedit.js +1 -1
- package/serve.js +38 -27
- package/wrapper.js +5 -2
package/public/saltcorn.js
CHANGED
|
@@ -177,6 +177,14 @@ function rep_down(e) {
|
|
|
177
177
|
apply_form_subset_record(theform, vals1);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
+
|
|
181
|
+
function reload_on_init() {
|
|
182
|
+
localStorage.setItem("reload_on_init", true);
|
|
183
|
+
}
|
|
184
|
+
if (localStorage.getItem("reload_on_init")) {
|
|
185
|
+
localStorage.removeItem("reload_on_init");
|
|
186
|
+
location.reload();
|
|
187
|
+
}
|
|
180
188
|
function initialize_page() {
|
|
181
189
|
$("form").change(apply_showif);
|
|
182
190
|
apply_showif();
|
|
@@ -228,13 +236,15 @@ function initialize_page() {
|
|
|
228
236
|
});
|
|
229
237
|
if (codes.length > 0)
|
|
230
238
|
enable_codemirror(() => {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
239
|
+
setTimeout(() => {
|
|
240
|
+
codes.forEach((el) => {
|
|
241
|
+
//console.log($(el).attr("mode"), el);
|
|
242
|
+
CodeMirror.fromTextArea(el, {
|
|
243
|
+
lineNumbers: true,
|
|
244
|
+
mode: $(el).attr("mode"),
|
|
245
|
+
});
|
|
236
246
|
});
|
|
237
|
-
});
|
|
247
|
+
}, 100);
|
|
238
248
|
});
|
|
239
249
|
const locale =
|
|
240
250
|
navigator.userLanguage ||
|
|
@@ -245,6 +255,7 @@ function initialize_page() {
|
|
|
245
255
|
navigator.browserLanguage ||
|
|
246
256
|
navigator.systemLanguage ||
|
|
247
257
|
"en";
|
|
258
|
+
window.detected_locale = locale;
|
|
248
259
|
const parse = (s) => JSON.parse(decodeURIComponent(s));
|
|
249
260
|
$("time[locale-time-options]").each(function () {
|
|
250
261
|
var el = $(this);
|
|
@@ -264,6 +275,7 @@ function initialize_page() {
|
|
|
264
275
|
const options = parse(el.attr("locale-date-options"));
|
|
265
276
|
el.text(date.toLocaleDateString(locale, options));
|
|
266
277
|
});
|
|
278
|
+
$('a[data-toggle="tab"]').historyTabs();
|
|
267
279
|
}
|
|
268
280
|
|
|
269
281
|
$(initialize_page);
|
|
@@ -482,7 +494,7 @@ function press_store_button(clicked) {
|
|
|
482
494
|
|
|
483
495
|
function ajax_modal(url, opts = {}) {
|
|
484
496
|
if ($("#scmodal").length === 0) {
|
|
485
|
-
$("body").append(`<div id="scmodal", class="modal"
|
|
497
|
+
$("body").append(`<div id="scmodal", class="modal">
|
|
486
498
|
<div class="modal-dialog">
|
|
487
499
|
<div class="modal-content">
|
|
488
500
|
<div class="modal-header">
|
|
@@ -515,7 +527,7 @@ function ajax_modal(url, opts = {}) {
|
|
|
515
527
|
});
|
|
516
528
|
}
|
|
517
529
|
|
|
518
|
-
function saveAndContinue(e) {
|
|
530
|
+
function saveAndContinue(e, k) {
|
|
519
531
|
var form = $(e).closest("form");
|
|
520
532
|
var url = form.attr("action");
|
|
521
533
|
var form_data = form.serialize();
|
|
@@ -536,6 +548,9 @@ function saveAndContinue(e) {
|
|
|
536
548
|
$("#page-inner-content").html(request.responseText);
|
|
537
549
|
initialize_page();
|
|
538
550
|
},
|
|
551
|
+
complete: function () {
|
|
552
|
+
if (k) k();
|
|
553
|
+
},
|
|
539
554
|
});
|
|
540
555
|
|
|
541
556
|
return false;
|
|
@@ -605,7 +620,15 @@ function ajax_post_btn(e, reload_on_done, reload_delay) {
|
|
|
605
620
|
|
|
606
621
|
return false;
|
|
607
622
|
}
|
|
608
|
-
function make_unique_field(
|
|
623
|
+
function make_unique_field(
|
|
624
|
+
id,
|
|
625
|
+
table_id,
|
|
626
|
+
field_name,
|
|
627
|
+
value,
|
|
628
|
+
space,
|
|
629
|
+
start,
|
|
630
|
+
always_append
|
|
631
|
+
) {
|
|
609
632
|
if (!value) return;
|
|
610
633
|
$.ajax(
|
|
611
634
|
`/api/${table_id}?approximate=true&${encodeURIComponent(
|
|
@@ -618,9 +641,9 @@ function make_unique_field(id, table_id, field_name, value) {
|
|
|
618
641
|
const vals = res.success
|
|
619
642
|
.map((o) => o[field_name])
|
|
620
643
|
.filter((s) => s.startsWith(value));
|
|
621
|
-
if (vals.includes(value)) {
|
|
622
|
-
for (let i =
|
|
623
|
-
const newname = `${value} ${i}`;
|
|
644
|
+
if (vals.includes(value) || always_append) {
|
|
645
|
+
for (let i = start || 0; i < vals.length + (start || 0) + 2; i++) {
|
|
646
|
+
const newname = `${value}${space ? " " : ""}${i}`;
|
|
624
647
|
if (!vals.includes(newname)) {
|
|
625
648
|
$("#" + id).val(newname);
|
|
626
649
|
return;
|
|
@@ -697,6 +720,51 @@ function room_older(viewname, room_id, btn) {
|
|
|
697
720
|
}
|
|
698
721
|
);
|
|
699
722
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
723
|
+
|
|
724
|
+
/*
|
|
725
|
+
https://github.com/jeffdavidgreen/bootstrap-html5-history-tabs/blob/master/bootstrap-history-tabs.js
|
|
726
|
+
Copyright (c) 2015 Jeff Green
|
|
727
|
+
*/
|
|
728
|
+
|
|
729
|
+
+(function ($) {
|
|
730
|
+
"use strict";
|
|
731
|
+
$.fn.historyTabs = function () {
|
|
732
|
+
var that = this;
|
|
733
|
+
window.addEventListener("popstate", function (event) {
|
|
734
|
+
if (event.state) {
|
|
735
|
+
$(that)
|
|
736
|
+
.filter('[href="' + event.state.url + '"]')
|
|
737
|
+
.tab("show");
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
return this.each(function (index, element) {
|
|
741
|
+
$(element).on("show.bs.tab", function () {
|
|
742
|
+
var stateObject = { url: $(this).attr("href") };
|
|
743
|
+
|
|
744
|
+
if (window.location.hash && stateObject.url !== window.location.hash) {
|
|
745
|
+
window.history.pushState(
|
|
746
|
+
stateObject,
|
|
747
|
+
document.title,
|
|
748
|
+
window.location.pathname +
|
|
749
|
+
window.location.search +
|
|
750
|
+
$(this).attr("href")
|
|
751
|
+
);
|
|
752
|
+
} else {
|
|
753
|
+
window.history.replaceState(
|
|
754
|
+
stateObject,
|
|
755
|
+
document.title,
|
|
756
|
+
window.location.pathname +
|
|
757
|
+
window.location.search +
|
|
758
|
+
$(this).attr("href")
|
|
759
|
+
);
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
if (!window.location.hash && $(element).is(".active")) {
|
|
763
|
+
// Shows the first element if there are no query parameters.
|
|
764
|
+
$(element).tab("show");
|
|
765
|
+
} else if ($(this).attr("href") === window.location.hash) {
|
|
766
|
+
$(element).tab("show");
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
};
|
|
770
|
+
})(jQuery);
|