Align nicks on the right. Fixes #19.

This commit is contained in:
David Cormier 2013-10-11 20:37:11 -04:00
parent f8bb1f4b78
commit 8057c0639c
3 changed files with 65 additions and 25 deletions

View file

@ -24,6 +24,16 @@ input#sendMessage {
width: 100%; width: 100%;
} }
td#time {
padding-right: 5px;
}
td#nickname {
text-align: right;
vertical-align: middle;
padding-right: 5px;
}
/* Lastly, apply responsive CSS fixes as necessary */ /* Lastly, apply responsive CSS fixes as necessary */
@media (max-width: 767px) { @media (max-width: 767px) {
#footer { #footer {
@ -59,13 +69,17 @@ input#sendMessage {
height: 100%; height: 100%;
min-height: 100%; min-height: 100%;
} }
span.text {
white-space: nowrap;
}
.bufferlines { .bufferlines {
font-family: monospace; font-family: monospace;
overflow-y: auto; overflow-y: auto;
margin-left: 14%; margin-left: 14%;
width: auto; width: auto;
position: relative; position: relative;
padding-bottom: 60px; padding-bottom: 55px;
} }
.text { .text {
word-wrap: break-word; word-wrap: break-word;

View file

@ -107,25 +107,36 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
</ul> </ul>
</div> </div>
<div class="bufferlines"> <div class="bufferlines">
<div class="bufferline" ng-repeat="bufferline in activeBuffer().lines"> <table>
<span class="date text-muted"> <tbody>
{{ bufferline.date | date:'HH:mm' }} <tr class="bufferline" ng-repeat="bufferline in activeBuffer().lines">
</span> <td id="time">
<span class="date text-muted">
{{ bufferline.date | date:'HH:mm' }}
</span>
</td>
<td id="nickname">
<span ng-repeat="part in bufferline.prefix" class="text" style="{{ part.fg }}">{{ part.text }}</span>
</td>
<td id="content">
<span ng-repeat="part in bufferline.content" class="text" style="{{ part.fg }}">{{ part.text }} </span>
<span ng-repeat="part in bufferline.content" class="text" style="{{ part.fg }}">{{ part.text }} </span> <div ng-repeat="metadata in bufferline.metadata">
<div ng-show="metadata.visible">
<a ng-click="metadata.visible = false">Hide additional content</a>
<div ng-bind-html="metadata.content"></div>
<div ng-repeat="metadata in bufferline.metadata"> </div>
<div ng-show="metadata.visible"> <div ng-hide="metadata.visible">
<a ng-click="metadata.visible = false">Hide additional content</a> <a ng-click="metadata.visible = true">Show additional content</a>
<div ng-bind-html="metadata.content"></div> </div>
</div>
</div> </td>
<div ng-hide="metadata.visible"> </tr>
<a ng-click="metadata.visible = true">Show additional content</a> </tbody>
</div> </table>
</div>
</div>
</div> </div>
<div class="push"></div>
</div> </div>
<div id="footer" ng-show="connected"> <div id="footer" ng-show="connected">
<div class="navbar navbar-inverse navbar-fixed-bottom"> <div class="navbar navbar-inverse navbar-fixed-bottom">

View file

@ -47,17 +47,25 @@ models.service('models', ['colors', function(colors) {
*/ */
this.BufferLine = function(message) { this.BufferLine = function(message) {
function formatTextElement(textElement) {
textElement = colors.parse(textElement);
if (textElement && ('fg' in textElement)) {
textElement['fg'] = colors.prepareCss(textElement['fg']);
}
return textElement;
}
/* /*
* Parse the text elements from the buffer line added * Parse the text elements from the buffer line added
* *
* @param message weechat message * @param message weechat message
*/ */
function parseLineAddedTextElements(message) { function parseLineAddedTextElements(message) {
var prefix = colors.parse(message['prefix']); var text = colors.parse(message['message']);
text_elements =_.map(text, function(text_element) {
var buffer = message['buffer'];
text_elements = _.union(prefix, text);
text_elements =_.map(text_elements, function(text_element) {
if (text_element && ('fg' in text_element)) { if (text_element && ('fg' in text_element)) {
text_element['fg'] = colors.prepareCss(text_element['fg']); text_element['fg'] = colors.prepareCss(text_element['fg']);
} }
@ -71,17 +79,24 @@ models.service('models', ['colors', function(colors) {
var buffer = message['buffer']; var buffer = message['buffer'];
var date = message['date']; var date = message['date'];
var text = colors.parse(message['message']);
var prefix = formatTextElement(message['prefix']);
console.log(message['prefix'])
console.log(prefix);
var tags_array = message['tags_array']; var tags_array = message['tags_array'];
var displayed = message['displayed']; var displayed = message['displayed'];
var highlight = message['highlight']; var highlight = message['highlight'];
var content = parseLineAddedTextElements(message); var content = parseLineAddedTextElements(message);
var rtext = ""; var rtext = "";
if(text[0] != undefined) { if(content[0] != undefined) {
rtext = text[0]['text']; rtext = content[0]['text'];
} }
return { return {
prefix: prefix,
content: content, content: content,
date: date, date: date,
buffer: buffer, buffer: buffer,