Channels user counter
authorCory Chaplin <cory.chaplin@laposte.net>
Tue, 20 May 2014 11:23:02 +0000 (13:23 +0200)
committerCory Chaplin <cory.chaplin@laposte.net>
Tue, 20 May 2014 11:23:02 +0000 (13:23 +0200)
client/assets/themes/basic/style.css
client/assets/themes/cli/style.css
client/assets/themes/relaxed/style.css
client/src/index.html.tmpl
client/src/views/memberlist.js

index dd5565b6909b95127e00659f97a2ebec926c5688..1147b5a5fe99944a7a368520778459ce69202fa7 100644 (file)
     transition: color 0.3s;
     color: #88C56A;
 }
+#kiwi .membercount {
+    font-size: 0.9em;
+    margin-bottom: 10px;
+    padding: 0 0 5%;
+    text-align: center;
+}
+#kiwi .membercount span {
+    display: none;
+}
+#kiwi .membercount span.active {
+    display: block;
+}
 
 #kiwi .messages {  }
 #kiwi .messages.active { }
index e86ea47e51ed09aca6239ffb2bdc58558d822aba..cf0d810f284b3cb102dd9f1ffac19f9223f915d1 100644 (file)
     transition: color 0.3s;
     color: #88C56A;
 }
+#kiwi .membercount {
+    border-bottom: 1px solid #8A8A8A;
+    font-size: 0.9em;
+    margin-bottom: 10px;
+    padding: 0 0 5%;
+    text-align: center;
+}
+#kiwi .membercount span {
+    display: none;
+}
+#kiwi .membercount span.active {
+    display: block;
+}
 
 #kiwi .messages .msg > div { color:#6d6d6d; font-family: Inconsolata, Consolas, 'courier new', monospace; }
 #kiwi .messages .msg { border: none; padding: 2px 5px; }
index 56d7b8d4ee605ac1fb6cb8ee248d81f1933ecff1..44a09d06ed41f81a6b61d65fe0d573f0ebb44f0c 100644 (file)
     transition: color 0.3s;
     color: #88C56A;
 }
+#kiwi .membercount {
+    border-bottom: 1px solid #8A8A8A;
+    font-size: 0.9em;
+    margin-bottom: 10px;
+    padding: 0 0 5%;
+    text-align: center;
+}
+#kiwi .membercount span {
+    display: none;
+}
+#kiwi .membercount span.active {
+    display: block;
+}
 
 #kiwi .messages { color: #333333; }
 #kiwi .messages.active { }
index 66eb8354b70296eb7c5b2d5f8cde69b3d2321f17..a6bb62b7894df0d6466b2c520452691e1a1c208f 100644 (file)
@@ -51,6 +51,7 @@
                         <i class="icon-signout channel_part" title="Leave Channel"></i>\r
                         <i class="icon-double-angle-right right-bar-toggle-inner" title="Hide"></i>\r
                     </div>\r
+                    <div class="membercount"></div>\r
                     <div class="memberlists"></div>\r
                 </div>\r
             </div>\r
index 085148a657dd60925be762049135009a9c520c66..a8028ed963b4718815436701456f90688fa8050b 100644 (file)
@@ -12,10 +12,20 @@ _kiwi.view.MemberList = Backbone.View.extend({
     render: function () {
         var $this = this.$el;
         $this.empty();
+        
         this.model.forEach(function (member) {
             member.view.$el.data('member', member);
             $this.append(member.view.$el);
         });
+        
+        // User count
+        if(this.model.channel.cid === _kiwi.app.panels().active.cid) {
+            var members_count = this.model.length + ' ' + translateText('client_applets_chanlist_users');
+
+            $('#kiwi .membercount > span.' + this.model.channel.cid).text(members_count);
+            $('#kiwi .membercount > span.' + this.model.channel.cid).addClass('active');
+        }
+
         return this;
     },
     nickClick: function (event) {
@@ -74,5 +84,18 @@ _kiwi.view.MemberList = Backbone.View.extend({
     show: function () {
         $('#kiwi .memberlists').children().removeClass('active');
         $(this.el).addClass('active');
+
+        // User count
+        var members_count = this.model.length + ' ' + translateText('client_applets_chanlist_users');
+        var members_count_code = '<span class="' + this.model.channel.cid + '">';
+
+        $('#kiwi .membercount').children().removeClass('active');
+        // If the span for this panel doesn't exist, create it
+        if($('#kiwi .membercount > span.' + this.model.channel.cid).length == 0){
+            $(members_count_code).appendTo('#kiwi .membercount');
+        }
+
+        $('#kiwi .membercount > span.' + this.model.channel.cid).text(members_count);
+        $('#kiwi .membercount > span.' + this.model.channel.cid).addClass('active');
     }
 });
\ No newline at end of file