* Help pages

* No results for criteria page
* noHistory can be passed to gotoMenu()
This commit is contained in:
Bryan Ashby 2017-02-07 22:15:34 -07:00
parent f4042e6556
commit 5549ff5512
3 changed files with 42 additions and 12 deletions

View File

@ -99,6 +99,7 @@ module.exports = class MenuStack {
if(!cb && _.isFunction(options)) {
cb = options;
options = {};
}
const self = this;
@ -134,7 +135,9 @@ module.exports = class MenuStack {
currentModuleInfo.instance.leave();
if(modInst.menuConfig.options.menuFlags.includes('noHistory')) {
const menuFlags = (options && Array.isArray(options.menuFlags)) ? options.menuFlags : modInst.menuConfig.options.menuFlags;
if(menuFlags.includes('noHistory')) {
this.pop().instance.leave(); // leave & remove current
}
}

View File

@ -124,6 +124,9 @@ exports.getModule = class FileAreaList extends MenuModule {
},
showWebDownloadLink : (formData, extraArgs, cb) => {
return this.fetchAndDisplayWebDownloadLink(cb);
},
displayHelp : (formData, extraArgs, cb) => {
return this.displayHelpPage(cb);
}
};
}
@ -180,7 +183,12 @@ exports.getModule = class FileAreaList extends MenuModule {
return self.beforeArt(callback);
},
function display(callback) {
return self.displayBrowsePage(false, callback);
return self.displayBrowsePage(false, err => {
if(err && 'NORESULTS' === err.reasonCode) {
self.gotoMenu(self.menuConfig.config.noResultsMenu || 'fileBaseListEntriesNoResults');
}
return callback(err);
});
}
],
() => {
@ -334,16 +342,22 @@ exports.getModule = class FileAreaList extends MenuModule {
async.series(
[
function prepArtAndViewController(callback) {
return self.displayArtAndPrepViewController('browse', { clearScreen : clearScreen }, callback);
},
function fetchEntryData(callback) {
if(self.fileList) {
return callback(null);
}
return self.loadFileIds(false, callback); // false=do not force
},
function loadCurrentFileInfo(callback) {
function checkEmptyResults(callback) {
if(0 === self.fileList.length) {
return callback(Errors.General('No results for criteria', 'NORESULTS'));
}
return callback(null);
},
function prepArtAndViewController(callback) {
return self.displayArtAndPrepViewController('browse', { clearScreen : clearScreen }, callback);
},
function loadCurrentFileInfo(callback) {
self.currentFileEntry = new FileEntry();
self.currentFileEntry.load( self.fileList[ self.fileListPosition ], err => {
@ -381,7 +395,7 @@ exports.getModule = class FileAreaList extends MenuModule {
}
}
],
err => {
err => {
if(cb) {
return cb(err);
}
@ -428,6 +442,18 @@ exports.getModule = class FileAreaList extends MenuModule {
}
);
}
displayHelpPage(cb) {
this.displayAsset(
this.menuConfig.config.art.help,
{ clearScreen : true },
() => {
this.client.waitForKeyPress( () => {
return this.displayBrowsePage(true, cb);
});
}
);
}
fetchAndDisplayWebDownloadLink(cb) {
const self = this;

View File

@ -58,9 +58,9 @@ exports.getModule = class FileBaseSearch extends MenuModule {
self.availAreas = [ { name : '-ALL-' } ].concat(getSortedAvailableFileAreas(self.client) || []);
const areasView = vc.getView(MciViewIds.search.area);
if(areasView) {
areasView.setItems( self.availAreas.map( a => a.name ) );
}
areasView.setItems( self.availAreas.map( a => a.name ) );
areasView.redraw();
vc.switchFocus(MciViewIds.search.searchTerms);
return callback(null);
}
@ -110,8 +110,9 @@ exports.getModule = class FileBaseSearch extends MenuModule {
const menuOpts = {
extraArgs : {
filterCriteria : filterCriteria,
}
filterCriteria : filterCriteria,
},
menuFlags : [ 'noHistory' ],
};
return this.gotoMenu(this.menuConfig.config.fileBaseListEntriesMenu || 'fileBaseListEntries', menuOpts, cb);