forked from projects/fipamo
Merge branch 'develop' into beta
# Conflicts: # .gitignore # public/assets/scripts/dash.min.js # src/com/controllers/SettingsIndex.js
This commit is contained in:
commit
e80408dcb0
5 changed files with 240 additions and 385 deletions
|
@ -15,6 +15,7 @@ class Render
|
|||
$this->twig = new \Twig\Environment($this->loader, []);
|
||||
$settings = $config->getSettings();
|
||||
$this->menu = $settings["menu"];
|
||||
$this->theme = $settings["global"]["theme"];
|
||||
$this->pageInfo = [
|
||||
"keywords" => isset($settings["global"]["keywords"])
|
||||
? $settings["global"]["keywords"]
|
||||
|
@ -22,6 +23,21 @@ class Render
|
|||
"description" => $settings["global"]["descriptions"],
|
||||
"image" => $settings["global"]["background"],
|
||||
];
|
||||
//copy current theme assets to public
|
||||
if (is_file("../public/assets/css/base.css")) {
|
||||
unlink("../public/assets/css/base.css");
|
||||
}
|
||||
copy(
|
||||
"../content/themes/" . $this->theme . "/assets/css/base.css",
|
||||
"../public/assets/css/base.css"
|
||||
);
|
||||
if (is_file("../public/assets/scripts/start.min.js")) {
|
||||
unlink("../public/assets/scripts/start.min.js");
|
||||
}
|
||||
copy(
|
||||
"../content/themes/" . $this->theme . "/assets/scripts/start.min.js",
|
||||
"../public/assets/scripts/start.min.js"
|
||||
);
|
||||
}
|
||||
|
||||
public function renderPages()
|
||||
|
@ -104,7 +120,7 @@ class Render
|
|||
//$cleaned = html_entity_decode($cleaned, ENT_QUOTES, "UTF-8");
|
||||
|
||||
if ($page["layout"] == "index") {
|
||||
$template = "fipamo-default/index.twig";
|
||||
$template = $this->theme . "/index.twig";
|
||||
$location = "../public/index.html";
|
||||
$dir = null;
|
||||
|
||||
|
@ -119,7 +135,7 @@ class Render
|
|||
"menu" => $this->menu,
|
||||
];
|
||||
} else {
|
||||
$template = "fipamo-default/page.twig";
|
||||
$template = $this->theme . "/page.twig";
|
||||
$location =
|
||||
"../public/" . $page["path"] . "/" . $page["slug"] . ".html";
|
||||
$dir = "../public/" . $page["path"];
|
||||
|
@ -142,7 +158,7 @@ class Render
|
|||
public function renderArchive()
|
||||
{
|
||||
$archive = Sorting::archive();
|
||||
$template = "fipamo-default/archive.twig";
|
||||
$template = $this->theme . "/archive.twig";
|
||||
$pageOptions = [
|
||||
"title" => "Archive",
|
||||
"background" => $this->pageInfo["image"],
|
||||
|
@ -160,7 +176,7 @@ class Render
|
|||
{
|
||||
$list = Sorting::tags();
|
||||
foreach ($list as $item) {
|
||||
$template = "fipamo-default/tags.twig";
|
||||
$template = $this->theme . "/tags.twig";
|
||||
$pageOptions = [
|
||||
"title" => "Pages Tagged as " . $item["tag_name"],
|
||||
"background" => $this->pageInfo["image"],
|
||||
|
|
|
@ -69,8 +69,6 @@
|
|||
{% else %}
|
||||
<span>span No back ups. Frowny face.</span>
|
||||
{% endif %}
|
||||
<button id="restore-backup" for='backup-upload'>RESTORE BACKUP</button>
|
||||
<input id="backup-upload" type="file" name="backup-upload" />
|
||||
</div>
|
||||
<div id="util-2" class="column">
|
||||
<label> MAINTENANCE </label><br />
|
||||
|
|
|
@ -1,376 +1,2 @@
|
|||
// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
parcelRequire = (function (modules, cache, entry, globalName) {
|
||||
// Save the require from previous bundle to this closure if any
|
||||
var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
|
||||
var nodeRequire = typeof require === 'function' && require;
|
||||
|
||||
function newRequire(name, jumped) {
|
||||
if (!cache[name]) {
|
||||
if (!modules[name]) {
|
||||
// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
|
||||
if (!jumped && currentRequire) {
|
||||
return currentRequire(name, true);
|
||||
}
|
||||
|
||||
// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if (previousRequire) {
|
||||
return previousRequire(name, true);
|
||||
}
|
||||
|
||||
// Try the node require function if it exists.
|
||||
if (nodeRequire && typeof name === 'string') {
|
||||
return nodeRequire(name);
|
||||
}
|
||||
|
||||
var err = new Error('Cannot find module \'' + name + '\'');
|
||||
err.code = 'MODULE_NOT_FOUND';
|
||||
throw err;
|
||||
}
|
||||
|
||||
localRequire.resolve = resolve;
|
||||
localRequire.cache = {};
|
||||
|
||||
var module = cache[name] = new newRequire.Module(name);
|
||||
|
||||
modules[name][0].call(module.exports, localRequire, module, module.exports, this);
|
||||
}
|
||||
|
||||
return cache[name].exports;
|
||||
|
||||
function localRequire(x){
|
||||
return newRequire(localRequire.resolve(x));
|
||||
}
|
||||
|
||||
function resolve(x){
|
||||
return modules[name][1][x] || x;
|
||||
}
|
||||
}
|
||||
|
||||
function Module(moduleName) {
|
||||
this.id = moduleName;
|
||||
this.bundle = newRequire;
|
||||
this.exports = {};
|
||||
}
|
||||
|
||||
newRequire.isParcelRequire = true;
|
||||
newRequire.Module = Module;
|
||||
newRequire.modules = modules;
|
||||
newRequire.cache = cache;
|
||||
newRequire.parent = previousRequire;
|
||||
newRequire.register = function (id, exports) {
|
||||
modules[id] = [function (require, module) {
|
||||
module.exports = exports;
|
||||
}, {}];
|
||||
};
|
||||
|
||||
var error;
|
||||
for (var i = 0; i < entry.length; i++) {
|
||||
try {
|
||||
newRequire(entry[i]);
|
||||
} catch (e) {
|
||||
// Save first error but execute all entries
|
||||
if (!error) {
|
||||
error = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.length) {
|
||||
// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var mainExports = newRequire(entry[entry.length - 1]);
|
||||
|
||||
// CommonJS
|
||||
if (typeof exports === "object" && typeof module !== "undefined") {
|
||||
module.exports = mainExports;
|
||||
|
||||
// RequireJS
|
||||
} else if (typeof define === "function" && define.amd) {
|
||||
define(function () {
|
||||
return mainExports;
|
||||
});
|
||||
|
||||
// <script>
|
||||
} else if (globalName) {
|
||||
this[globalName] = mainExports;
|
||||
}
|
||||
}
|
||||
|
||||
// Override the current require with this new one
|
||||
parcelRequire = newRequire;
|
||||
|
||||
if (error) {
|
||||
// throw error from earlier, _after updating parcelRequire_
|
||||
throw error;
|
||||
}
|
||||
|
||||
return newRequire;
|
||||
})({"Base.mjs":[function(require,module,exports) {
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
var Base = /*#__PURE__*/function () {
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
function Base() {
|
||||
_classCallCheck(this, Base);
|
||||
|
||||
this.start();
|
||||
}
|
||||
|
||||
_createClass(Base, [{
|
||||
key: "start",
|
||||
value: function start() {
|
||||
console.log('Connected like F.E.');
|
||||
} //--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
|
||||
}]);
|
||||
|
||||
return Base;
|
||||
}();
|
||||
|
||||
exports.default = Base;
|
||||
},{}],"Start.mjs":[function(require,module,exports) {
|
||||
"use strict";
|
||||
|
||||
var _Base = _interopRequireDefault(require("./Base.mjs"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var base = new _Base.default();
|
||||
}, false);
|
||||
},{"./Base.mjs":"Base.mjs"}],"../../../../node_modules/parcel/src/builtins/hmr-runtime.js":[function(require,module,exports) {
|
||||
var global = arguments[3];
|
||||
var OVERLAY_ID = '__parcel__error__overlay__';
|
||||
var OldModule = module.bundle.Module;
|
||||
|
||||
function Module(moduleName) {
|
||||
OldModule.call(this, moduleName);
|
||||
this.hot = {
|
||||
data: module.bundle.hotData,
|
||||
_acceptCallbacks: [],
|
||||
_disposeCallbacks: [],
|
||||
accept: function (fn) {
|
||||
this._acceptCallbacks.push(fn || function () {});
|
||||
},
|
||||
dispose: function (fn) {
|
||||
this._disposeCallbacks.push(fn);
|
||||
}
|
||||
};
|
||||
module.bundle.hotData = null;
|
||||
}
|
||||
|
||||
module.bundle.Module = Module;
|
||||
var checkedAssets, assetsToAccept;
|
||||
var parent = module.bundle.parent;
|
||||
|
||||
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
||||
var hostname = "" || location.hostname;
|
||||
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
|
||||
var ws = new WebSocket(protocol + '://' + hostname + ':' + "50117" + '/');
|
||||
|
||||
ws.onmessage = function (event) {
|
||||
checkedAssets = {};
|
||||
assetsToAccept = [];
|
||||
var data = JSON.parse(event.data);
|
||||
|
||||
if (data.type === 'update') {
|
||||
var handled = false;
|
||||
data.assets.forEach(function (asset) {
|
||||
if (!asset.isNew) {
|
||||
var didAccept = hmrAcceptCheck(global.parcelRequire, asset.id);
|
||||
|
||||
if (didAccept) {
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
}); // Enable HMR for CSS by default.
|
||||
|
||||
handled = handled || data.assets.every(function (asset) {
|
||||
return asset.type === 'css' && asset.generated.js;
|
||||
});
|
||||
|
||||
if (handled) {
|
||||
console.clear();
|
||||
data.assets.forEach(function (asset) {
|
||||
hmrApply(global.parcelRequire, asset);
|
||||
});
|
||||
assetsToAccept.forEach(function (v) {
|
||||
hmrAcceptRun(v[0], v[1]);
|
||||
});
|
||||
} else if (location.reload) {
|
||||
// `location` global exists in a web worker context but lacks `.reload()` function.
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
if (data.type === 'reload') {
|
||||
ws.close();
|
||||
|
||||
ws.onclose = function () {
|
||||
location.reload();
|
||||
};
|
||||
}
|
||||
|
||||
if (data.type === 'error-resolved') {
|
||||
console.log('[parcel] ✨ Error resolved');
|
||||
removeErrorOverlay();
|
||||
}
|
||||
|
||||
if (data.type === 'error') {
|
||||
console.error('[parcel] 🚨 ' + data.error.message + '\n' + data.error.stack);
|
||||
removeErrorOverlay();
|
||||
var overlay = createErrorOverlay(data);
|
||||
document.body.appendChild(overlay);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function removeErrorOverlay() {
|
||||
var overlay = document.getElementById(OVERLAY_ID);
|
||||
|
||||
if (overlay) {
|
||||
overlay.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function createErrorOverlay(data) {
|
||||
var overlay = document.createElement('div');
|
||||
overlay.id = OVERLAY_ID; // html encode message and stack trace
|
||||
|
||||
var message = document.createElement('div');
|
||||
var stackTrace = document.createElement('pre');
|
||||
message.innerText = data.error.message;
|
||||
stackTrace.innerText = data.error.stack;
|
||||
overlay.innerHTML = '<div style="background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;">' + '<span style="background: red; padding: 2px 4px; border-radius: 2px;">ERROR</span>' + '<span style="top: 2px; margin-left: 5px; position: relative;">🚨</span>' + '<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">' + message.innerHTML + '</div>' + '<pre>' + stackTrace.innerHTML + '</pre>' + '</div>';
|
||||
return overlay;
|
||||
}
|
||||
|
||||
function getParents(bundle, id) {
|
||||
var modules = bundle.modules;
|
||||
|
||||
if (!modules) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var parents = [];
|
||||
var k, d, dep;
|
||||
|
||||
for (k in modules) {
|
||||
for (d in modules[k][1]) {
|
||||
dep = modules[k][1][d];
|
||||
|
||||
if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) {
|
||||
parents.push(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bundle.parent) {
|
||||
parents = parents.concat(getParents(bundle.parent, id));
|
||||
}
|
||||
|
||||
return parents;
|
||||
}
|
||||
|
||||
function hmrApply(bundle, asset) {
|
||||
var modules = bundle.modules;
|
||||
|
||||
if (!modules) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (modules[asset.id] || !bundle.parent) {
|
||||
var fn = new Function('require', 'module', 'exports', asset.generated.js);
|
||||
asset.isNew = !modules[asset.id];
|
||||
modules[asset.id] = [fn, asset.deps];
|
||||
} else if (bundle.parent) {
|
||||
hmrApply(bundle.parent, asset);
|
||||
}
|
||||
}
|
||||
|
||||
function hmrAcceptCheck(bundle, id) {
|
||||
var modules = bundle.modules;
|
||||
|
||||
if (!modules) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!modules[id] && bundle.parent) {
|
||||
return hmrAcceptCheck(bundle.parent, id);
|
||||
}
|
||||
|
||||
if (checkedAssets[id]) {
|
||||
return;
|
||||
}
|
||||
|
||||
checkedAssets[id] = true;
|
||||
var cached = bundle.cache[id];
|
||||
assetsToAccept.push([bundle, id]);
|
||||
|
||||
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return getParents(global.parcelRequire, id).some(function (id) {
|
||||
return hmrAcceptCheck(global.parcelRequire, id);
|
||||
});
|
||||
}
|
||||
|
||||
function hmrAcceptRun(bundle, id) {
|
||||
var cached = bundle.cache[id];
|
||||
bundle.hotData = {};
|
||||
|
||||
if (cached) {
|
||||
cached.hot.data = bundle.hotData;
|
||||
}
|
||||
|
||||
if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
|
||||
cached.hot._disposeCallbacks.forEach(function (cb) {
|
||||
cb(bundle.hotData);
|
||||
});
|
||||
}
|
||||
|
||||
delete bundle.cache[id];
|
||||
bundle(id);
|
||||
cached = bundle.cache[id];
|
||||
|
||||
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
|
||||
cached.hot._acceptCallbacks.forEach(function (cb) {
|
||||
cb();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},{}]},{},["../../../../node_modules/parcel/src/builtins/hmr-runtime.js","Start.mjs"], null)
|
||||
//# sourceMappingURL=/start.min.js.map
|
||||
!function(){"use strict";function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}var e=function(){function e(){!function(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.start()}var t,o,r;return t=e,(o=[{key:"start",value:function(){console.log("Connected like F.E.")}}])&&n(t.prototype,o),r&&n(t,r),e}();document.addEventListener("DOMContentLoaded",(function(){new e}),!1)}();
|
||||
//# sourceMappingURL=start.min.js.map
|
6
public/assets/scripts/dash.min.js
vendored
6
public/assets/scripts/dash.min.js
vendored
File diff suppressed because one or more lines are too long
215
src/com/controllers/SettingsIndex.js
Normal file
215
src/com/controllers/SettingsIndex.js
Normal file
|
@ -0,0 +1,215 @@
|
|||
import SettingsActions from "../actions/SettingsActions";
|
||||
import FipamoAdminAPI from "../../libraries/FipamoAdminAPI";
|
||||
import * as DataEvent from "../../../src/com/events/DataEvent";
|
||||
import Mailer from "../actions/Mailer";
|
||||
import Notifications from "../ui/Notifications";
|
||||
const notify = new Notifications();
|
||||
export default class SettingsIndex {
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {
|
||||
this.start();
|
||||
this.admin = new FipamoAdminAPI();
|
||||
}
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
start() {
|
||||
let self = this;
|
||||
//handle save button
|
||||
document.getElementById("save-toggle").addEventListener("click", () =>
|
||||
new SettingsActions()
|
||||
.getInfo()
|
||||
.then((data) => {
|
||||
notify.alert("Saving Settings", null);
|
||||
self.admin.syncSettings(data).then((r) => {
|
||||
if (r.type == DataEvent.SETTINGS_UPDATED) {
|
||||
notify.alert(r.message, true);
|
||||
} else {
|
||||
notify.alert(r.message, true);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
//console.log(err);
|
||||
})
|
||||
);
|
||||
//handle set up image uploads
|
||||
document.getElementById("avatar").addEventListener("click", () => {
|
||||
document.getElementById("avatar-upload").click();
|
||||
});
|
||||
document.getElementById("background").addEventListener("click", () => {
|
||||
document.getElementById("background-upload").click();
|
||||
});
|
||||
document.getElementById("avatar-upload").addEventListener(
|
||||
"change",
|
||||
(e) => {
|
||||
self.handleImageUpload(e.target.id, e.target.files);
|
||||
},
|
||||
false
|
||||
);
|
||||
document.getElementById("background-upload").addEventListener(
|
||||
"change",
|
||||
(e) => {
|
||||
self.handleImageUpload(e.target.id, e.target.files);
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
//handle privacy toggle
|
||||
//document
|
||||
//.getElementById('privacy-toggle')
|
||||
//.addEventListener('click', e => this.togglePrivacy(e));
|
||||
document
|
||||
.getElementById("render-toggle")
|
||||
.addEventListener("click", (e) => this.toggleRender(e));
|
||||
document
|
||||
.getElementById("send-mail")
|
||||
.addEventListener("click", (e) => this.handleMailer(e));
|
||||
document
|
||||
.getElementById("publish-pages")
|
||||
.addEventListener("click", (e) => this.handlePublished(e));
|
||||
//handle theme toggle
|
||||
let themeBtns = document.querySelectorAll(".theme-select");
|
||||
for (var i = 0, length = themeBtns.length; i < length; i++) {
|
||||
themeBtns[i].addEventListener("click", (e) => this.handleThemes(e));
|
||||
}
|
||||
//handle mail options
|
||||
let mailBtn = document.querySelectorAll(".mail-option");
|
||||
for (i = 0, length = mailBtn.length; i < length; i++) {
|
||||
mailBtn[i].addEventListener("click", (e) => this.handleMailOptions(e));
|
||||
}
|
||||
//handle backup
|
||||
document
|
||||
.getElementById("create-backup")
|
||||
.addEventListener("click", (e) => this.handleBackup(e));
|
||||
|
||||
document
|
||||
.getElementById("reindex-pages")
|
||||
.addEventListener("click", (e) => this.handleReindex(e));
|
||||
}
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
togglePrivacy(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
if (e.target.getAttribute("data-private") == "false") {
|
||||
e.target.setAttribute("data-private", "true");
|
||||
e.target.innerHTML = "SITE IS PUBLIC";
|
||||
} else {
|
||||
e.target.setAttribute("data-private", "false");
|
||||
e.target.innerHTML = "SITE IS PRIVATE";
|
||||
}
|
||||
}
|
||||
toggleRender(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
if (e.target.getAttribute("data-render") == "false") {
|
||||
e.target.setAttribute("data-render", "true");
|
||||
//e.target.innerHTML = 'RENDER PAGES ON SAVE';
|
||||
} else {
|
||||
e.target.setAttribute("data-render", "false");
|
||||
//e.target.innerHTML = "DON'T RENDER PAGES ON SAVE";
|
||||
}
|
||||
}
|
||||
handleMailer() {
|
||||
//let mailer = new Mailer();
|
||||
//mailer.sendMail();
|
||||
notify.alert("Mail will be active soon. Hang tight", true);
|
||||
}
|
||||
handleThemes(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let themes = document.querySelectorAll(".theme-select");
|
||||
for (var i = 0, length = themes.length; i < length; i++) {
|
||||
e.target.id == themes[i].id
|
||||
? themes[i].setAttribute("data-enabled", "true")
|
||||
: themes[i].setAttribute("data-enabled", "false");
|
||||
}
|
||||
}
|
||||
handleMailOptions(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
let smtp = document.getElementById("mail-smtp");
|
||||
let mailgun = document.getElementById("mail-mg");
|
||||
let mail = document.querySelectorAll(".mail-option");
|
||||
for (var i = 0, length = mail.length; i < length; i++) {
|
||||
if (e.target.id == mail[i].id) {
|
||||
mail[i].setAttribute("data-enabled", "true");
|
||||
if (e.target.id == "option-smtp") {
|
||||
smtp.setAttribute("data-enabled", "true");
|
||||
mailgun.setAttribute("data-enabled", "false");
|
||||
} else if (e.target.id == "option-none") {
|
||||
smtp.setAttribute("data-enabled", "false");
|
||||
mailgun.setAttribute("data-enabled", "false");
|
||||
} else {
|
||||
smtp.setAttribute("data-enabled", "false");
|
||||
mailgun.setAttribute("data-enabled", "true");
|
||||
}
|
||||
} else {
|
||||
mail[i].setAttribute("data-enabled", "false");
|
||||
}
|
||||
}
|
||||
}
|
||||
handleImageUpload(type, files) {
|
||||
notify.alert("Uploading Image... ", null);
|
||||
this.admin
|
||||
.imageUpload(type, files)
|
||||
.then((r) => {
|
||||
if (r.type == DataEvent.AVATAR_UPLOADED) {
|
||||
notify.alert(r.message, true);
|
||||
document.getElementById("avatar").src = r.url;
|
||||
} else {
|
||||
notify.alert(r.message, true);
|
||||
document.getElementById("background").src = r.url;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
//console.log(err)
|
||||
});
|
||||
}
|
||||
handlePublished(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
let task = { task: "publish all pages" };
|
||||
notify.alert("Publishing site...", null);
|
||||
this.admin
|
||||
.publishSite(task)
|
||||
.then((r) => {
|
||||
notify.alert(r.message, true);
|
||||
})
|
||||
.catch((err) => {
|
||||
notify.alert(err, false);
|
||||
});
|
||||
}
|
||||
handleBackup(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
notify.alert("Creating backup", null);
|
||||
this.admin
|
||||
.handleBackup(e.target.id, e.target.files)
|
||||
.then((r) => {
|
||||
notify.alert(r.message, true);
|
||||
})
|
||||
.catch((err) => {
|
||||
notify.alert(err, false);
|
||||
});
|
||||
}
|
||||
|
||||
handleReindex(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
let task = { task: "cleanup pages indexes" };
|
||||
notify.alert("Cleaning up page indexes", null);
|
||||
this.admin
|
||||
.handleReindex(task)
|
||||
.then((r) => {
|
||||
notify.alert(r.message, true);
|
||||
})
|
||||
.catch((err) => {
|
||||
notify.alert(err, false);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue