started implementation of multiple file uploads and sorting
parent
8f9021bb7d
commit
3c52bca8ba
@ -1,70 +1,70 @@
|
||||
{
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 7,
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {}
|
||||
},
|
||||
"rules": {
|
||||
"constructor-super": 2,
|
||||
"for-direction": 2,
|
||||
"getter-return": 2,
|
||||
"no-case-declarations": 2,
|
||||
"no-class-assign": 2,
|
||||
"no-compare-neg-zero": 2,
|
||||
"no-cond-assign": 2,
|
||||
"no-console": 1,
|
||||
"no-const-assign": 2,
|
||||
"no-constant-condition": 2,
|
||||
"no-control-regex": 1,
|
||||
"no-debugger": 2,
|
||||
"no-delete-var": 2,
|
||||
"no-dupe-args": 2,
|
||||
"no-dupe-class-members": 2,
|
||||
"no-dupe-keys": 2,
|
||||
"no-duplicate-case": 2,
|
||||
"no-empty": 2,
|
||||
"no-empty-character-class": 2,
|
||||
"no-empty-pattern": 2,
|
||||
"no-ex-assign": 2,
|
||||
"no-extra-boolean-cast": 2,
|
||||
"no-extra-semi": 2,
|
||||
"no-fallthrough": 2,
|
||||
"no-func-assign": 2,
|
||||
"no-global-assign": 2,
|
||||
"no-inner-declarations": 2,
|
||||
"no-invalid-regexp": 2,
|
||||
"no-irregular-whitespace": 2,
|
||||
"no-mixed-spaces-and-tabs": 2,
|
||||
"no-new-symbol": 2,
|
||||
"no-obj-calls": 2,
|
||||
"no-octal": 2,
|
||||
"no-redeclare": 2,
|
||||
"no-regex-spaces": 2,
|
||||
"no-self-assign": 2,
|
||||
"no-sparse-arrays": 2,
|
||||
"no-this-before-super": 2,
|
||||
"no-undef": 2,
|
||||
"no-unexpected-multiline": 2,
|
||||
"no-unreachable": 2,
|
||||
"no-unsafe-finally": 2,
|
||||
"no-unsafe-negation": 2,
|
||||
"no-unused-labels": 2,
|
||||
"no-unused-vars": 2,
|
||||
"no-useless-escape": 1,
|
||||
"require-yield": 2,
|
||||
"use-isnan": 2,
|
||||
"valid-typeof": 2,
|
||||
"no-duplicate-imports": 2
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"globals": {
|
||||
"_": false,
|
||||
"hljs": false,
|
||||
"Sortable": false,
|
||||
"Prism": false
|
||||
}
|
||||
}
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 7,
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {}
|
||||
},
|
||||
"rules": {
|
||||
"constructor-super": 2,
|
||||
"for-direction": 2,
|
||||
"getter-return": 2,
|
||||
"no-case-declarations": 2,
|
||||
"no-class-assign": 2,
|
||||
"no-compare-neg-zero": 2,
|
||||
"no-cond-assign": 2,
|
||||
"no-console": 1,
|
||||
"no-const-assign": 2,
|
||||
"no-constant-condition": 2,
|
||||
"no-control-regex": 1,
|
||||
"no-debugger": 2,
|
||||
"no-delete-var": 2,
|
||||
"no-dupe-args": 2,
|
||||
"no-dupe-class-members": 2,
|
||||
"no-dupe-keys": 2,
|
||||
"no-duplicate-case": 2,
|
||||
"no-empty": 2,
|
||||
"no-empty-character-class": 2,
|
||||
"no-empty-pattern": 2,
|
||||
"no-ex-assign": 2,
|
||||
"no-extra-boolean-cast": 2,
|
||||
"no-extra-semi": 2,
|
||||
"no-fallthrough": 2,
|
||||
"no-func-assign": 2,
|
||||
"no-global-assign": 2,
|
||||
"no-inner-declarations": 2,
|
||||
"no-invalid-regexp": 2,
|
||||
"no-irregular-whitespace": 2,
|
||||
"no-mixed-spaces-and-tabs": 2,
|
||||
"no-new-symbol": 2,
|
||||
"no-obj-calls": 2,
|
||||
"no-octal": 2,
|
||||
"no-redeclare": 2,
|
||||
"no-regex-spaces": 2,
|
||||
"no-self-assign": 2,
|
||||
"no-sparse-arrays": 2,
|
||||
"no-this-before-super": 2,
|
||||
"no-undef": 2,
|
||||
"no-unexpected-multiline": 2,
|
||||
"no-unreachable": 2,
|
||||
"no-unsafe-finally": 2,
|
||||
"no-unsafe-negation": 2,
|
||||
"no-unused-labels": 2,
|
||||
"no-unused-vars": 1,
|
||||
"no-useless-escape": 1,
|
||||
"require-yield": 2,
|
||||
"use-isnan": 2,
|
||||
"valid-typeof": 2,
|
||||
"no-duplicate-imports": 2
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"globals": {
|
||||
"_": false,
|
||||
"hljs": false,
|
||||
"Sortable": false,
|
||||
"Prism": false
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
.babelrc
|
||||
README.md
|
||||
*.twig
|
||||
*.sass
|
||||
*.json
|
||||
*.php
|
||||
*.md
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"arrowParens": "avoid",
|
||||
"bracketSpacing": true,
|
||||
"htmlWhitespaceSensitivity": "css",
|
||||
"insertPragma": false,
|
||||
"bracketSameLine": false,
|
||||
"jsxSingleQuote": true,
|
||||
"parser": "babel",
|
||||
"proseWrap": "preserve",
|
||||
"requirePragma": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"useTabs": true,
|
||||
"tabWidth": 4,
|
||||
"printWidth": 90
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1,213 +1,217 @@
|
||||
import FipamoAdminAPI from "../libraries/FipamoAdminAPI";
|
||||
import Maintenance from "./controllers/MaintenanceManager";
|
||||
import DataUitls from "./utils/DataUtils";
|
||||
import * as DataEvent from "./events/DataEvent";
|
||||
import DashManager from "./controllers/DashManager";
|
||||
import Notfications from "./ui/Notifications";
|
||||
import FipamoAdminAPI from '../libraries/FipamoAdminAPI';
|
||||
import Maintenance from './controllers/MaintenanceManager';
|
||||
import DataUitls from './utils/DataUtils';
|
||||
import * as DataEvent from './events/DataEvent';
|
||||
import DashManager from './controllers/DashManager';
|
||||
import Notfications from './ui/Notifications';
|
||||
const data = new DataUitls();
|
||||
const notify = new Notfications();
|
||||
|
||||
export default class Base {
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {
|
||||
this.processing = false;
|
||||
this.start();
|
||||
}
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {
|
||||
this.processing = false;
|
||||
this.start();
|
||||
}
|
||||
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
start() {
|
||||
if (
|
||||
document.getElementById("dash-form") ||
|
||||
document.getElementById("dash-init")
|
||||
) {
|
||||
var options = document.getElementsByClassName("init-option");
|
||||
for (let index = 0; index < options.length; index++) {
|
||||
options[index].addEventListener("click", (e) => this.handleOptions(e));
|
||||
}
|
||||
if (document.getElementById("dash-form")) {
|
||||
document
|
||||
.getElementById("login-btn")
|
||||
.addEventListener("click", (e) => this.handleLogin(e));
|
||||
} else {
|
||||
document
|
||||
.getElementById("init-blog")
|
||||
.addEventListener("click", (e) => this.handleSetup(e));
|
||||
document
|
||||
.getElementById("blog-restore")
|
||||
.addEventListener("click", (e) => this.handleRestore(e));
|
||||
}
|
||||
} else if (document.getElementById("dash-reset")) {
|
||||
document
|
||||
.getElementById("get-secret-btn")
|
||||
.addEventListener("click", (e) => this.handleReset(e));
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
start() {
|
||||
if (
|
||||
document.getElementById('dash-form') ||
|
||||
document.getElementById('dash-init')
|
||||
) {
|
||||
var options = document.getElementsByClassName('init-option');
|
||||
for (let index = 0; index < options.length; index++) {
|
||||
options[index].addEventListener('click', e =>
|
||||
this.handleOptions(e)
|
||||
);
|
||||
}
|
||||
if (document.getElementById('dash-form')) {
|
||||
document
|
||||
.getElementById('login-btn')
|
||||
.addEventListener('click', e => this.handleLogin(e));
|
||||
} else {
|
||||
document
|
||||
.getElementById('init-blog')
|
||||
.addEventListener('click', e => this.handleSetup(e));
|
||||
document
|
||||
.getElementById('blog-restore')
|
||||
.addEventListener('click', e => this.handleRestore(e));
|
||||
}
|
||||
} else if (document.getElementById('dash-reset')) {
|
||||
document
|
||||
.getElementById('get-secret-btn')
|
||||
.addEventListener('click', e => this.handleReset(e));
|
||||
|
||||
document
|
||||
.getElementById("reset-btn")
|
||||
.addEventListener("click", (e) => this.handleReset(e));
|
||||
} else {
|
||||
new DashManager();
|
||||
}
|
||||
}
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
handleLogin(e) {
|
||||
if (this.processing) return;
|
||||
let self = this;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let authForm = data.formDataToJSON(document.getElementById("login"));
|
||||
notify.alert("Looking, hold up", null);
|
||||
let api = new FipamoAdminAPI();
|
||||
this.processing = true;
|
||||
api
|
||||
.login(authForm)
|
||||
.then((response) => {
|
||||
self.processing = false;
|
||||
if (response.type === DataEvent.REQUEST_LAME) {
|
||||
notify.alert(response.message, false);
|
||||
} else {
|
||||
notify.alert(response.message, true);
|
||||
e.target.innerHTML = response.message;
|
||||
setTimeout(() => {
|
||||
window.location = "/dashboard";
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
self.processing = false;
|
||||
notify.alert(err, false);
|
||||
});
|
||||
}
|
||||
document
|
||||
.getElementById('reset-btn')
|
||||
.addEventListener('click', e => this.handleReset(e));
|
||||
} else {
|
||||
new DashManager();
|
||||
}
|
||||
}
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
handleLogin(e) {
|
||||
if (this.processing) return;
|
||||
let self = this;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let authForm = data.formDataToJSON(document.getElementById('login'));
|
||||
notify.alert('Looking, hold up', null);
|
||||
let api = new FipamoAdminAPI();
|
||||
this.processing = true;
|
||||
api.login(authForm)
|
||||
.then(response => {
|
||||
self.processing = false;
|
||||
if (response.type === DataEvent.REQUEST_LAME) {
|
||||
notify.alert(response.message, false);
|
||||
} else {
|
||||
notify.alert(response.message, true);
|
||||
e.target.innerHTML = response.message;
|
||||
setTimeout(() => {
|
||||
window.location = '/dashboard';
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
self.processing = false;
|
||||
notify.alert(err, false);
|
||||
});
|
||||
}
|
||||
|
||||
handleSetup(e) {
|
||||
if (this.processing) return;
|
||||
let self = this;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let setUpForm = data.formDataToJSON(document.getElementById("init-form"));
|
||||
let mm = new Maintenance();
|
||||
this.processing = true;
|
||||
mm.create(setUpForm)
|
||||
.then((response) => {
|
||||
if (response.type === DataEvent.API_INIT_LAME) {
|
||||
self.processing = false;
|
||||
notify.alert(response.message, false);
|
||||
} else {
|
||||
self.processing = false;
|
||||
notify.alert(response.message, true);
|
||||
setTimeout(() => {
|
||||
window.location = "/dashboard";
|
||||
}, 700);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
self.processing = false;
|
||||
notify.alert(err, false);
|
||||
});
|
||||
}
|
||||
handleSetup(e) {
|
||||
if (this.processing) return;
|
||||
let self = this;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let setUpForm = data.formDataToJSON(
|
||||
document.getElementById('init-form')
|
||||
);
|
||||
let mm = new Maintenance();
|
||||
this.processing = true;
|
||||
mm.create(setUpForm)
|
||||
.then(response => {
|
||||
if (response.type === DataEvent.API_INIT_LAME) {
|
||||
self.processing = false;
|
||||
notify.alert(response.message, false);
|
||||
} else {
|
||||
self.processing = false;
|
||||
notify.alert(response.message, true);
|
||||
setTimeout(() => {
|
||||
window.location = '/dashboard';
|
||||
}, 700);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
self.processing = false;
|
||||
notify.alert(err, false);
|
||||
});
|
||||
}
|
||||
|
||||
handleRestore(e) {
|
||||
if (this.processing) return;
|
||||
let self = this;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let mm = new Maintenance();
|
||||
var form = document.getElementById("init-restore");
|
||||
this.processing = true;
|
||||
mm.restore(form)
|
||||
.then((response) => {
|
||||
if (response.type === DataEvent.REQUEST_LAME) {
|
||||
self.processing = false;
|
||||
notify.alert(response.message, false);
|
||||
} else {
|
||||
self.processing = false;
|
||||
notify.alert(response.message, true);
|
||||
setTimeout(() => {
|
||||
window.location = "/dashboard";
|
||||
}, 1500);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
self.processing = false;
|
||||
notify.alert(err, false);
|
||||
});
|
||||
}
|
||||
handleRestore(e) {
|
||||
if (this.processing) return;
|
||||
let self = this;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let mm = new Maintenance();
|
||||
var form = document.getElementById('init-restore');
|
||||
this.processing = true;
|
||||
mm.restore(form)
|
||||
.then(response => {
|
||||
if (response.type === DataEvent.REQUEST_LAME) {
|
||||
self.processing = false;
|
||||
notify.alert(response.message, false);
|
||||
} else {
|
||||
self.processing = false;
|
||||
notify.alert(response.message, true);
|
||||
setTimeout(() => {
|
||||
window.location = '/dashboard';
|
||||
}, 1500);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
self.processing = false;
|
||||
notify.alert(err, false);
|
||||
});
|
||||
}
|
||||
|
||||
handleReset(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let self = this;
|
||||
let mm = new Maintenance();
|
||||
if (e.target.id == "get-secret-btn") {
|
||||
let data = {
|
||||
email: document.getElementById("email").value,
|
||||
task: "retrieveSecret"
|
||||
};
|
||||
this.processing = true;
|
||||
mm.secret(data)
|
||||
.then((response) => {
|
||||
self.processing = false;
|
||||
if (response.secret) {
|
||||
document.getElementById("secret").value = response.secret;
|
||||
notify.alert(response.message, true);
|
||||
} else {
|
||||
if (response.type == "mailSent") {
|
||||
notify.alert(response.message, true);
|
||||
} else {
|
||||
notify.alert(response.message, false);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
self.processing = false;
|
||||
notify.alert(err, false);
|
||||
});
|
||||
} else {
|
||||
let data = {
|
||||
newPass: document.getElementById("new_password").value,
|
||||
newPassConfirm: document.getElementById("new_password2").value,
|
||||
secret: document.getElementById("secret").value
|
||||
};
|
||||
mm.newPass(data)
|
||||
.then((response) => {
|
||||
self.processing = false;
|
||||
if (response.type == "passNotCreated") {
|
||||
notify.alert(response.message, false);
|
||||
} else {
|
||||
notify.alert(response.message, true);
|
||||
setTimeout(() => {
|
||||
window.location = "/dashboard";
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
self.processing = false;
|
||||
notify.alert(err, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
handleOptions(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let init = document.getElementById("dash-init");
|
||||
let restore = document.getElementById("dash-restore");
|
||||
if (e.target.id === "init-switch-restore") {
|
||||
init.style.display = "none";
|
||||
init.style.visibility = "hidden";
|
||||
handleReset(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let self = this;
|
||||
let mm = new Maintenance();
|
||||
if (e.target.id == 'get-secret-btn') {
|
||||
let data = {
|
||||
email: document.getElementById('email').value,
|
||||
task: 'retrieveSecret'
|
||||
};
|
||||
this.processing = true;
|
||||
mm.secret(data)
|
||||
.then(response => {
|
||||
self.processing = false;
|
||||
if (response.secret) {
|
||||
document.getElementById('secret').value =
|
||||
response.secret;
|
||||
notify.alert(response.message, true);
|
||||
} else {
|
||||
if (response.type == 'mailSent') {
|
||||
notify.alert(response.message, true);
|
||||
} else {
|
||||
notify.alert(response.message, false);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
self.processing = false;
|
||||
notify.alert(err, false);
|
||||
});
|
||||
} else {
|
||||
let data = {
|
||||
newPass: document.getElementById('new_password').value,
|
||||
newPassConfirm: document.getElementById('new_password2').value,
|
||||
secret: document.getElementById('secret').value
|
||||
};
|
||||
mm.newPass(data)
|
||||
.then(response => {
|
||||
self.processing = false;
|
||||
if (response.type == 'passNotCreated') {
|
||||
notify.alert(response.message, false);
|
||||
} else {
|
||||
notify.alert(response.message, true);
|
||||
setTimeout(() => {
|
||||
window.location = '/dashboard';
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
self.processing = false;
|
||||
notify.alert(err, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
handleOptions(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
let init = document.getElementById('dash-init');
|
||||
let restore = document.getElementById('dash-restore');
|
||||
if (e.target.id === 'init-switch-restore') {
|
||||
init.style.display = 'none';
|
||||
init.style.visibility = 'hidden';
|
||||
|
||||
restore.style.display = "flex";
|
||||
restore.style.visibility = "visible";
|
||||
} else {
|
||||
init.style.display = "flex";
|
||||
init.style.visibility = "visible";
|
||||
restore.style.display = 'flex';
|
||||
restore.style.visibility = 'visible';
|
||||
} else {
|
||||
init.style.display = 'flex';
|
||||
init.style.visibility = 'visible';
|
||||
|
||||
restore.style.display = "none";
|
||||
restore.style.visibility = "hidden";
|
||||
}
|
||||
}
|
||||
restore.style.display = 'none';
|
||||
restore.style.visibility = 'hidden';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,41 +1,41 @@
|
||||
import PostIndex from "./PostIndex";
|
||||
import SettingsIndex from "./SettingsIndex";
|
||||
import NaviIndex from "./NavIndex";
|
||||
import PostIndex from './PostIndex';
|
||||
import SettingsIndex from './SettingsIndex';
|
||||
import NaviIndex from './NavIndex';
|
||||
|
||||
export default class DashManager {
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {
|
||||
this.currentDisplay = "";
|
||||
this.urlPieces = document.URL.split("/");
|
||||
this.chooseDisplay(this.urlPieces[4], this.urlPieces[5]);
|
||||
}
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
start() {}
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {
|
||||
this.currentDisplay = '';
|
||||
this.urlPieces = document.URL.split('/');
|
||||
this.chooseDisplay(this.urlPieces[4], this.urlPieces[5]);
|
||||
}
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
start() {}
|
||||
|
||||
chooseDisplay(section, page) {
|
||||
this.currentDisplay = "";
|
||||
switch (section) {
|
||||
case "page":
|
||||
this.currentDisplay = new PostIndex(page);
|
||||
break;
|
||||
case "settings":
|
||||
this.currentDisplay = new SettingsIndex();
|
||||
break;
|
||||
case "navigation":
|
||||
this.currentDisplay = new NaviIndex();
|
||||
break;
|
||||
chooseDisplay(section, page) {
|
||||
this.currentDisplay = '';
|
||||
switch (section) {
|
||||
case 'page':
|
||||
this.currentDisplay = new PostIndex(page);
|
||||
break;
|
||||
case 'settings':
|
||||
this.currentDisplay = new SettingsIndex();
|
||||
break;
|
||||
case 'navigation':
|
||||
this.currentDisplay = new NaviIndex();
|
||||
break;
|
||||
|
||||
default:
|
||||
//just chill
|
||||
break;
|
||||
}
|
||||
this.start();
|
||||
}
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
default:
|
||||
//just chill
|
||||
break;
|
||||
}
|
||||
this.start();
|
||||
}
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
}
|
||||
|
@ -1,84 +1,93 @@
|
||||
//TOOLS
|
||||
import FipamoAdminAPI, {
|
||||
TASK_PAGE_CREATE,
|
||||
TASK_PAGE_EDIT,
|
||||
TASK_PAGE_DELETE
|
||||
} from "../../libraries/FipamoAdminAPI";
|
||||
import Maintenance from "./MaintenanceManager";
|
||||
import * as DataEvent from "../events/DataEvent";
|
||||
import PageActions from "../actions/PageActions";
|
||||
import * as EditorEvent from "../events/EditorEvent";
|
||||
TASK_PAGE_CREATE,
|
||||
TASK_PAGE_EDIT,
|
||||
TASK_PAGE_DELETE
|
||||
} from '../../libraries/FipamoAdminAPI';
|
||||
import Maintenance from './MaintenanceManager';
|
||||
import * as DataEvent from '../events/DataEvent';
|
||||
import PageActions from '../actions/PageActions';
|
||||
import * as EditorEvent from '../events/EditorEvent';
|
||||
//import TinyDatePicker from 'tiny-date-picker'; TODO: Reactivate for scheduled publishing
|
||||
import TextEditor from "../ui/TextEditor";
|
||||
import Notfications from "../ui/Notifications";
|
||||
import TextEditor from '../ui/TextEditor';
|
||||
import Notfications from '../ui/Notifications';
|
||||
import FileManager from '../ui/FileManager';
|
||||
const notify = new Notfications();
|
||||
export default class PostEditor {
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {
|
||||
this.processing = false;
|
||||
let self = this;
|
||||
this.admin = new FipamoAdminAPI(
|
||||
null,
|
||||
document.getElementById("notify-progress")
|
||||
);
|
||||
this.mm = new Maintenance(
|
||||
null,
|
||||
null,
|
||||
document.getElementById("notify-progress")
|
||||
);
|
||||
this.urlPieces = document.URL.split("/");
|
||||
this.post = [];
|
||||
this.postID = null;
|
||||
this.postUUID = null;
|
||||
this.postLayout = null;
|
||||
if (document.getElementById("post-edit-index").getAttribute("data-index")) {
|
||||
this.postID = document
|
||||
.getElementById("post-edit-index")
|
||||
.getAttribute("data-index");
|
||||
this.postUUID = document
|
||||
.getElementById("post-edit-index")
|
||||
.getAttribute("data-uuid");
|
||||
this.postLayout = document
|
||||
.getElementById("post-edit-index")
|
||||
.getAttribute("data-layout");
|
||||
}
|
||||
if (document.getElementById("edit")) {
|
||||
this.editor = new TextEditor(
|
||||
document.getElementById("edit"),
|
||||
document.getElementById("header").offsetHeight +
|
||||
document.getElementById("post-header").offsetHeight +
|
||||
document.getElementById("post-feature").offsetHeight
|
||||
);
|
||||
this.editor.addListener(
|
||||
EditorEvent.EDITOR_DELETE,
|
||||
() => this.handleEditorOptions(EditorEvent.EDITOR_DELETE),
|
||||
false
|
||||
);
|
||||
this.editor.addListener(
|
||||
EditorEvent.EDITOR_UPLOAD_POST_IMAGE,
|
||||
() => this.handleEditorOptions(EditorEvent.EDITOR_UPLOAD_POST_IMAGE),
|
||||
false
|
||||
);
|
||||
this.editor.addListener(
|
||||
EditorEvent.EDITOR_UPDATE,
|
||||
() => this.handleEditorOptions(EditorEvent.EDITOR_UPDATE),
|
||||
false
|
||||
);
|
||||
this.editor.addListener(
|
||||
EditorEvent.EDITOR_SAVE,
|
||||
() => this.handleEditorOptions(EditorEvent.EDITOR_SAVE),
|
||||
false
|
||||
);
|
||||
document.getElementById("post-image-upload").addEventListener(
|
||||
"change",
|
||||
(e) => {
|
||||
self.handleImageUpload(e.target.id, e.target.files);
|
||||
},
|
||||
false
|
||||
);
|
||||
/*
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {
|
||||
this.processing = false;
|
||||
let self = this;
|
||||
this.admin = new FipamoAdminAPI(
|
||||
null,
|
||||
document.getElementById('notify-progress')
|
||||
);
|
||||
this.mm = new Maintenance(
|
||||
null,
|
||||
null,
|
||||
document.getElementById('notify-progress')
|
||||
);
|
||||
this.urlPieces = document.URL.split('/');
|
||||
this.post = [];
|
||||
this.postID = null;
|
||||
this.postUUID = null;
|
||||
this.postLayout = null;
|
||||
this.fm = null;
|
||||
if (
|
||||
document
|
||||
.getElementById('post-edit-index')
|
||||
.getAttribute('data-index')
|
||||
) {
|
||||
this.postID = document
|
||||
.getElementById('post-edit-index')
|
||||
.getAttribute('data-index');
|