* More progress on theming esp. in relation to .config menu module sections

This commit is contained in:
Bryan Ashby
2015-10-09 23:35:40 -06:00
parent a6cd6bd3b9
commit 3038213c09
6 changed files with 94 additions and 44 deletions

View File

@@ -25,6 +25,8 @@ exports.getModule = LastCallersModule;
// :TODO:
// * config.evenRowSGR (optional)
// :TODO: convert to using %XY system for finding row count
function LastCallersModule(options) {
MenuModule.call(this, options);
@@ -32,7 +34,13 @@ function LastCallersModule(options) {
this.menuConfig = options.menuConfig;
this.rows = 10;
}
util.inherits(LastCallersModule, MenuModule);
LastCallersModule.prototype.enter = function(client) {
LastCallersModule.super_.prototype.enter.call(this, client);
if(_.isObject(this.menuConfig.config)) {
if(_.isNumber(this.menuConfig.config.rows)) {
this.rows = Math.max(1, this.menuConfig.config.rows);
@@ -41,12 +49,6 @@ function LastCallersModule(options) {
this.dateTimeFormat = this.menuConfig.config.dateTimeFormat;
}
}
}
util.inherits(LastCallersModule, MenuModule);
LastCallersModule.prototype.enter = function(client) {
LastCallersModule.super_.prototype.enter.call(this, client);
// we need the client to init this for theming
if(!_.isString(this.dateTimeFormat)) {

View File

@@ -55,7 +55,7 @@ function MessageListModule(options) {
selectMessage : function(formData, extraArgs) {
if(1 === formData.submitId) {
var modOpts = {
name : 'messageAreaViewPost', // :TODO: should come from config?
name : 'messageAreaViewPost', // :TODO: should come from config!!!
extraArgs : {
messageAreaName : self.messageAreaName,
messageList : self.messageList,
@@ -72,14 +72,13 @@ function MessageListModule(options) {
require('util').inherits(MessageListModule, MenuModule);
MessageListModule.prototype.enter = function(client) {
MessageListModule.super_.prototype.enter.call(this, client);
if('private' === this.listType) {
this.messageAreaName = Message.WellKnownAreaNames.Private;
} else {
this.messageAreaName = client.user.properties.message_area_name;
}
MessageListModule.super_.prototype.enter.call(this, client);
};
MessageListModule.prototype.mciReady = function(mciData, cb) {
@@ -112,15 +111,29 @@ MessageListModule.prototype.mciReady = function(mciData, cb) {
function populateList(callback) {
var msgListView = vc.getView(1);
var listFormat = self.menuConfig.config.listFormat || '{msgNum:>4} - {subj:>35} |{to:>15}';
var focusListFormat = self.menuConfig.config.focusListFormat;
var msgNum = 1;
msgListView.setItems(_.map(self.messageList, function formatMsgListEntry(mle) {
return '{msgNum:>4} - {subj:>25} {to:>15}'.format( {
return listFormat.format( {
msgNum : msgNum++,
subj : mle.subject,
to : mle.toUserName
} );
}));
if(focusListFormat) {
msgNum = 1;
msgListView.setFocusItems(_.map(self.messageList, function formatMsgListEntry(mle) {
return focusListFormat.format( {
msgNum : msgNum++,
subj : mle.subject,
to : mle.toUserName
} );
}));
}
msgListView.redraw();
callback(null);

View File

@@ -69,6 +69,13 @@
}
}
messageAreaMessageList: {
config: {
listFormat: "|00|01|37{msgNum:>4} |22|37- |00|36{subj:>35} |01{to:>17}"
focusListFormat: "|00|01|42|37{msgNum:>4} |22|37- |36{subj:>35} |01{to:>17}"
}
}
messageAreaViewPost: {
0: {
mci: {