* 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 theme = require('../core/theme.js');
var MultiLineEditTextView = require('../core/multi_line_edit_text_view.js').MultiLineEditTextView; var MultiLineEditTextView = require('../core/multi_line_edit_text_view.js').MultiLineEditTextView;
var Message = require('../core/message.js'); var Message = require('../core/message.js');
var getMessageAreaByName = require('../core/message_area.js').getMessageAreaByName;
var async = require('async'); var async = require('async');
var assert = require('assert'); var assert = require('assert');
@ -108,7 +109,6 @@ function FullScreenEditorModule(options) {
if(_.isObject(options.extraArgs)) { if(_.isObject(options.extraArgs)) {
//console.log(options.extraArgs) //console.log(options.extraArgs)
this.messageAreaName = options.extraArgs.messageAreaName || Message.WellKnownAreaNames.Private; this.messageAreaName = options.extraArgs.messageAreaName || Message.WellKnownAreaNames.Private;
console.log(this.messageAreaName)
this.messageIndex = options.extraArgs.messageIndex || 0; this.messageIndex = options.extraArgs.messageIndex || 0;
this.messageTotal = options.extraArgs.messageTotal || 0; this.messageTotal = options.extraArgs.messageTotal || 0;
} }
@ -494,6 +494,8 @@ function FullScreenEditorModule(options) {
if(self.replyToMessage) { if(self.replyToMessage) {
self.initHeaderReplyEditMode(); self.initHeaderReplyEditMode();
} else {
self.initHeaderNewEditMode();
} }
break; break;
} }
@ -568,41 +570,45 @@ function FullScreenEditorModule(options) {
} }
}; };
this.setHeaderText = function(id, text) {
var v = self.viewControllers.header.getView(id);
if(v) {
v.setText(text);
}
};
this.initHeaderGeneric = function() {
self.setHeaderText(MCICodeIds.ViewModeHeader.AreaName, getMessageAreaByName(self.messageAreaName).desc);
};
this.initHeaderViewMode = function() { this.initHeaderViewMode = function() {
assert(_.isObject(self.message)); assert(_.isObject(self.message));
function setHeaderText(id, text) { self.initHeaderGeneric();
var v = self.viewControllers.header.getView(id);
if(v) { self.setHeaderText(MCICodeIds.ViewModeHeader.From, self.message.fromUserName);
v.setText(text); 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);
};
setHeaderText(MCICodeIds.ViewModeHeader.From, self.message.fromUserName); this.initHeaderNewEditMode = function() {
setHeaderText(MCICodeIds.ViewModeHeader.To, self.message.toUserName); self.initHeaderGeneric();
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.initHeaderReplyEditMode = function() { this.initHeaderReplyEditMode = function() {
assert(_.isObject(self.replyToMessage)); assert(_.isObject(self.replyToMessage));
function setHeaderText(id, text) { self.initHeaderGeneric();
var v = self.viewControllers.header.getView(id);
if(v) {
v.setText(text);
}
}
setHeaderText(MCICodeIds.ReplyEditModeHeader.To, self.replyToMessage.fromUserName); self.setHeaderText(MCICodeIds.ReplyEditModeHeader.To, self.replyToMessage.fromUserName);
setHeaderText(MCICodeIds.ReplyEditModeHeader.Subject, 'RE: ' + self.replyToMessage.subject); self.setHeaderText(MCICodeIds.ReplyEditModeHeader.Subject, 'RE: ' + self.replyToMessage.subject);
}; };

View File

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

View File

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

View File

@ -196,7 +196,6 @@ function getThemeArt(options, cb) {
if(artInfo || Config.defaults.theme === options.themeId) { if(artInfo || Config.defaults.theme === options.themeId) {
callback(null, artInfo); callback(null, artInfo);
} else { } else {
console.log('trying default theme')
options.basePath = paths.join(Config.paths.themes, Config.defaults.theme); options.basePath = paths.join(Config.paths.themes, Config.defaults.theme);
art.getArt(options.name, options, function artLoaded(err, artInfo) { art.getArt(options.name, options, function artLoaded(err, artInfo) {
@ -208,17 +207,20 @@ function getThemeArt(options, cb) {
if(artInfo) { if(artInfo) {
callback(null, artInfo); callback(null, artInfo);
} else { } else {
console.log('using general art dir')
options.basePath = Config.paths.art; options.basePath = Config.paths.art;
art.getArt(options.name, options, function artLoaded(err, artInfo) { art.getArt(options.name, options, function artLoaded(err, artInfo) {
console.log('cannot find art: ' + options.name)
callback(err, artInfo); 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" : { "0" : {
"mci" : { "mci" : {
"TL1" : { "TL1" : {
"width" : 27 // "width" : 27
}, },
"TL2" : { "TL2" : {
"width" : 27 // "width" : 27
}, },
"TL3" : { "TL3" : {
//"width" : 39,
//"width" : 27, //"width" : 27,
//"textOverflow" : "..." //"textOverflow" : "..."
}, },
"TL5" : { "TL5" : {
"width" : 27 // "width" : 27
}, },
"MA5" : { "MA5" : {
"width" : 27, "width" : 27,
@ -743,29 +742,29 @@
mci: { mci: {
// :TODO: use appropriate system properties for these lenghts // :TODO: use appropriate system properties for these lenghts
TL1: { TL1: {
width: 27 //width: 27
argName: from argName: from
} }
ET2: { ET2: {
width: 27 //width: 27
argName: to argName: to
focus: true focus: true
} }
ET3: { ET3: {
width: 27 //width: 27
argName: subject argName: subject
maxLength: 72 maxLength: 72
submit: true submit: true
textOverflow: ... //textOverflow: ...
} }
TL4: { TL4: {
// :TODO: this is for RE: line (NYI) // :TODO: this is for RE: line (NYI)
width: 27 //width: 27
textOverflow: ... //textOverflow: ...
} }
MA5: { MA5: {
width: 27 //width: 27
textOverflow: ... //textOverflow: ...
} }
} }
submit: { submit: {
@ -900,24 +899,24 @@
"0" : { "0" : {
mci: { mci: {
TL1: { TL1: {
width: 27 //width: 27
argName: from argName: from
} }
ET2: { ET2: {
width: 27 //width: 27
argName: to argName: to
focus: true focus: true
text: All text: All
} }
"ET3" : { "ET3" : {
"width" : 27, //"width" : 27,
"argName" : "subject", "argName" : "subject",
"maxLength" : 72, "maxLength" : 72,
"submit" : true "submit" : true
}, },
"MA5" : { "MA5" : {
"width" : 27, //"width" : 27,
"textOverflow" : "..." //"textOverflow" : "..."
} }
}, },
"submit" : { "submit" : {

Binary file not shown.

View File

@ -68,6 +68,39 @@
dateTimeFormat: MMM Do H:mm a 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: "..." }
}
}
}
} }
} }
} }