Skip to content
Snippets Groups Projects
Commit 67986443 authored by Domenic Horner's avatar Domenic Horner Committed by Rodrigo Nascimento
Browse files

Update side-nav with room counts (#3967)

* update side-nav with room counts

* removed unused styles
parent 03f3db25
No related branches found
No related tags found
No related merge requests found
Showing
with 28 additions and 17 deletions
......@@ -16,6 +16,9 @@ Template.channels.helpers
return ChatSubscription.find query, { sort: 't': 1, 'name': 1 }
canCreate: ->
return RocketChat.authz.hasAtLeastOnePermission ['create-c']
Template.channels.events
'click .add-room': (e, instance) ->
if RocketChat.authz.hasAtLeastOnePermission('create-c')
......
<template name="channels">
<h3 class="add-room {{isActive}}">
{{_ "Channels"}}
{{#if hasPermission 'create-c'}}
{{_ "Channels"}} <span class="room-count-small">({{rooms.count}})</span>
{{#if canCreate}}
<i class="icon-plus" aria-label="{{_ "Create channel"}}" role="button"></i>
{{/if}}
</h3>
......
<template name="combined">
<h3 class="add-room {{isActive}}">
{{_ "Channels"}}
{{_ "Channels"}} <span class="room-count-small">({{rooms.count}})</span>
{{#if canCreate}}
<i class="icon-plus" aria-label="{{_ "Create channel"}}" role="button"></i>
{{/if}}
......
Template.directMessages.helpers
isActive: ->
return 'active' if ChatSubscription.findOne({ t: { $in: ['d']}, f: { $ne: true }, open: true, rid: Session.get('openedRoom') }, { fields: { _id: 1 } })?
rooms: ->
query = { t: { $in: ['d']}, f: { $ne: true }, open: true }
......@@ -7,8 +10,9 @@ Template.directMessages.helpers
$ne: true
return ChatSubscription.find query, { sort: 't': 1, 'name': 1 }
isActive: ->
return 'active' if ChatSubscription.findOne({ t: { $in: ['d']}, f: { $ne: true }, open: true, rid: Session.get('openedRoom') }, { fields: { _id: 1 } })?
canCreate: ->
return RocketChat.authz.hasAtLeastOnePermission ['create-d']
Template.directMessages.events
'click .add-room': (e, instance) ->
......
<template name="directMessages">
<h3 class="add-room {{isActive}}">
{{_ "Direct_Messages"}}
{{#if hasPermission 'create-d'}}
{{_ "Direct_Messages"}} <span class="room-count-small">({{rooms.count}})</span>
{{#if canCreate}}
<i class="icon-plus"></i>
{{/if}}
</h3>
......
Template.privateGroups.helpers
isActive: ->
return 'active' if ChatSubscription.findOne({ t: { $in: ['p']}, f: { $ne: true }, open: true, rid: Session.get('openedRoom') }, { fields: { _id: 1 } })?
rooms: ->
query = { t: { $in: ['p']}, f: { $ne: true }, open: true }
......@@ -13,10 +16,10 @@ Template.privateGroups.helpers
totalOpen: ->
return ChatSubscription.find({ t: { $in: ['p']}, f: { $ne: true }, open: true }).count()
isActive: ->
return 'active' if ChatSubscription.findOne({ t: { $in: ['p']}, f: { $ne: true }, open: true, rid: Session.get('openedRoom') }, { fields: { _id: 1 } })?
canCreate: ->
return RocketChat.authz.hasAtLeastOnePermission ['create-p']
Template.privateGroups.events
'click .add-room': (e, instance) ->
if RocketChat.authz.hasAtLeastOnePermission('create-p')
......
<template name="privateGroups">
<h3 class="add-room {{isActive}}">
{{_ "Private_Groups"}}
{{#if hasPermission 'create-p'}}
{{_ "Private_Groups"}} <span class="room-count-small">({{rooms.count}})</span>
{{#if canCreate}}
<i class="icon-plus"></i>
{{/if}}
</h3>
......
Template.starredRooms.helpers
isActive: ->
return 'active' if ChatSubscription.findOne({ f: true, rid: Session.get('openedRoom') }, { fields: { _id: 1 } })?
rooms: ->
query = { f: true, open: true }
......@@ -9,5 +12,3 @@ Template.starredRooms.helpers
return ChatSubscription.find query, { sort: 't': 1, 'name': 1 }
total: ->
return ChatSubscription.find({ f: true }).count()
isActive: ->
return 'active' if ChatSubscription.findOne({ f: true, rid: Session.get('openedRoom') }, { fields: { _id: 1 } })?
<template name="starredRooms">
{{#if total}}
<h3 class="{{isActive}}"><i class="icon-star"></i>{{_ "Favorites"}}</h3>
<h3 class="{{isActive}}"><i class="icon-star"></i>{{_ "Favorites"}} <span class="room-count-small">({{rooms.count}})</span></h3>
<ul>
{{#each rooms}}
{{> chatRoomItem }}
......
<template name="unreadRooms">
<div class="unread-rooms-mode {{hasUnread}}">
<h3>
{{_ "Unread_Rooms"}}
{{_ "Unread_Rooms"}} <span class="room-count-small">({{rooms.count}})</span>
</h3>
<ul>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment