added Navigation data class, menu updates on page soft delete
parent
7b6af21c77
commit
ea1795e0fa
@ -0,0 +1,44 @@
|
||||
//import fh from 'filehound';
|
||||
import fs from 'fs-extra';
|
||||
//import metadataParser from 'markdown-yaml-metadata-parser';
|
||||
import _ from 'lodash';
|
||||
import * as DataEvent from '../../src/com/events/DataEvent';
|
||||
//const moment = require('moment');
|
||||
|
||||
export default class Navigation {
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {}
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
start() {}
|
||||
|
||||
editMenu(task, item) {
|
||||
switch (task) {
|
||||
case DataEvent.MENU_ADD_ITEM:
|
||||
break;
|
||||
case DataEvent.MENU_DELETE_ITEM:
|
||||
fs.readJSON('site/settings.json').then(settings => {
|
||||
settings.menu = _.remove(settings.menu, m => {
|
||||
return m.uuid != item.uuid;
|
||||
});
|
||||
fs.writeJSON('site/settings.json', settings);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
updatePageStats() {
|
||||
fs.readJSON('site/settings.json').then(settings => {
|
||||
settings.library_stats.current_index = ++settings.library_stats.current_index;
|
||||
settings.library_stats.total_pages = ++settings.library_stats.total_pages;
|
||||
fs.writeJSON('site/settings.json', settings);
|
||||
});
|
||||
}
|
||||
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
}
|
Loading…
Reference in New Issue