From 060489b25b88b6e5504b29194cdb5a8e7b400a1e Mon Sep 17 00:00:00 2001 From: Melissa Noelle Date: Fri, 9 Jan 2015 10:03:44 -0500 Subject: [PATCH 1/2] Replaced candy:view.room.after-hide and candy:view.room.after-show data with a room object. --- src/view/pane/room.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/view/pane/room.js b/src/view/pane/room.js index d4d4148d..f5de1808 100644 --- a/src/view/pane/room.js +++ b/src/view/pane/room.js @@ -119,15 +119,11 @@ Candy.View.Pane = (function(self, $) { * candy:view.room.after-hide using {roomJid, element} */ show: function(roomJid) { - var roomId = self.Chat.rooms[roomJid].id, - evtData; + var roomId = self.Chat.rooms[roomJid].id; + var roomObject = Candy.Core.getRoom(roomJid); $('.room-pane').each(function() { var elem = $(this); - evtData = { - 'roomJid': elem.attr('data-roomjid'), - 'element' : elem - }; if(elem.attr('id') === ('chat-room-' + roomId)) { elem.show(); @@ -145,8 +141,7 @@ Candy.View.Pane = (function(self, $) { * (String) roomJid - Room JID * (jQuery.Element) element - Room element */ - $(Candy).triggerHandler('candy:view.room.after-show', evtData); - + $(Candy).triggerHandler('candy:view.room.after-show', roomObject); } else { elem.hide(); @@ -157,7 +152,7 @@ Candy.View.Pane = (function(self, $) { * (String) roomJid - Room JID * (jQuery.Element) element - Room element */ - $(Candy).triggerHandler('candy:view.room.after-hide', evtData); + $(Candy).triggerHandler('candy:view.room.after-hide', roomObject); } }); }, From e3037a103a7514c44dfdb7988776fab793909ec2 Mon Sep 17 00:00:00 2001 From: Melissa Noelle Date: Fri, 9 Jan 2015 17:26:10 -0500 Subject: [PATCH 2/2] Follow better convention, update documentation. --- src/view/pane/room.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/view/pane/room.js b/src/view/pane/room.js index f5de1808..621bfa90 100644 --- a/src/view/pane/room.js +++ b/src/view/pane/room.js @@ -138,10 +138,9 @@ Candy.View.Pane = (function(self, $) { * After showing a room * * Parameters: - * (String) roomJid - Room JID - * (jQuery.Element) element - Room element + * (String) room - Room object */ - $(Candy).triggerHandler('candy:view.room.after-show', roomObject); + $(Candy).triggerHandler('candy:view.room.after-show', { room: roomObject}); } else { elem.hide(); @@ -149,10 +148,9 @@ Candy.View.Pane = (function(self, $) { * After hiding a room * * Parameters: - * (String) roomJid - Room JID - * (jQuery.Element) element - Room element + * (String) room - Room object */ - $(Candy).triggerHandler('candy:view.room.after-hide', roomObject); + $(Candy).triggerHandler('candy:view.room.after-hide', { room: roomObject}); } }); },