mirror of
https://gitlab.com/commento/commento.git
synced 2025-06-29 22:56:37 -04:00
frontend: use gulp, eslint, code refactor
Apologies in advance for the insanely huge commit. This commit is primarily based on Anton Linevych's amazing work found here [1]. While he had gone through the pains of making small, atomic changes to each file, I had put off reviewing the PR for a long time. By the time I finally got around to it, the project had changed so much that it didn't make sense to keep the commits the same way. So I've cherry-picked most of his commits, with some changes here and there, and I've squashed them into one commit. [1] https://gitlab.com/linevych/commento-ce/tree/feature/frontend_building_improvements
This commit is contained in:

committed by
Adhityaa Chandrasekar

parent
e4f71fe402
commit
9e3935b3b2
@ -1,4 +1,5 @@
|
||||
(function (global, document) {
|
||||
"use strict";
|
||||
|
||||
// Selects a domain.
|
||||
global.domainSelect = function(domain) {
|
||||
@ -6,14 +7,14 @@
|
||||
var domains = data.domains;
|
||||
|
||||
for (var i = 0; i < domains.length; i++) {
|
||||
if (domains[i].domain == domain) {
|
||||
global.vs("frozen", domains[i].state == "frozen");
|
||||
if (domains[i].domain === domain) {
|
||||
global.vs("frozen", domains[i].state === "frozen");
|
||||
domains[i].selected = true;
|
||||
data.cd = i;
|
||||
data.importedComments = domains[i].importedComments;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
domains[i].selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
data.showSettings = true;
|
||||
@ -28,8 +29,9 @@
|
||||
var data = global.dashboard.$data;
|
||||
var domains = data.domains;
|
||||
|
||||
for (var i = 0; i < domains.length; i++)
|
||||
for (var i = 0; i < domains.length; i++) {
|
||||
domains[i].selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -76,8 +78,8 @@
|
||||
}
|
||||
|
||||
resp.domains = resp.domains.sort(function(a, b) {
|
||||
var x = a.creationDate; var y = b.creationDate;
|
||||
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
||||
var x = a.creationDate; var y = b.creationDate;
|
||||
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
||||
});
|
||||
|
||||
for (var i = 0; i < resp.domains.length; i++) {
|
||||
@ -98,8 +100,9 @@
|
||||
|
||||
global.vs("domains", resp.domains);
|
||||
|
||||
if (callback !== undefined)
|
||||
if (callback !== undefined) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@ -112,8 +115,9 @@
|
||||
};
|
||||
|
||||
global.post(global.origin + "/api/domain/update", json, function(resp) {
|
||||
if (callback !== undefined)
|
||||
if (callback !== undefined) {
|
||||
callback(resp.success);
|
||||
}
|
||||
|
||||
if (!resp.success) {
|
||||
global.globalErrorShow(resp.message);
|
||||
@ -136,8 +140,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (callback !== undefined)
|
||||
if (callback !== undefined) {
|
||||
callback(resp.success);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user