public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Web] Fix temporary email aliases sorting
cf1cc24e
data/web/js/build/013-mailcow.js | 10 ++++++++++
data/web/js/site/debug.js | 10 ----------
data/web/js/site/user.js | 25 +++++++++++++++++++------
3 files changed, 29 insertions(+), 16 deletions(-)
Diff
diff --git a/data/web/js/build/013-mailcow.js b/data/web/js/build/013-mailcow.js
index e060a2d0..e659915b 100644
--- a/data/web/js/build/013-mailcow.js
+++ b/data/web/js/build/013-mailcow.js
@@ -1,3 +1,13 @@
+const LOCALE = undefined;
+const DATETIME_FORMAT = {
+ year: "numeric",
+ month: "2-digit",
+ day: "2-digit",
+ hour: "2-digit",
+ minute: "2-digit",
+ second: "2-digit"
+};
+
$(document).ready(function() {
// mailcow alert box generator
window.mailcow_alert_box = function(message, type) {
diff --git a/data/web/js/site/debug.js b/data/web/js/site/debug.js
index 55b6660b..4e4c5692 100644
--- a/data/web/js/site/debug.js
+++ b/data/web/js/site/debug.js
@@ -1,13 +1,3 @@
-const LOCALE = undefined;
-const DATETIME_FORMAT = {
- year: "numeric",
- month: "2-digit",
- day: "2-digit",
- hour: "2-digit",
- minute: "2-digit",
- second: "2-digit"
-};
-
$(document).ready(function() {
// Parse seconds ago to date
// Get "now" timestamp
diff --git a/data/web/js/site/user.js b/data/web/js/site/user.js
index b2139829..2227e0b0 100644
--- a/data/web/js/site/user.js
+++ b/data/web/js/site/user.js
@@ -127,6 +127,20 @@ jQuery(function($){
}
}
+
+ function createSortableDate(td, cellData, date_string = false) {
+ if (date_string)
+ var date = new Date(cellData);
+ else
+ var date = new Date(cellData ? cellData * 1000 : 0);
+
+ var timestamp = date.getTime();
+ $(td).attr({
+ "data-order": timestamp,
+ "data-sort": timestamp
+ });
+ $(td).html(date.toLocaleDateString(LOCALE, DATETIME_FORMAT));
+ }
function draw_tla_table() {
// just recalc width if instance already exists
if ($.fn.DataTable.isDataTable('#tla_table') ) {
@@ -144,6 +158,7 @@ jQuery(function($){
"tr" +
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
language: lang_datatables,
+ order: [[4, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/time_limited_aliases",
@@ -191,18 +206,16 @@ jQuery(function($){
title: lang.alias_valid_until,
data: 'validity',
defaultContent: '',
- render: function (data, type) {
- var date = new Date(data ? data * 1000 : 0);
- return date.toLocaleDateString(undefined, {year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"});
+ createdCell: function(td, cellData) {
+ createSortableDate(td, cellData)
}
},
{
title: lang.created_on,
data: 'created',
defaultContent: '',
- render: function (data, type) {
- var date = new Date(data.replace(/-/g, "/"));
- return date.toLocaleDateString(undefined, {year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"});
+ createdCell: function(td, cellData) {
+ createSortableDate(td, cellData, true)
}
},
{