diff --git a/converse.js b/converse.js index edaecaef2..a519b7bca 100644 --- a/converse.js +++ b/converse.js @@ -348,7 +348,7 @@ }; this.showLoginButton = function () { - var view = converse.chatboxesview.get('controlbox'); + var view = converse.chatboxviews.get('controlbox'); if (typeof view.loginpanel !== 'undefined') { view.loginpanel.showLoginButton(); } @@ -893,7 +893,7 @@ }, this); this.updateVCard(); - this.$el.appendTo(converse.chatboxesview.$el); + this.$el.appendTo(converse.chatboxviews.$el); this.render().show().focus().model.messages.fetch({add: true}); if (this.model.get('status')) { this.showStatusMessage(this.model.get('status')); @@ -1750,7 +1750,7 @@ } } if (!nick) { return; } - chatroom = converse.chatboxesview.showChatBox({ + chatroom = converse.chatboxviews.showChatBox({ 'id': jid, 'jid': jid, 'name': Strophe.unescapeNode(Strophe.getNodeFromJid(jid)), @@ -1759,7 +1759,7 @@ 'box_id' : hex_sha1(jid) }); if (!chatroom.get('connected')) { - converse.chatboxesview.get(jid).connect(null); + converse.chatboxviews.get(jid).connect(null); } } }); @@ -1775,7 +1775,7 @@ }, initialize: function () { - this.$el.appendTo(converse.chatboxesview.$el); + this.$el.appendTo(converse.chatboxviews.$el); this.model.on('change', $.proxy(function (item, changed) { var i; if (_.has(item.changed, 'connected')) { @@ -1898,7 +1898,7 @@ undefined); }, this); - this.$el.appendTo(converse.chatboxesview.$el); + this.$el.appendTo(converse.chatboxviews.$el); this.render().show().model.messages.fetch({add: true}); this.initDragResize(); }, @@ -2351,7 +2351,7 @@ onChatRoomRoster: function (roster, room) { this.renderChatArea(); - var controlboxview = converse.chatboxesview.get('controlbox'), + var controlboxview = converse.chatboxviews.get('controlbox'), roster_size = _.size(roster), $participant_list = this.$el.find('.participant-list'), participants = [], keys = _.keys(roster), i; @@ -2462,7 +2462,7 @@ } }); - this.ChatBoxesView = Backbone.View.extend({ + this.ChatBoxViews = Backbone.View.extend({ el: '#conversejs', initialize: function () { @@ -2539,7 +2539,7 @@ openChat: function (ev) { ev.preventDefault(); - return converse.chatboxesview.showChatBox({ + return converse.chatboxviews.showChatBox({ 'id': this.model.get('jid'), 'jid': this.model.get('jid'), 'fullname': this.model.get('fullname'), @@ -3467,7 +3467,7 @@ // -------------- // This is the end of the initialize method. this.chatboxes = new this.ChatBoxes(); - this.chatboxesview = new this.ChatBoxesView({model: this.chatboxes}); + this.chatboxviews = new this.ChatBoxViews({model: this.chatboxes}); this.controlboxtoggle = new this.ControlBoxToggle(); this.otr = new this.OTR(); diff --git a/spec/chatbox.js b/spec/chatbox.js index 96a225522..e6e9c021f 100644 --- a/spec/chatbox.js +++ b/spec/chatbox.js @@ -79,8 +79,8 @@ it("can be closed by clicking a DOM element with class 'close-chatbox-button'", $.proxy(function () { var chatbox = utils.openChatBoxes(1)[0], - controlview = this.chatboxesview.get('controlbox'), // The controlbox is currently open - chatview = this.chatboxesview.get(chatbox.get('jid')); + controlview = this.chatboxviews.get('controlbox'), // The controlbox is currently open + chatview = this.chatboxviews.get(chatbox.get('jid')); spyOn(chatview, 'closeChat').andCallThrough(); spyOn(controlview, 'closeChat').andCallThrough(); spyOn(converse, 'emit'); @@ -141,7 +141,7 @@ var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost'; utils.openChatBoxFor(contact_jid); var chatbox = this.chatboxes.get(contact_jid); - var view = this.chatboxesview.get(contact_jid); + var view = this.chatboxviews.get(contact_jid); expect(chatbox).toBeDefined(); expect(view).toBeDefined(); var $toolbar = view.$el.find('ul.chat-toolbar'); @@ -153,7 +153,7 @@ var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost'; utils.openChatBoxFor(contact_jid); var chatbox = this.chatboxes.get(contact_jid); - var view = this.chatboxesview.get(contact_jid); + var view = this.chatboxviews.get(contact_jid); var $toolbar = view.$el.find('ul.chat-toolbar'); var $textarea = view.$el.find('textarea.chat-textarea'); expect($toolbar.children('li.toggle-smiley').length).toBe(1); @@ -213,7 +213,7 @@ var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost'; utils.openChatBoxFor(contact_jid); var chatbox = this.chatboxes.get(contact_jid); - var view = this.chatboxesview.get(contact_jid); + var view = this.chatboxviews.get(contact_jid); var $toolbar = view.$el.find('ul.chat-toolbar'); expect($toolbar.children('li.toggle-otr').length).toBe(1); // Register spies @@ -239,7 +239,7 @@ var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost'; utils.openChatBoxFor(contact_jid); var chatbox = this.chatboxes.get(contact_jid); - var view = this.chatboxesview.get(contact_jid); + var view = this.chatboxviews.get(contact_jid); var $toolbar = view.$el.find('ul.chat-toolbar'); var callButton = $toolbar.find('.toggle-call'); @@ -278,7 +278,7 @@ runs($.proxy(function () { // Check that the chatbox and its view now exist var chatbox = this.chatboxes.get(sender_jid); - var chatboxview = this.chatboxesview.get(sender_jid); + var chatboxview = this.chatboxviews.get(sender_jid); expect(chatbox).toBeDefined(); expect(chatboxview).toBeDefined(); // Check that the message was received and check the @@ -311,7 +311,7 @@ var one_day_ago = new Date(new Date().setDate(new Date().getDate()-1)); var message = 'This is a day old message'; var chatbox = this.chatboxes.get(contact_jid); - var chatboxview = this.chatboxesview.get(contact_jid); + var chatboxview = this.chatboxviews.get(contact_jid); var $chat_content = chatboxview.$el.find('.chat-content'); var msg_obj; var msg_txt; @@ -380,7 +380,7 @@ waits(250); runs(function () { expect(converse.emit).toHaveBeenCalledWith('onChatBoxFocused', jasmine.any(Object)); - var view = this.chatboxesview.get(contact_jid); + var view = this.chatboxviews.get(contact_jid); var message = 'This message is sent from this chatbox'; spyOn(view, 'sendMessage').andCallThrough(); view.$el.find('.chat-textarea').text(message); @@ -396,7 +396,7 @@ it("are sanitized to prevent Javascript injection attacks", $.proxy(function () { var contact_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost'; utils.openChatBoxFor(contact_jid); - var view = this.chatboxesview.get(contact_jid); + var view = this.chatboxviews.get(contact_jid); var message = 'This message contains markup'; spyOn(view, 'sendMessage').andCallThrough(); view.$el.find('.chat-textarea').text(message); @@ -413,7 +413,7 @@ it("'/clear' can be used to clear messages in a conversation", $.proxy(function () { spyOn(converse, 'emit'); var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost'; - var view = this.chatboxesview.get(contact_jid); + var view = this.chatboxviews.get(contact_jid); var message = 'This message is another sent from this chatbox'; // Lets make sure there is at least one message already // (e.g for when this test is run on its own). diff --git a/spec/chatroom.js b/spec/chatroom.js index 91c509b0a..67ec01fd6 100644 --- a/spec/chatroom.js +++ b/spec/chatroom.js @@ -24,7 +24,7 @@ waits(300); runs(function () { // Open a new chatroom - var roomspanel = converse.chatboxesview.get('controlbox').roomspanel; + var roomspanel = converse.chatboxviews.get('controlbox').roomspanel; var $input = roomspanel.$el.find('input.new-chatroom-name'); var $nick = roomspanel.$el.find('input.new-chatroom-nick'); var $server = roomspanel.$el.find('input.new-chatroom-server'); @@ -42,7 +42,7 @@ }); it("shows users currently present in the room", $.proxy(function () { - var chatroomview = this.chatboxesview.get('lounge@muc.localhost'), + var chatroomview = this.chatboxviews.get('lounge@muc.localhost'), $participant_list; var roster = {}, room = {}, i; for (i=0; i-1; i--) { chatbox = converse.chatboxes.models[i]; - converse.chatboxesview.get(chatbox.get('id')).closeChat(); + converse.chatboxviews.get(chatbox.get('id')).closeChat(); } return this; }; @@ -22,17 +22,17 @@ var i, chatbox, num_chatboxes = converse.chatboxes.models.length; for (i=num_chatboxes-1; i>-1; i--) { chatbox = converse.chatboxes.models[i]; - converse.chatboxesview.get(chatbox.get('id')).closeChat(); - converse.chatboxesview.get(chatbox.get('id')).$el.remove(); + converse.chatboxviews.get(chatbox.get('id')).closeChat(); + converse.chatboxviews.get(chatbox.get('id')).$el.remove(); } - converse.chatboxesview.get('controlbox').closeChat(); - converse.chatboxesview.get('controlbox').$el.remove(); + converse.chatboxviews.get('controlbox').closeChat(); + converse.chatboxviews.get('controlbox').$el.remove(); return this; }; utils.initConverse = function () { converse.chatboxes = new converse.ChatBoxes(); - converse.chatboxesview = new converse.ChatBoxesView({model: converse.chatboxes}); + converse.chatboxviews = new converse.ChatBoxViews({model: converse.chatboxes}); converse.onConnected(); }; @@ -66,13 +66,13 @@ }; utils.openContactsPanel = function () { - var cbview = converse.chatboxesview.get('controlbox'); + var cbview = converse.chatboxviews.get('controlbox'); var $tabs = cbview.$el.find('#controlbox-tabs'); $tabs.find('li').first().find('a').click(); }; utils.openRoomsPanel = function () { - var cbview = converse.chatboxesview.get('controlbox'); + var cbview = converse.chatboxviews.get('controlbox'); var $tabs = cbview.$el.find('#controlbox-tabs'); $tabs.find('li').last().find('a').click(); }; @@ -91,7 +91,7 @@ }; utils.clearChatBoxMessages = function (jid) { - var view = converse.chatboxesview.get(jid); + var view = converse.chatboxviews.get(jid); view.$el.find('.chat-content').empty(); view.model.messages.reset().localStorage._clear(); };