* Mostly work on building demo / NU-MAYA theme for testing / working out details / etc.

This commit is contained in:
Bryan Ashby 2015-09-07 21:18:09 -06:00
parent 6517f50e0c
commit 2edc63632b
12 changed files with 180 additions and 49 deletions

View file

@ -431,7 +431,7 @@ Client.prototype.address = function() {
Client.prototype.gotoMenuModule = function(options, cb) {
var self = this;
assert(options.name);
assert(_.isString(options.name), 'Missing options.name');
// Assign a default missing module handler callback if none was provided
var callbackOnErrorOnly = !_.isFunction(cb);
@ -452,9 +452,17 @@ Client.prototype.gotoMenuModule = function(options, cb) {
} else {
self.log.debug( { menuName : options.name }, 'Goto menu module');
modInst.enter(self);
if(self.currentMenuModule) {
self.lastMenuModuleInfo = {
name : self.currentMenuModule.modInfo.name,
extraArgs : self.currentMenuModuleExtraArgs,
};
}
self.currentMenuModule = modInst;
modInst.enter(self);
self.currentMenuModule = modInst; // :TODO: should probably be before enter() above
self.currentMenuModuleExtraArgs = options.extraArgs;
if(!callbackOnErrorOnly) {
cb(null);
@ -464,7 +472,16 @@ Client.prototype.gotoMenuModule = function(options, cb) {
};
Client.prototype.fallbackMenuModule = function(cb) {
var self = this;
if(self.lastMenuModuleInfo) {
var modOpts = {
name : self.lastMenuModuleInfo.name,
extraArgs : self.lastMenuModuleInfo.extraArgs,
};
self.gotoMenuModule(modOpts, cb);
}
};
///////////////////////////////////////////////////////////////////////////////

View file

@ -43,12 +43,18 @@ exports.moduleInfo = {
TL10 - Message ID
TL11 - Reply to message ID
TL12 - User1
TL13 - User2
Footer - Viewing
HM1 - Menu (prev/next/etc.)
TL6 - Message number
TL7 - Message total (in area)
TL12 - User1 (fmt message object)
TL13 - User2
*/
var MCICodeIds = {
@ -64,6 +70,10 @@ var MCICodeIds = {
HashTags : 9,
MessageID : 10,
ReplyToMsgID : 11
},
ViewModeFooter : {
MsgNum : 6,
MsgTotal : 7,
}
};
@ -150,6 +160,7 @@ function FullScreenEditorModule(options) {
if(self.isReady) {
self.initHeaderViewMode();
self.initFooterViewMode();
var bodyMessageView = self.viewControllers.body.getView(1);
if(bodyMessageView && _.has(self, 'message.message')) {
@ -181,7 +192,7 @@ function FullScreenEditorModule(options) {
// Body : We must find this in the config / theme
//
// :TODO: don't hard code this -- allow footer height to be part of theme/etc.
self.client.term.rawWrite(ansi.goto(23, 1));
self.client.term.rawWrite(ansi.goto(24, 1));
callback(null);
},
function clearFooterArea(callback) {
@ -401,6 +412,7 @@ function FullScreenEditorModule(options) {
case 'view' :
if(self.message) {
self.initHeaderViewMode();
self.initFooterViewMode();
var bodyMessageView = self.viewControllers.body.getView(1);
if(bodyMessageView && _.has(self, 'message.message')) {
@ -502,6 +514,19 @@ function FullScreenEditorModule(options) {
setHeaderText(MCICodeIds.ViewModeHeader.ReplyToMsgID, self.message.replyToMessageId);
};
this.initFooterViewMode = function() {
function setFooterText(id, text) {
var v = self.viewControllers.footerView.getView(id);
if(v) {
v.setText(text);
}
}
setFooterText(MCICodeIds.ViewModeFooter.MsgNum, (self.messageIndex + 1).toString());
setFooterText(MCICodeIds.ViewModeFooter.MsgTotal, self.messageTotal.toString());
};
this.displayHelp = function() {
self.client.term.rawWrite(ansi.resetScreen());

View file

@ -62,6 +62,8 @@ MCIViewFactory.prototype.getPredefinedViewLabel = function(code) {
UW : this.client.user.properties.web_address,
UF : this.client.user.properties.affiliation,
UT : this.client.user.properties.theme_id,
UC : this.client.user.properties.login_count.toString(),
MS : moment(this.client.user.properties.account_created).format(this.client.currentTheme.helpers.getDateFormat()),
CS : this.client.currentStatus,
MD : getCurrentMenuDescription(),

View file

@ -16,6 +16,8 @@ var _ = require('lodash');
exports.MenuModule = MenuModule;
// :TODO: some of this is a bit off... should pause after finishedLoading()
function MenuModule(options) {
PluginModule.call(this, options);