* Minor work on themes + FSE

This commit is contained in:
Bryan Ashby 2015-10-06 15:22:49 -06:00
parent 0436dc2c3a
commit 73952a2c37
9 changed files with 88 additions and 48 deletions

View File

@ -7,6 +7,7 @@ var ansi = require('../core/ansi_term.js');
var theme = require('../core/theme.js');
var MultiLineEditTextView = require('../core/multi_line_edit_text_view.js').MultiLineEditTextView;
var Message = require('../core/message.js');
var getMessageAreaByName = require('../core/message_area.js').getMessageAreaByName;
var async = require('async');
var assert = require('assert');
@ -108,7 +109,6 @@ function FullScreenEditorModule(options) {
if(_.isObject(options.extraArgs)) {
//console.log(options.extraArgs)
this.messageAreaName = options.extraArgs.messageAreaName || Message.WellKnownAreaNames.Private;
console.log(this.messageAreaName)
this.messageIndex = options.extraArgs.messageIndex || 0;
this.messageTotal = options.extraArgs.messageTotal || 0;
}
@ -494,6 +494,8 @@ function FullScreenEditorModule(options) {
if(self.replyToMessage) {
self.initHeaderReplyEditMode();
} else {
self.initHeaderNewEditMode();
}
break;
}
@ -568,41 +570,45 @@ function FullScreenEditorModule(options) {
}
};
this.initHeaderViewMode = function() {
assert(_.isObject(self.message));
function setHeaderText(id, text) {
this.setHeaderText = function(id, text) {
var v = self.viewControllers.header.getView(id);
if(v) {
v.setText(text);
}
}
};
setHeaderText(MCICodeIds.ViewModeHeader.From, self.message.fromUserName);
setHeaderText(MCICodeIds.ViewModeHeader.To, self.message.toUserName);
setHeaderText(MCICodeIds.ViewModeHeader.Subject, self.message.subject);
setHeaderText(MCICodeIds.ViewModeHeader.AreaName, self.messageAreaName);
setHeaderText(MCICodeIds.ViewModeHeader.DateTime, moment(self.message.modTimestamp).format(self.client.currentTheme.helpers.getDateTimeFormat()));
setHeaderText(MCICodeIds.ViewModeHeader.MsgNum, (self.messageIndex + 1).toString());
setHeaderText(MCICodeIds.ViewModeHeader.MsgTotal, self.messageTotal.toString());
setHeaderText(MCICodeIds.ViewModeHeader.ViewCount, self.message.viewCount);
setHeaderText(MCICodeIds.ViewModeHeader.HashTags, 'TODO hash tags');
setHeaderText(MCICodeIds.ViewModeHeader.MessageID, self.message.messageId);
setHeaderText(MCICodeIds.ViewModeHeader.ReplyToMsgID, self.message.replyToMessageId);
this.initHeaderGeneric = function() {
self.setHeaderText(MCICodeIds.ViewModeHeader.AreaName, getMessageAreaByName(self.messageAreaName).desc);
};
this.initHeaderViewMode = function() {
assert(_.isObject(self.message));
self.initHeaderGeneric();
self.setHeaderText(MCICodeIds.ViewModeHeader.From, self.message.fromUserName);
self.setHeaderText(MCICodeIds.ViewModeHeader.To, self.message.toUserName);
self.setHeaderText(MCICodeIds.ViewModeHeader.Subject, self.message.subject);
self.setHeaderText(MCICodeIds.ViewModeHeader.DateTime, moment(self.message.modTimestamp).format(self.client.currentTheme.helpers.getDateTimeFormat()));
self.setHeaderText(MCICodeIds.ViewModeHeader.MsgNum, (self.messageIndex + 1).toString());
self.setHeaderText(MCICodeIds.ViewModeHeader.MsgTotal, self.messageTotal.toString());
self.setHeaderText(MCICodeIds.ViewModeHeader.ViewCount, self.message.viewCount);
self.setHeaderText(MCICodeIds.ViewModeHeader.HashTags, 'TODO hash tags');
self.setHeaderText(MCICodeIds.ViewModeHeader.MessageID, self.message.messageId);
self.setHeaderText(MCICodeIds.ViewModeHeader.ReplyToMsgID, self.message.replyToMessageId);
};
this.initHeaderNewEditMode = function() {
self.initHeaderGeneric();
};
this.initHeaderReplyEditMode = function() {
assert(_.isObject(self.replyToMessage));
function setHeaderText(id, text) {
var v = self.viewControllers.header.getView(id);
if(v) {
v.setText(text);
}
}
self.initHeaderGeneric();
setHeaderText(MCICodeIds.ReplyEditModeHeader.To, self.replyToMessage.fromUserName);
setHeaderText(MCICodeIds.ReplyEditModeHeader.Subject, 'RE: ' + self.replyToMessage.subject);
self.setHeaderText(MCICodeIds.ReplyEditModeHeader.To, self.replyToMessage.fromUserName);
self.setHeaderText(MCICodeIds.ReplyEditModeHeader.Subject, 'RE: ' + self.replyToMessage.subject);
};

View File

@ -296,6 +296,7 @@ function applyThemeCustomization(options) {
}
if(themeConfig.mci) {
console.log('>>>>>>>>>>>>>>>>>>>>>>> ' + options.name)
Object.keys(themeConfig.mci).forEach(function mciEntry(mci) {
_.defaults(options.mci[mci], themeConfig.mci[mci]);
});

View File

@ -29,7 +29,6 @@ function getMessageAreaByName(areaName) {
areaName = areaName.toLowerCase();
var availAreas = getAvailableMessageAreas();
console.log(availAreas)
var index = _.findIndex(availAreas, function pred(an) {
return an.name == areaName;
});

View File

@ -196,7 +196,6 @@ function getThemeArt(options, cb) {
if(artInfo || Config.defaults.theme === options.themeId) {
callback(null, artInfo);
} else {
console.log('trying default theme')
options.basePath = paths.join(Config.paths.themes, Config.defaults.theme);
art.getArt(options.name, options, function artLoaded(err, artInfo) {
@ -208,17 +207,20 @@ function getThemeArt(options, cb) {
if(artInfo) {
callback(null, artInfo);
} else {
console.log('using general art dir')
options.basePath = Config.paths.art;
art.getArt(options.name, options, function artLoaded(err, artInfo) {
console.log('cannot find art: ' + options.name)
callback(err, artInfo);
});
}
}
],
cb // cb(err, artInfo)
function complete(err, artInfo) {
if(err) {
options.client.log.debug( { error : err }, 'Cannot find art');
}
cb(err, artInfo);
}
);
}

View File

@ -586,18 +586,17 @@
"0" : {
"mci" : {
"TL1" : {
"width" : 27
// "width" : 27
},
"TL2" : {
"width" : 27
// "width" : 27
},
"TL3" : {
//"width" : 39,
//"width" : 27,
//"textOverflow" : "..."
},
"TL5" : {
"width" : 27
// "width" : 27
},
"MA5" : {
"width" : 27,
@ -743,29 +742,29 @@
mci: {
// :TODO: use appropriate system properties for these lenghts
TL1: {
width: 27
//width: 27
argName: from
}
ET2: {
width: 27
//width: 27
argName: to
focus: true
}
ET3: {
width: 27
//width: 27
argName: subject
maxLength: 72
submit: true
textOverflow: ...
//textOverflow: ...
}
TL4: {
// :TODO: this is for RE: line (NYI)
width: 27
textOverflow: ...
//width: 27
//textOverflow: ...
}
MA5: {
width: 27
textOverflow: ...
//width: 27
//textOverflow: ...
}
}
submit: {
@ -900,24 +899,24 @@
"0" : {
mci: {
TL1: {
width: 27
//width: 27
argName: from
}
ET2: {
width: 27
//width: 27
argName: to
focus: true
text: All
}
"ET3" : {
"width" : 27,
//"width" : 27,
"argName" : "subject",
"maxLength" : 72,
"submit" : true
},
"MA5" : {
"width" : 27,
"textOverflow" : "..."
//"width" : 27,
//"textOverflow" : "..."
}
},
"submit" : {

Binary file not shown.

View File

@ -68,6 +68,39 @@
dateTimeFormat: MMM Do H:mm a
}
}
messageAreaViewPost: {
0: {
mci: {
TL1: { width: 19, textOverflow: "..." }
TL2: { width: 19, textOverflow: "..." }
TL3: { width: 19, textOverflow: "..." }
TL5: { width: 19, textOverflow: "..." }
}
}
}
messageAreaNewPost: {
0: {
mci: {
TL1: { width: 19, textOverflow: "..." }
ET2: { width: 19, textOverflow: "..." }
ET3: { width: 19, textOverflow: "..." }
//TL4: { width: 25 }
}
}
}
messageAreaReplyPost: {
0: {
mci: {
TL1: { width: 19, textOverflow: "..." }
ET2: { width: 19, textOverflow: "..." }
ET3: { width: 19, textOverflow: "..." }
TL4: { width: 25, textOverflow: "..." }
}
}
}
}
}
}