moved settings file, completed nav ordering, switched to pm2
parent
46d04ceb1e
commit
27a1e670e3
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,51 @@
|
|||||||
|
import DataUtils,
|
||||||
|
{
|
||||||
|
REQUEST_TYPE_GET,
|
||||||
|
REQUEST_TYPE_PUT,
|
||||||
|
REQUEST_TYPE_POST,
|
||||||
|
REQUEST_TYPE_DELETE,
|
||||||
|
CONTENT_TYPE_JSON,
|
||||||
|
CONTENT_TYPE_FORM
|
||||||
|
}
|
||||||
|
from '../../../../../brain//tools/utilities/DataUtils';
|
||||||
|
import StringUtils from '../../../../../brain//tools/utilities/StringUtils';
|
||||||
|
import DateUtils from '../../../../../brain/tools/utilities/DateUtils';
|
||||||
|
import * as DataEvent from '../../../../../brain/tools/events/DataEvent';
|
||||||
|
export default class NavActions
|
||||||
|
{
|
||||||
|
//--------------------------
|
||||||
|
// constructor
|
||||||
|
//--------------------------
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
this.dataUtils = new DataUtils();
|
||||||
|
this.dateUtils = new DateUtils();
|
||||||
|
}
|
||||||
|
//--------------------------
|
||||||
|
// methods
|
||||||
|
//--------------------------
|
||||||
|
save()
|
||||||
|
{
|
||||||
|
let self = this;
|
||||||
|
let navData = [];
|
||||||
|
let items = document.getElementById('nav-pages').children;
|
||||||
|
for (let index = 0; index < items.length; index++) {
|
||||||
|
navData.push({title:items[index].getElementsByTagName('label')[0].innerHTML, slug:items[index].id})
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise(function(resolve, reject)
|
||||||
|
{
|
||||||
|
self.dataUtils.request('/api/settings/nav-sync', DataEvent.SETTINGS_UPDATED, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, navData).then((response) =>
|
||||||
|
{
|
||||||
|
//console.log("RESPONSE", response)
|
||||||
|
resolve(response)
|
||||||
|
}).catch((err) =>
|
||||||
|
{
|
||||||
|
reject(err);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//--------------------------
|
||||||
|
// event handlers
|
||||||
|
//--------------------------
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
import NavActions from "../actions/NavActions";
|
||||||
|
import DataUtils,
|
||||||
|
{
|
||||||
|
REQUEST_TYPE_GET,
|
||||||
|
REQUEST_TYPE_PUT,
|
||||||
|
REQUEST_TYPE_POST,
|
||||||
|
REQUEST_TYPE_DELETE,
|
||||||
|
CONTENT_TYPE_JSON,
|
||||||
|
CONTENT_TYPE_FORM
|
||||||
|
}
|
||||||
|
from "../../../../../brain/tools/utilities/DataUtils";
|
||||||
|
import * as DataEvent from '../../../../../brain/tools/events/DataEvent';
|
||||||
|
export default class NavIndex
|
||||||
|
{
|
||||||
|
//--------------------------
|
||||||
|
// constructor
|
||||||
|
//--------------------------
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
this.start();
|
||||||
|
this.dataUtils = new DataUtils();
|
||||||
|
}
|
||||||
|
//--------------------------
|
||||||
|
// methods
|
||||||
|
//--------------------------
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
let self = this;
|
||||||
|
let menu = Sortable.create(document.getElementById("nav-pages"),
|
||||||
|
{
|
||||||
|
onUpdate: e =>
|
||||||
|
{
|
||||||
|
|
||||||
|
new NavActions().save().then(r=>{
|
||||||
|
console.log(r);
|
||||||
|
}).catch(err=>{
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//--------------------------
|
||||||
|
// event handlers
|
||||||
|
//--------------------------
|
||||||
|
}
|
Loading…
Reference in New Issue