1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-22 17:22:22 -05:00

Add styling for /me messages

This commit is contained in:
Lance Stout 2013-12-16 14:28:13 -08:00
parent 2d07337967
commit 877d35ecb4
8 changed files with 61 additions and 11 deletions

View File

@ -91,9 +91,13 @@ module.exports = HumanModel.define({
} }
}, },
processedBody: { processedBody: {
deps: ['body'], deps: ['body', 'meAction'],
fn: function () { fn: function () {
return htmlify.toHTML(this.body); var body = this.body;
if (this.meAction) {
body = body.substr(4);
}
return htmlify.toHTML(body);
} }
}, },
partialTemplateHtml: { partialTemplateHtml: {
@ -125,9 +129,16 @@ module.exports = HumanModel.define({
if (this.pending) res.push('pending'); if (this.pending) res.push('pending');
if (this.delayed) res.push('delayed'); if (this.delayed) res.push('delayed');
if (this.edited) res.push('edited'); if (this.edited) res.push('edited');
if (this.meAction) res.push('meAction');
return res.join(' '); return res.join(' ');
} }
},
meAction: {
deps: ['body'],
fn: function () {
return this.body.indexOf('/me') === 0;
}
} }
}, },
session: { session: {

View File

@ -30,7 +30,7 @@ module.exports = HumanModel.define({
deps: ['discoInfo'], deps: ['discoInfo'],
fn: function () { fn: function () {
if (!this.discoInfo) return false; if (!this.discoInfo) return false;
var features = this.discoInfo.features; var features = this.discoInfo.features || [];
if (features.indexOf('urn:xmpp:jingle:1') === -1) { if (features.indexOf('urn:xmpp:jingle:1') === -1) {
return false; return false;
} }

View File

@ -20,6 +20,7 @@ module.exports = BasePage.extend(chatHelpers).extend({
this.listenTo(this, 'pageunloaded', this.handlePageUnloaded); this.listenTo(this, 'pageunloaded', this.handlePageUnloaded);
this.listenTo(this.model.messages, 'change:body', this.refreshModel); this.listenTo(this.model.messages, 'change:body', this.refreshModel);
this.listenTo(this.model.messages, 'change:meAction', this.refreshModel);
this.listenTo(this.model.messages, 'change:edited', this.refreshModel); this.listenTo(this.model.messages, 'change:edited', this.refreshModel);
this.listenTo(this.model.messages, 'change:pending', this.refreshModel); this.listenTo(this.model.messages, 'change:pending', this.refreshModel);

View File

@ -16,7 +16,8 @@ module.exports = HumanView.extend({
receiptReceived: '.message', receiptReceived: '.message',
pending: '.message', pending: '.message',
delayed: '.message', delayed: '.message',
edited: '.message' edited: '.message',
meAction: '.message'
}, },
textBindings: { textBindings: {
body: '.body', body: '.body',

View File

@ -13,9 +13,10 @@ module.exports = HumanView.extend({
}, },
classBindings: { classBindings: {
mine: '.message', mine: '.message',
acked: '.message', pending: '.message',
delayed: '.message', delayed: '.message',
edited: '.message' edited: '.message',
meAction: '.message'
}, },
textBindings: { textBindings: {
body: '.body', body: '.body',

View File

@ -1064,7 +1064,7 @@ button.secondary:hover:not(:disabled) {
} }
.messages .message { .messages .message {
font-size: 12px; font-size: 12px;
margin: 0px; margin: 2px;
display: inline-block; display: inline-block;
padding-right: 11px; padding-right: 11px;
min-width: 20px; min-width: 20px;
@ -1074,7 +1074,7 @@ button.secondary:hover:not(:disabled) {
box-sizing: border-box; box-sizing: border-box;
} }
.messages .message:not(.mine) { .messages .message:not(.mine) {
color: #12acef; color: #2d2d2d;
} }
.messages .message.mine { .messages .message.mine {
background: #fff; background: #fff;
@ -1091,6 +1091,24 @@ button.secondary:hover:not(:disabled) {
.messages .message.pending { .messages .message.pending {
color: #ababab; color: #ababab;
} }
.messages .message.meAction {
font-style: italic;
color: #ec008c;
background-color: #fce8f1;
padding: 2px;
padding-left: 8px;
border-radius: 2px;
}
.messages .message.meAction:before {
content: '\2022 ';
font-style: normal;
}
.messages .message.meAction .timestamp {
position: relative;
left: -10px;
font-style: normal;
color: #f8bee0;
}
.messages .message .body { .messages .message .body {
display: inline; display: inline;
word-break: break-word; word-break: break-word;

View File

@ -172,7 +172,7 @@
.message .message
font-size: $font-size-small font-size: $font-size-small
margin: 0px margin: 2px
display: inline-block display: inline-block
padding-right: 11px padding-right: 11px
min-width: 20px min-width: 20px
@ -180,7 +180,7 @@
borderbox() borderbox()
&:not(.mine) &:not(.mine)
color: $blue color: $gray-dark
&.mine &.mine
background: white background: white
@ -199,6 +199,24 @@
&.pending &.pending
color: lighten($gray, 50%) color: lighten($gray, 50%)
&.meAction
font-style: italic
color: $pink
background-color: $pink-lighter
padding: 2px
padding-left: 8px
border-radius: 2px
&:before
content: '\2022 '
font-style: normal
.timestamp
position: relative
left: -10px
font-style: normal
color: $pink-light
.body .body
display: inline display: inline
word-break: break-word word-break: break-word

View File

@ -1,5 +1,5 @@
CACHE MANIFEST CACHE MANIFEST
# 0.0.1 1387217113439 # 0.0.1 1387232708806
CACHE: CACHE:
/app.js /app.js