|
|
@ -1,5 +1,9 @@
|
|
|
|
import SettingsActions from '../actions/SettingsActions';
|
|
|
|
import SettingsActions from '../actions/SettingsActions';
|
|
|
|
import ApiUtils, { REQUEST_TYPE_POST, CONTENT_TYPE_FORM } from '../../../src/com/utils/APIUtils';
|
|
|
|
import ApiUtils, {
|
|
|
|
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
|
|
|
|
CONTENT_TYPE_FORM,
|
|
|
|
|
|
|
|
CONTENT_TYPE_JSON
|
|
|
|
|
|
|
|
} from '../../../src/com/utils/APIUtils';
|
|
|
|
import * as DataEvent from '../../../src/com/events/DataEvent';
|
|
|
|
import * as DataEvent from '../../../src/com/events/DataEvent';
|
|
|
|
import Mailer from '../actions/Mailer';
|
|
|
|
import Mailer from '../actions/Mailer';
|
|
|
|
import Notifications from '../ui/Notifications';
|
|
|
|
import Notifications from '../ui/Notifications';
|
|
|
@ -63,6 +67,9 @@ export default class SettingsIndex {
|
|
|
|
.getElementById('render-toggle')
|
|
|
|
.getElementById('render-toggle')
|
|
|
|
.addEventListener('click', e => this.toggleRender(e));
|
|
|
|
.addEventListener('click', e => this.toggleRender(e));
|
|
|
|
document.getElementById('send-mail').addEventListener('click', e => this.handleMailer(e));
|
|
|
|
document.getElementById('send-mail').addEventListener('click', e => this.handleMailer(e));
|
|
|
|
|
|
|
|
document
|
|
|
|
|
|
|
|
.getElementById('publish-pages')
|
|
|
|
|
|
|
|
.addEventListener('click', e => this.handlePublished(e));
|
|
|
|
//handle theme toggle
|
|
|
|
//handle theme toggle
|
|
|
|
let themeBtns = document.querySelectorAll('.theme-select');
|
|
|
|
let themeBtns = document.querySelectorAll('.theme-select');
|
|
|
|
for (var i = 0, length = themeBtns.length; i < length; i++) {
|
|
|
|
for (var i = 0, length = themeBtns.length; i < length; i++) {
|
|
|
@ -155,6 +162,7 @@ export default class SettingsIndex {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
api.request(url, eventType, REQUEST_TYPE_POST, CONTENT_TYPE_FORM, imageData)
|
|
|
|
api.request(url, eventType, REQUEST_TYPE_POST, CONTENT_TYPE_FORM, imageData)
|
|
|
|
.then(response => {
|
|
|
|
.then(response => {
|
|
|
|
|
|
|
|
//TODO: Move JSON processing to API class
|
|
|
|
let r = JSON.parse(response.request['response']);
|
|
|
|
let r = JSON.parse(response.request['response']);
|
|
|
|
if (r.type == DataEvent.AVATAR_UPLOADED) {
|
|
|
|
if (r.type == DataEvent.AVATAR_UPLOADED) {
|
|
|
|
notify.alert(r.message, true);
|
|
|
|
notify.alert(r.message, true);
|
|
|
@ -168,4 +176,23 @@ export default class SettingsIndex {
|
|
|
|
//console.log(err)
|
|
|
|
//console.log(err)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
handlePublished(e) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
let task = { task: 'publish all pages' };
|
|
|
|
|
|
|
|
api.request(
|
|
|
|
|
|
|
|
'/api/v1/settings/publish-pages',
|
|
|
|
|
|
|
|
DataEvent.API_RENDER_PAGES,
|
|
|
|
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
|
|
|
|
CONTENT_TYPE_JSON,
|
|
|
|
|
|
|
|
task
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.then(response => {
|
|
|
|
|
|
|
|
let r = JSON.parse(response.request['response']);
|
|
|
|
|
|
|
|
console.log('RESPONSE', r);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(err => {
|
|
|
|
|
|
|
|
notify.alert(err, false);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|