Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] candy:view.room.after-hide & candy:view.room.after-show triggerHandlers #17

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/view/pane/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convention suggests that the data param is a hash, so {room: roomObject}.

This also requires documentation updates.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even for a single item? I purposefully ditched it because it seemed silly when there was only one expected data object.

Actually, just talked myself out of it. It makes me it more flexible in the future. I'll change to that, and yes--documentation. :)

} else {
elem.hide();

Expand All @@ -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);
}
});
},
Expand Down