Implement searching and display buffers with unread lines only

This commit is contained in:
Tor Hveem 2013-10-11 14:44:05 +02:00
parent f666c0c9fe
commit f1582b463b
2 changed files with 21 additions and 1 deletions

View file

@ -72,7 +72,20 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
<div class="content" ng-show="connected">
<div id="sidebar">
<ul class="nav nav-pills nav-stacked">
<li class="label" ng-class="{'active': content.active }" ng-repeat="(key, content) in buffers | toArray | orderBy:'content.number':true">
<li class="bufferfilter">
<form role="form">
<input class="form-control" type="text" id="bufferFilter" ng-model="search.$" placeholder="Search">
</form>
<form class="form-inline" role="form">
<div class="checkbox">
<label>
<input type="checkbox" ng-model="onlyUnread">
Unread only
</label>
</div>
</form>
</li>
<li class="label" ng-class="{'active': content.active }" ng-repeat="(key, content) in buffers | toArray | filter:search | filter:hasUnread | orderBy:'content.number':true">
<a href="#" ng-click="setActiveBuffer(content.id)" title="{{ content.fullName }}">
<span class="badge pull-right" ng-class="{'danger': content.notification }" ng-bind="content.unread"></span>
{{ content.shortName }}<span ng-hide="content.shortName">{{ content.fullName }}</span>

View file

@ -481,5 +481,12 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
setTimeout(function() { notification.close() }, timeout);
}
};
$scope.hasUnread = function(buffer) {
if($scope.onlyUnread) {
return (parseInt(buffer.unread) || 0) > 0;
}
return true;
};
}]
);