Fix non-#channels and single-symbol channels (#)

This commit is contained in:
Lorenz Hübschle-Schneider 2014-11-20 12:57:19 +01:00
parent ec21b21e38
commit 9b7a778186
4 changed files with 20 additions and 4 deletions

View file

@ -477,10 +477,21 @@ h2 span, h2 small {
/* bold hash before channels */
li.buffer.channel a span:last-of-type:before {
color: #888;
content: "#";
font-weight: bold;
}
li.buffer.channel_hash a span:last-of-type:before {
content: '#';
}
li.buffer.channel_plus a span:last-of-type:before {
content: '+';
}
li.buffer.channel_ampersand a span:last-of-type:before {
content: '&';
}
li.buffer.channel.active a span:last-of-type:before {
color: #444;
}

View file

@ -234,7 +234,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
<input class="form-control favorite-font" type="text" id="bufferFilter" ng-model="search" ng-keydown="handleSearchBoxKey($event)" placeholder="Search">
</form>
</li>
<li class="buffer" ng-class="{'active': buffer.active, 'indent': buffer.indent, 'channel': buffer.type === 'channel', 'private': buffer.type === 'private'}" ng-repeat="(key, buffer) in (filteredBuffers = (getBuffers() | toArray:'withidx' | filter:{fullName:search} | filter:hasUnread | orderBy:predicate | getBufferQuickKeys:this))">
<li class="buffer" ng-class="{'active': buffer.active, 'indent': buffer.indent, 'channel': buffer.type === 'channel', 'channel_hash': buffer.prefix === '#', 'channel_plus': buffer.prefix === '+', 'channel_ampersand': buffer.prefix === '&', 'private': buffer.type === 'private'}" ng-repeat="(key, buffer) in (filteredBuffers = (getBuffers() | toArray:'withidx' | filter:{fullName:search} | filter:hasUnread | orderBy:predicate | getBufferQuickKeys:this))">
<a href="#" ng-click="setActiveBuffer(buffer.id)" title="{{ buffer.fullName }}">
<span class="badge pull-right" ng-class="{'danger': buffer.notification}" ng-if="buffer.notification || buffer.unread" ng-bind="buffer.notification || buffer.unread"></span>
<span class="buffer-quick-key">{{ buffer.$quickKey }}</span>

View file

@ -74,7 +74,8 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
var old = models.getBuffer(buffer);
old.fullName = obj.full_name;
old.shortName = obj.short_name;
old.trimmedName = obj.short_name.replace(/^[#&+]/, '');
old.trimmedName = obj.short_name.replace(/^[#&+]/, '') || ' ';
old.prefix = ['#', '&', '+'].indexOf(obj.short_name.charAt(0)) >= 0 ? obj.short_name.charAt(0) : '';
};
var handleBufferLocalvarChanged = function(message) {

View file

@ -15,7 +15,10 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
// weechat properties
var fullName = message.full_name;
var shortName = message.short_name;
var trimmedName = shortName.replace(/^[#&+]/, '');
// just use a space if the rest of the channel name is empty ('#')
var trimmedName = shortName.replace(/^[#&+]/, '') || ' ';
// get channel identifier
var prefix = ['#', '&', '+'].indexOf(shortName.charAt(0)) >= 0 ? shortName.charAt(0) : '';
var title = message.title;
var number = message.number;
var pointer = message.pointers[0];
@ -226,6 +229,7 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
fullName: fullName,
shortName: shortName,
trimmedName: trimmedName,
prefix: prefix,
number: number,
title: title,
lines: lines,