Art asset ACS conditional cleanup: Make more general purpose

This commit is contained in:
Bryan Ashby 2018-11-17 18:56:09 -07:00
parent 0f35b0c58e
commit b3ec97cc5c
3 changed files with 11 additions and 5 deletions

View File

@ -542,7 +542,7 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul
theme.displayThemedAsset( theme.displayThemedAsset(
art[n], art[n],
self.client, self.client,
{ font : self.menuConfig.font, acsCondMember : 'art' }, { font : self.menuConfig.font },
function displayed(err) { function displayed(err) {
next(err); next(err);
} }
@ -622,7 +622,7 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul
theme.displayThemedAsset( theme.displayThemedAsset(
art[n], art[n],
self.client, self.client,
{ font : self.menuConfig.font, acsCondMember : 'art' }, { font : self.menuConfig.font },
function displayed(err, artData) { function displayed(err, artData) {
if(artData) { if(artData) {
mciData[n] = artData; mciData[n] = artData;

View File

@ -49,13 +49,18 @@ exports.MenuModule = class MenuModule extends PluginModule {
const mciData = {}; const mciData = {};
let pausePosition; let pausePosition;
const hasArt = () => {
return _.isString(self.menuConfig.art) ||
(Array.isArray(self.menuConfig.art) && _.has(self.menuConfig.art[0], 'acs'));
};
async.series( async.series(
[ [
function beforeDisplayArt(callback) { function beforeDisplayArt(callback) {
self.beforeArt(callback); self.beforeArt(callback);
}, },
function displayMenuArt(callback) { function displayMenuArt(callback) {
if(!_.isString(self.menuConfig.art)) { if(!hasArt()) {
return callback(null); return callback(null);
} }

View File

@ -682,8 +682,9 @@ function displayThemedAsset(assetSpec, client, options, cb) {
options = {}; options = {};
} }
if(Array.isArray(assetSpec) && _.isString(options.acsCondMember)) { if(Array.isArray(assetSpec)) {
assetSpec = client.acs.getConditionalValue(assetSpec, options.acsCondMember); const acsCondMember = options.acsCondMember || 'art';
assetSpec = client.acs.getConditionalValue(assetSpec, acsCondMember);
} }
const artAsset = asset.getArtAsset(assetSpec); const artAsset = asset.getArtAsset(assetSpec);