Skip to content
Snippets Groups Projects
Commit ceb25677 authored by Diego Sampaio's avatar Diego Sampaio
Browse files

room icons

parent 5468c93c
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,10 @@ Meteor.startup ->
RocketChat.roomTypes.addType('directMessages', roles);
RocketChat.roomTypes.addType('privateGroups', roles);
RocketChat.roomTypes.setIcon('c', 'icon-hash');
RocketChat.roomTypes.setIcon('d', 'icon-at');
RocketChat.roomTypes.setIcon('p', 'icon-lock');
RocketChat.roomTypes.setRoute 'c', 'channel', (sub) ->
return { name: sub.name }
......
......@@ -8,9 +8,6 @@ Template.chatRoomItem.helpers
if (FlowRouter.getParam('_id') isnt this.rid or not document.hasFocus()) and this.unread > 0
return this.unread
isDirectRoom: ->
return this.t is 'd'
userStatus: ->
return 'status-' + (Session.get('user_' + this.name + '_status') or 'offline') if this.t is 'd'
return ''
......@@ -19,10 +16,7 @@ Template.chatRoomItem.helpers
return this.name
roomIcon: ->
switch this.t
when 'd' then return 'icon-at'
when 'c' then return 'icon-hash'
when 'p' then return 'icon-lock'
return RocketChat.roomTypes.getIcon this.t
active: ->
if Session.get('openedRoom') is this.rid
......
......@@ -2,6 +2,7 @@ RocketChat.roomTypes = new class
rooms = []
routes = {}
publishes = {}
icons = {}
### Sets a route for a room type
@param roomType: room type (e.g.: c (for channels), d (for direct channels))
......@@ -58,9 +59,22 @@ RocketChat.roomTypes = new class
return unless publishes[roomType]?
return publishes[roomType].call this, identifier
getIcon = (roomType) ->
return icons[roomType]
###
@param roomType: room type (e.g.: c (for channels), d (for direct channels))
@param iconClass: iconClass to display on sideNav
###
setIcon = (roomType, iconClass) ->
icons[roomType] = iconClass
addType: addType
getTypes: getAllTypes
setIcon: setIcon
getIcon: getIcon
setRoute: setRoute
getRoute: getRoute
......
Meteor.startup(function() {
RocketChat.roomTypes.addType('livechat', ['livechat-agent', 'livechat-manager']);
RocketChat.roomTypes.setIcon('l', 'icon-chat-empty');
RocketChat.roomTypes.setRoute('l', 'live', function(sub) {
console.log('livechat route ->',sub);
return { name: sub.name };
});
......
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