Merge pull request #83 from lorenzhs/fixordering
Revamp channels sorting and fix ordering of nicks
This commit is contained in:
commit
c7123a26e4
16
index.html
16
index.html
|
@ -210,6 +210,16 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="">
|
||||||
|
<form class="form-inline" role="form">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" ng-model="orderbyserver">
|
||||||
|
Order channels by server
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<a ng-click="disconnect()">
|
<a ng-click="disconnect()">
|
||||||
|
@ -224,11 +234,11 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
|
||||||
<input class="form-control monospace" type="text" id="bufferFilter" ng-model="search" ng-keydown="handleSearchBoxKey($event)" placeholder="Search">
|
<input class="form-control monospace" type="text" id="bufferFilter" ng-model="search" ng-keydown="handleSearchBoxKey($event)" placeholder="Search">
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
<li class="buffer" ng-class="{'active': content.active }" ng-repeat="(key, content) in buffers | toArray | filter:{fullName:search} | filter:hasUnread | orderBy:'content.number':true">
|
<li class="buffer" ng-class="{'active': content.active }" ng-repeat="(key, content) in buffers | toArray | filter:{fullName:search} | filter:hasUnread | orderBy:predicate">
|
||||||
<a href="#" ng-click="setActiveBuffer(content.id)" title="{{ content.fullName }}">
|
<a href="#" ng-click="setActiveBuffer(content.id)" title="{{ content.fullName }}">
|
||||||
<span class="badge pull-right" ng-hide="content.notification" ng-if="content.unread" ng-bind="content.unread"></span>
|
<span class="badge pull-right" ng-hide="content.notification" ng-if="content.unread" ng-bind="content.unread"></span>
|
||||||
<span class="badge pull-right danger" ng-show="content.notification" ng-bind="content.notification"></span>
|
<span class="badge pull-right danger" ng-show="content.notification" ng-bind="content.notification"></span>
|
||||||
{{ content.shortName }}<span ng-hide="content.shortName">{{ content.fullName }}</span>
|
{{ content.indent(predicate) }}{{ content.shortName }}<span ng-hide="content.shortName">{{ content.fullName }}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -236,7 +246,7 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
|
||||||
<div id="bufferlines" class="monospace" ng-class="{'withnicklist': showNicklist}">
|
<div id="bufferlines" class="monospace" ng-class="{'withnicklist': showNicklist}">
|
||||||
<div id="nicklist" ng-show="showNicklist" class="vertical-line-left">
|
<div id="nicklist" ng-show="showNicklist" class="vertical-line-left">
|
||||||
<ul class="nicklistgroup list-unstyled" ng-repeat="group in activeBuffer().nicklist">
|
<ul class="nicklistgroup list-unstyled" ng-repeat="group in activeBuffer().nicklist">
|
||||||
<li class="" ng-repeat="nick in group.nicks|orderBy:'nick.name'">
|
<li class="" ng-repeat="nick in group.nicks|orderBy:name">
|
||||||
<a ng-click="nickAction(nick)"><span ng-class="nick.prefixClasses">{{nick.prefix}}</span><span ng-class="nick.nameClasses">{{nick.name}}</span></a>
|
<a ng-click="nickAction(nick)"><span ng-class="nick.prefixClasses">{{nick.prefix}}</span><span ng-class="nick.nameClasses">{{nick.name}}</span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
14
js/models.js
14
js/models.js
|
@ -24,6 +24,16 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
||||||
var notification = 0
|
var notification = 0
|
||||||
var unread = 0
|
var unread = 0
|
||||||
var lastSeen = -2
|
var lastSeen = -2
|
||||||
|
var serverSortKey = fullName.replace(/^irc.server.(\w+)/, "irc.$1");
|
||||||
|
|
||||||
|
var indent = function(predicate) {
|
||||||
|
if( predicate == "serverSortKey" && fullName.match(/^irc./) && !fullName.match(/^irc.server./) ) {
|
||||||
|
// indent channel
|
||||||
|
return " "; // four protected spaces
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Buffer opened message does not include notify level
|
// Buffer opened message does not include notify level
|
||||||
if( message['notify'] != undefined ) {
|
if( message['notify'] != undefined ) {
|
||||||
|
@ -115,7 +125,9 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
||||||
addNick: addNick,
|
addNick: addNick,
|
||||||
delNick: delNick,
|
delNick: delNick,
|
||||||
updateNick: updateNick,
|
updateNick: updateNick,
|
||||||
flatNicklist: flatNicklist
|
flatNicklist: flatNicklist,
|
||||||
|
serverSortKey: serverSortKey,
|
||||||
|
indent: indent
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -516,12 +516,20 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
$store.bind($scope, "nonicklist", false);
|
$store.bind($scope, "nonicklist", false);
|
||||||
// Save setting for displaying embeds
|
// Save setting for displaying embeds
|
||||||
$store.bind($scope, "noembed", false);
|
$store.bind($scope, "noembed", false);
|
||||||
|
// Save setting for channel ordering
|
||||||
|
$store.bind($scope, "orderbyserver", false);
|
||||||
// Save setting for displaying embeds in rootscope so it can be used from service
|
// Save setting for displaying embeds in rootscope so it can be used from service
|
||||||
$rootScope.visible = $scope.noembed == false;
|
$rootScope.visible = $scope.noembed == false;
|
||||||
// Watch model and update show setting when it changes
|
// Watch model and update show setting when it changes
|
||||||
$scope.$watch('noembed', function() {
|
$scope.$watch('noembed', function() {
|
||||||
$rootScope.visible = $scope.noembed == false;
|
$rootScope.visible = $scope.noembed == false;
|
||||||
});
|
});
|
||||||
|
// Watch model and update channel sorting when it changes
|
||||||
|
$scope.$watch('orderbyserver', function() {
|
||||||
|
$rootScope.predicate = $scope.orderbyserver ? 'serverSortKey' : 'number';
|
||||||
|
});
|
||||||
|
|
||||||
|
$rootScope.predicate = $scope.orderbyserver ? 'serverSortKey' : 'number';
|
||||||
|
|
||||||
$scope.setActiveBuffer = function(key) {
|
$scope.setActiveBuffer = function(key) {
|
||||||
models.setActiveBuffer(key);
|
models.setActiveBuffer(key);
|
||||||
|
|
Loading…
Reference in New Issue