* 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,15 +342,21 @@ 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 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();
@ -429,6 +443,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);
}
@ -111,7 +111,8 @@ exports.getModule = class FileBaseSearch extends MenuModule {
const menuOpts = {
extraArgs : {
filterCriteria : filterCriteria,
}
},
menuFlags : [ 'noHistory' ],
};
return this.gotoMenu(this.menuConfig.config.fileBaseListEntriesMenu || 'fileBaseListEntries', menuOpts, cb);