From c4d29a7eb0869014fc31186ffb3438e62790a41b Mon Sep 17 00:00:00 2001 From: Lorenz H-S Date: Sun, 8 Dec 2013 20:42:30 +0000 Subject: [PATCH 1/2] Fix ordering of channels As channels aren't added right away (but as soon as the info was received from the server), somehow the orderBy didn't do its job. --- index.html | 4 ++-- js/websockets.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 45f9406..cb8179b 100644 --- a/index.html +++ b/index.html @@ -224,7 +224,7 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel -
  • +
  • @@ -236,7 +236,7 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
    diff --git a/js/websockets.js b/js/websockets.js index 6c8182a..793c73a 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -315,6 +315,7 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', models.setActiveBuffer(buffer.id); } } + $rootScope.predicate = 'number'; }); From 78121ff3a65bb1ab24be9e45e58f452f665c6fed Mon Sep 17 00:00:00 2001 From: Lorenz H-S Date: Sun, 8 Dec 2013 21:29:48 +0000 Subject: [PATCH 2/2] Add possibility to order channels hierarchically by server --- index.html | 12 +++++++++++- js/models.js | 14 +++++++++++++- js/websockets.js | 9 ++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index cb8179b..e9e792a 100644 --- a/index.html +++ b/index.html @@ -210,6 +210,16 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
  • +
  • +
    +
    + +
    +
    +
  • @@ -228,7 +238,7 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel - {{ content.shortName }}{{ content.fullName }} + {{ content.indent(predicate) }}{{ content.shortName }}{{ content.fullName }} diff --git a/js/models.js b/js/models.js index bb9a41b..bd5d0e3 100644 --- a/js/models.js +++ b/js/models.js @@ -24,6 +24,16 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) var notification = 0 var unread = 0 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 if( message['notify'] != undefined ) { @@ -115,7 +125,9 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) addNick: addNick, delNick: delNick, updateNick: updateNick, - flatNicklist: flatNicklist + flatNicklist: flatNicklist, + serverSortKey: serverSortKey, + indent: indent } } diff --git a/js/websockets.js b/js/websockets.js index 793c73a..435021e 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -315,7 +315,6 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', models.setActiveBuffer(buffer.id); } } - $rootScope.predicate = 'number'; }); @@ -517,12 +516,20 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $store.bind($scope, "nonicklist", false); // Save setting for displaying embeds $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 $rootScope.visible = $scope.noembed == false; // Watch model and update show setting when it changes $scope.$watch('noembed', function() { $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) { models.setActiveBuffer(key);