Restyled Settings UI
Rebuilt the css for the Settings UI, which also led to some changed in the FilesAPI so it knows what to do with specific targets. There's still some additional styling needed to polish it, but the core structure is in place so now it can just be tweaked. The controller for this page was adjusted as needed. Also moved the settings sub nav convtrols to the header menu since it's sticky now.toggle-buttons-#109
parent
fcca7357bc
commit
1b89d1d072
@ -0,0 +1,11 @@
|
|||||||
|
<div role="submenu">
|
||||||
|
<button id="save-toggle" title="save settings">
|
||||||
|
<i class="ti ti-device-floppy"></i>
|
||||||
|
</button>
|
||||||
|
<button id="publish-pages" title="publish site">
|
||||||
|
<i class="ti ti-world-upload"></i>
|
||||||
|
</button>
|
||||||
|
<button id="render-toggle" title="render on save toggle" data-render="{{ renderOnSave }}">
|
||||||
|
<i class="ti ti-circle-dashed"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
@ -0,0 +1,160 @@
|
|||||||
|
article[role="settings"] {
|
||||||
|
margin: 100px auto;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 900px;
|
||||||
|
}
|
||||||
|
|
||||||
|
article[role="settings"] h1 {
|
||||||
|
color: var(--white);
|
||||||
|
}
|
||||||
|
|
||||||
|
section label {
|
||||||
|
background: var(--primary);
|
||||||
|
color: var(--white);
|
||||||
|
padding: 3px;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="member-settings"],
|
||||||
|
section[role="site-settings"],
|
||||||
|
section[role="data-settings"],
|
||||||
|
section[role="backup-settings"] {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
|
gap: 10px;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 900px;
|
||||||
|
margin: 10px auto;
|
||||||
|
background: var(--white);
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="member-settings"] div {
|
||||||
|
width: 98%;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="member-settings"] div input[type="file"] {
|
||||||
|
display: none;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="member-settings"] div input[type="text"] {
|
||||||
|
width: 96%;
|
||||||
|
height: 30px;
|
||||||
|
padding: 5px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="member-settings"] div textarea {
|
||||||
|
background: var(--primary);
|
||||||
|
width: 91%;
|
||||||
|
padding: 5px;
|
||||||
|
height: 79%;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="member-settings"] div:nth-child(1) {
|
||||||
|
grid-column: 1/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="member-settings"] div:nth-child(2) {
|
||||||
|
grid-column: 2/4;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="member-settings"] div img {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"] > div {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"] > div[role="features"] button {
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"] > div[role="features"] button > span {
|
||||||
|
font-size: 0.8em;
|
||||||
|
display: inline;
|
||||||
|
top: -10px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"]
|
||||||
|
> div[role="features"]
|
||||||
|
button[data-enabled="true"] {
|
||||||
|
color: var(--white);
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"]
|
||||||
|
> div[role="features"]
|
||||||
|
button[data-enabled="false"] {
|
||||||
|
color: var(--primary);
|
||||||
|
background: var(--secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"] > div[role="theme"] a[data-enabled="true"] {
|
||||||
|
color: var(--white);
|
||||||
|
background: var(--highlight);
|
||||||
|
display: block;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"] > div[role="theme"] a[data-enabled="false"] {
|
||||||
|
color: var(--primary);
|
||||||
|
background: var(--secondary);
|
||||||
|
display: block;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"] > div[role="mail"] a {
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"] > div[role="mail"] a[data-enabled="true"] {
|
||||||
|
color: var(--primary);
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"] > div[role="mail"] div[data-enabled="false"] {
|
||||||
|
visibility: hidden;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"] > div[role="mail"] input {
|
||||||
|
width: 96%;
|
||||||
|
height: 30px;
|
||||||
|
padding: 5px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="site-settings"] > div[role="mail"] button {
|
||||||
|
width: 96%;
|
||||||
|
height: 30px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="data-settings"] div {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="data-settings"] div:nth-child(1) {
|
||||||
|
grid-column: 1/3;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="data-settings"] button {
|
||||||
|
width: 96%;
|
||||||
|
height: 30px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="data-settings"] a {
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
@ -1,265 +1,266 @@
|
|||||||
import SettingsActions from "../actions/SettingsActions";
|
import SettingsActions from '../actions/SettingsActions';
|
||||||
import Maintenance from "./MaintenanceManager";
|
import Maintenance from './MaintenanceManager';
|
||||||
import FipamoAdminAPI, {
|
import FipamoAdminAPI, { TASK_SYNC_SETTNIGS } from '../../libraries/FipamoAdminAPI';
|
||||||
TASK_SYNC_SETTNIGS
|
import * as DataEvent from '../../../src/com/events/DataEvent';
|
||||||
} from "../../libraries/FipamoAdminAPI";
|
import Mailer from '../actions/Mailer';
|
||||||
import * as DataEvent from "../../../src/com/events/DataEvent";
|
import Notifications from '../ui/Notifications';
|
||||||
import Mailer from "../actions/Mailer";
|
|
||||||
import Notifications from "../ui/Notifications";
|
|
||||||
const notify = new Notifications();
|
const notify = new Notifications();
|
||||||
export default class SettingsIndex {
|
export default class SettingsIndex {
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// constructor
|
// constructor
|
||||||
//--------------------------
|
//--------------------------
|
||||||
constructor() {
|
constructor() {
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
this.start();
|
this.start();
|
||||||
this.admin = new FipamoAdminAPI(null);
|
this.admin = new FipamoAdminAPI(null);
|
||||||
this.mm = new Maintenance(null, null);
|
this.mm = new Maintenance(null, null);
|
||||||
}
|
}
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// methods
|
// methods
|
||||||
//--------------------------
|
//--------------------------
|
||||||
start() {
|
start() {
|
||||||
let self = this;
|
let self = this;
|
||||||
//handle save button
|
//handle save button
|
||||||
document.getElementById("save-toggle").addEventListener("click", () =>
|
document.getElementById('save-toggle').addEventListener('click', () =>
|
||||||
new SettingsActions()
|
new SettingsActions()
|
||||||
.getInfo()
|
.getInfo()
|
||||||
.then((data) => {
|
.then(data => {
|
||||||
notify.alert("Saving Settings", null);
|
notify.alert('Saving Settings', null);
|
||||||
self.admin.sync(TASK_SYNC_SETTNIGS, data).then((r) => {
|
self.admin.sync(TASK_SYNC_SETTNIGS, data).then(r => {
|
||||||
if (r.type == DataEvent.SETTINGS_UPDATED) {
|
if (r.type == DataEvent.SETTINGS_UPDATED) {
|
||||||
notify.alert(r.message, true);
|
notify.alert(r.message, true);
|
||||||
} else {
|
} else {
|
||||||
notify.alert(r.message, true);
|
notify.alert(r.message, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
//console.log(err);
|
//console.log(err);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
//handle set up image uploads
|
//handle set up image uploads
|
||||||
document.getElementById("avatar").addEventListener("click", () => {
|
document.getElementById('avatar').addEventListener('click', () => {
|
||||||
document.getElementById("avatar-upload").click();
|
document.getElementById('avatar-upload').click();
|
||||||
});
|
});
|
||||||
document.getElementById("background").addEventListener("click", () => {
|
document.getElementById('background').addEventListener('click', () => {
|
||||||
document.getElementById("background-upload").click();
|
document.getElementById('background-upload').click();
|
||||||
});
|
});
|
||||||
document.getElementById("avatar-upload").addEventListener(
|
document.getElementById('avatar-upload').addEventListener(
|
||||||
"change",
|
'change',
|
||||||
(e) => {
|
e => {
|
||||||
self.handleImageUpload(e.target.id, e.target.files);
|
self.handleImageUpload(e.target.id, e.target.files);
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
document.getElementById("background-upload").addEventListener(
|
document.getElementById('background-upload').addEventListener(
|
||||||
"change",
|
'change',
|
||||||
(e) => {
|
e => {
|
||||||
self.handleImageUpload(e.target.id, e.target.files);
|
self.handleImageUpload(e.target.id, e.target.files);
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
//handle api access toggle
|
//handle api access toggle
|
||||||
var apiButton = document.getElementById("api-access-toggle");
|
var apiButton = document.getElementById('api-access-toggle');
|
||||||
var apiStatus = document.getElementById("api-status");
|
var apiStatus = document.getElementById('api-status');
|
||||||
apiButton.addEventListener("click", (e) => {
|
apiButton.addEventListener('click', e => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (apiButton.getAttribute("data-enabled") == "false") {
|
if (apiButton.getAttribute('data-enabled') == 'false') {
|
||||||
apiButton.setAttribute("data-enabled", "true");
|
apiButton.setAttribute('data-enabled', 'true');
|
||||||
apiStatus.innerHTML = "EXTERNAL API ACCESS IS ENABLED";
|
apiStatus.innerHTML = 'EXTERNAL API ACCESS IS ENABLED';
|
||||||
} else {
|
} else {
|
||||||
apiButton.setAttribute("data-enabled", "false");
|
apiButton.setAttribute('data-enabled', 'false');
|
||||||
apiStatus.innerHTML = "EXTERNAL API ACCESS IS NOT ENABLED";
|
apiStatus.innerHTML = 'EXTERNAL API ACCESS IS NOT ENABLED';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//handle dynamic page rendering
|
//handle dynamic page rendering
|
||||||
var dynamicRenderButton = document.getElementById("dynamic-render-toggle");
|
var dynamicRenderButton = document.getElementById('dynamic-render-toggle');
|
||||||
var dynamicRenderStatus = document.getElementById("dynamic-render-status");
|
var dynamicRenderStatus = document.getElementById('dynamic-render-status');
|
||||||
dynamicRenderButton.addEventListener("click", (e) => {
|
dynamicRenderButton.addEventListener('click', e => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (dynamicRenderButton.getAttribute("data-enabled") == "false") {
|
if (dynamicRenderButton.getAttribute('data-enabled') == 'false') {
|
||||||
dynamicRenderButton.setAttribute("data-enabled", "true");
|
dynamicRenderButton.setAttribute('data-enabled', 'true');
|
||||||
dynamicRenderStatus.innerHTML = "DYNAMIC PAGE RENDERING";
|
dynamicRenderStatus.innerHTML = 'DYNAMIC PAGE RENDERING';
|
||||||
} else {
|
} else {
|
||||||
dynamicRenderButton.setAttribute("data-enabled", "false");
|
dynamicRenderButton.setAttribute('data-enabled', 'false');
|
||||||
dynamicRenderStatus.innerHTML = "STATIC PAGE RENDERING";
|
dynamicRenderStatus.innerHTML = 'STATIC PAGE RENDERING';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document
|
document
|
||||||
.getElementById("send-mail")
|
.getElementById('send-mail')
|
||||||
.addEventListener("click", (e) => this.handleMailer(e));
|
.addEventListener('click', e => this.handleMailer(e));
|
||||||
document
|
document
|
||||||
.getElementById("publish-pages")
|
.getElementById('publish-pages')
|
||||||
.addEventListener("click", (e) => this.handlePublished(e));
|
.addEventListener('click', e => this.handlePublished(e));
|
||||||
//handle page render on save toggle
|
//handle page render on save toggle
|
||||||
document
|
document
|
||||||
.getElementById("render-toggle")
|
.getElementById('render-toggle')
|
||||||
.addEventListener("click", (e) => this.toggleRender(e));
|
.addEventListener('click', e => this.toggleRender(e));
|
||||||
document
|
//handle theme toggle
|
||||||
.getElementById("render-toggle-icon")
|
let themeBtns = document.querySelectorAll('.theme-select');
|
||||||
.addEventListener("click", (e) => this.toggleRender(e));
|
for (var i = 0, length = themeBtns.length; i < length; i++) {
|
||||||
//handle theme toggle
|
themeBtns[i].addEventListener('click', e => this.handleThemes(e));
|
||||||
let themeBtns = document.querySelectorAll(".theme-select");
|
}
|
||||||
for (var i = 0, length = themeBtns.length; i < length; i++) {
|
//handle mail options
|
||||||
themeBtns[i].addEventListener("click", (e) => this.handleThemes(e));
|
let mailBtn = document.querySelectorAll('.mail-option');
|
||||||
}
|
for (i = 0, length = mailBtn.length; i < length; i++) {
|
||||||
//handle mail options
|
mailBtn[i].addEventListener('click', e => this.handleMailOptions(e));
|
||||||
let mailBtn = document.querySelectorAll(".mail-option");
|
}
|
||||||
for (i = 0, length = mailBtn.length; i < length; i++) {
|
//handle backup from settings [disabled]
|
||||||
mailBtn[i].addEventListener("click", (e) => this.handleMailOptions(e));
|
|
||||||
}
|
|
||||||
//handle backup from settings [disabled]
|
|
||||||
|
|
||||||
document
|
document
|
||||||
.getElementById("create-backup")
|
.getElementById('create-backup')
|
||||||
.addEventListener("click", (e) => this.handleBackup(e));
|
.addEventListener('click', e => this.handleBackup(e));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
document
|
document
|
||||||
.getElementById("reindex-pages")
|
.getElementById("reindex-pages")
|
||||||
.addEventListener("click", (e) => this.handleReindex(e));
|
.addEventListener("click", (e) => this.handleReindex(e));
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// event handlers
|
// event handlers
|
||||||
//--------------------------
|
//--------------------------
|
||||||
togglePrivacy(e) {
|
togglePrivacy(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (e.target.getAttribute("data-private") == "false") {
|
if (e.target.getAttribute('data-private') == 'false') {
|
||||||
e.target.setAttribute("data-private", "true");
|
e.target.setAttribute('data-private', 'true');
|
||||||
e.target.innerHTML = "SITE IS PUBLIC";
|
e.target.innerHTML = 'SITE IS PUBLIC';
|
||||||
} else {
|
} else {
|
||||||
e.target.setAttribute("data-private", "false");
|
e.target.setAttribute('data-private', 'false');
|
||||||
e.target.innerHTML = "SITE IS PRIVATE";
|
e.target.innerHTML = 'SITE IS PRIVATE';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toggleRender(e) {
|
toggleRender(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let button = document.getElementById("render-toggle");
|
let button = document.getElementById('render-toggle');
|
||||||
if (button.getAttribute("data-render") == "false") {
|
if (button.getAttribute('data-render') == 'false') {
|
||||||
button.setAttribute("data-render", "true");
|
button.setAttribute('data-render', 'true');
|
||||||
//e.target.innerHTML = 'RENDER PAGES ON SAVE';
|
//e.target.innerHTML = 'RENDER PAGES ON SAVE';
|
||||||
} else {
|
} else {
|
||||||
button.setAttribute("data-render", "false");
|
button.setAttribute('data-render', 'false');
|
||||||
//e.target.innerHTML = "DON'T RENDER PAGES ON SAVE";
|
//e.target.innerHTML = "DON'T RENDER PAGES ON SAVE";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleMailer() {
|
handleMailer() {
|
||||||
let mailer = new Mailer();
|
let mailer = new Mailer();
|
||||||
mailer.testMail();
|
mailer.testMail();
|
||||||
//mailer.sendMail();
|
//mailer.sendMail();
|
||||||
}
|
}
|
||||||
handleThemes(e) {
|
handleThemes(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let themes = document.querySelectorAll(".theme-select");
|
let themes = document.querySelectorAll('.theme-select');
|
||||||
for (var i = 0, length = themes.length; i < length; i++) {
|
for (var i = 0, length = themes.length; i < length; i++) {
|
||||||
e.target.id == themes[i].id
|
e.target.id == themes[i].id
|
||||||
? themes[i].setAttribute("data-enabled", "true")
|
? themes[i].setAttribute('data-enabled', 'true')
|
||||||
: themes[i].setAttribute("data-enabled", "false");
|
: themes[i].setAttribute('data-enabled', 'false');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleMailOptions(e) {
|
handleMailOptions(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
let smtp = document.getElementById("mail-smtp");
|
let smtp = document.getElementById('mail-smtp');
|
||||||
let mailgun = document.getElementById("mail-mg");
|
let mailgun = document.getElementById('mail-mg');
|
||||||
let mail = document.querySelectorAll(".mail-option");
|
let mail = document.querySelectorAll('.mail-option');
|
||||||
for (var i = 0, length = mail.length; i < length; i++) {
|
for (var i = 0, length = mail.length; i < length; i++) {
|
||||||
if (e.target.id == mail[i].id) {
|
if (e.target.id == mail[i].id) {
|
||||||
mail[i].setAttribute("data-enabled", "true");
|
mail[i].setAttribute('data-enabled', 'true');
|
||||||
if (e.target.id == "option-smtp") {
|
if (e.target.id == 'option-smtp') {
|
||||||
smtp.setAttribute("data-enabled", "true");
|
smtp.setAttribute('data-enabled', 'true');
|
||||||
mailgun.setAttribute("data-enabled", "false");
|
mailgun.setAttribute('data-enabled', 'false');
|
||||||
} else if (e.target.id == "option-none") {
|
} else if (e.target.id == 'option-none') {
|
||||||
smtp.setAttribute("data-enabled", "false");
|
smtp.setAttribute('data-enabled', 'false');
|
||||||
mailgun.setAttribute("data-enabled", "false");
|
mailgun.setAttribute('data-enabled', 'false');
|
||||||
} else {
|
} else {
|
||||||
smtp.setAttribute("data-enabled", "false");
|
smtp.setAttribute('data-enabled', 'false');
|
||||||
mailgun.setAttribute("data-enabled", "true");
|
mailgun.setAttribute('data-enabled', 'true');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mail[i].setAttribute("data-enabled", "false");
|
mail[i].setAttribute('data-enabled', 'false');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleImageUpload(type, files) {
|
handleImageUpload(type, files) {
|
||||||
notify.alert("Uploading Image... ", null);
|
notify.alert('Uploading Image... ', null);
|
||||||
|
let self = this;
|
||||||
|
notify.alert('Uploading Image', null);
|
||||||
|
let upload = new FormData();
|
||||||
|
upload.enctype = 'multipart/form-data';
|
||||||
|
upload.append('source', type);
|
||||||
|
upload.append('upload_files[]', files[0], files[0].name);
|
||||||
|
|
||||||
this.mm
|
this.mm
|
||||||
.imageUpload(type, files)
|
.filesUpload(files[0].type, upload)
|
||||||
.then((r) => {
|
.then(r => {
|
||||||
if (r.type == DataEvent.AVATAR_UPLOADED) {
|
if (type == 'avatar-upload') {
|
||||||
notify.alert(r.message, true);
|
notify.alert(r.message, true);
|
||||||
document.getElementById("avatar").src = r.url;
|
document.getElementById('avatar').src = r.filePath;
|
||||||
} else {
|
} else {
|
||||||
notify.alert(r.message, true);
|
notify.alert(r.message, true);
|
||||||
document.getElementById("background").src = r.url;
|
document.getElementById('background').src = r.filePath;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
//console.log(err)
|
//console.log(err)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
handlePublished(e) {
|
handlePublished(e) {
|
||||||
if (this.processing) return;
|
if (this.processing) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
let self = this;
|
let self = this;
|
||||||
let task = { task: "PUBLISH_ALL" };
|
let task = { task: 'PUBLISH_ALL' };
|
||||||
this.processing = true;
|
this.processing = true;
|
||||||
notify.alert("Publishing site...", null);
|
notify.alert('Publishing site...', null);
|
||||||
this.admin
|
this.admin
|
||||||
.publish(task)
|
.publish(task)
|
||||||
.then((r) => {
|
.then(r => {
|
||||||
self.processing = false;
|
self.processing = false;
|
||||||
notify.alert(r.message, true);
|
notify.alert(r.message, true);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
self.processing = false;
|
self.processing = false;
|
||||||
notify.alert(err, false);
|
notify.alert(err, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBackup(e) {
|
handleBackup(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
notify.alert("Creating backup", null);
|
notify.alert('Creating backup', null);
|
||||||
this.mm
|
this.mm
|
||||||
.backup()
|
.backup()
|
||||||
.then((r) => {
|
.then(r => {
|
||||||
notify.alert(r.message, true);
|
notify.alert(r.message, true);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
notify.alert(err, false);
|
notify.alert(err, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleReindex(e) {
|
handleReindex(e) {
|
||||||
if (this.processing) return;
|
if (this.processing) return;
|
||||||
let self = this;
|
let self = this;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
let task = { task: "cleanup pages indexes" };
|
let task = { task: 'cleanup pages indexes' };
|
||||||
this.processing = true;
|
this.processing = true;
|
||||||
notify.alert("Cleaning up page indexes", null);
|
notify.alert('Cleaning up page indexes', null);
|
||||||
this.admin
|
this.admin
|
||||||
.handleReindex(task)
|
.handleReindex(task)
|
||||||
.then((r) => {
|
.then(r => {
|
||||||
self.processing = false;
|
self.processing = false;
|
||||||
notify.alert(r.message, true);
|
notify.alert(r.message, true);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
self.processing = false;
|
self.processing = false;
|
||||||
notify.alert(err, false);
|
notify.alert(err, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue