pull/1379/head
Diego Sampaio 10 years ago
parent 5468c93c9c
commit ceb25677fd
  1. 4
      client/startup/defaultRoomTypes.coffee
  2. 8
      client/views/app/sideNav/chatRoomItem.coffee
  3. 14
      packages/rocketchat-lib/lib/roomTypes.coffee
  4. 2
      packages/rocketchat-livechat/client/ui.js

@ -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

@ -1,7 +1,7 @@
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 };
});

Loading…
Cancel
Save