{:uriI"file://app/assets/javascripts/views/user/rooms/show.coffee?type=application/javascript&pipeline=self&id=49f3ac3d55c16248fb4059604bbf2e7d9c9e8fc013bd65bce01349cfddf979f2:ET:load_pathI"app/assets/javascripts;T: filenameI"8app/assets/javascripts/views/user/rooms/show.coffee;T: nameI"views/user/rooms/show;T:logical_pathI""views/user/rooms/show.self.js;T:content_typeI"application/javascript;T:sourceI" (function() { var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; App.Views.User.Rooms.Show = (function(superClass) { extend(Show, superClass); function Show(opts) { if (opts == null) { opts = {}; } Show.__super__.constructor.call(this, opts); this.roomId = opts.id; } Show.prototype.render = function() { this.connectWith(App.Models.Room); return this._handleSendingMessage(); }; Show.prototype.renderMembers = function(members) { var i, len, member, results; results = []; for (i = 0, len = members.length; i < len; i++) { member = members[i]; results.push(this._memberJoined(member)); } return results; }; Show.prototype.receivedMessage = function(message, author) { return $('#messages').append("
" + author + ": " + message + "
"); }; Show.prototype.receivedSignal = function(signal, data) { switch (signal) { case "Room member_joined": if (data.room_id !== this.roomId) { return; } return this._memberJoined(data.member); case "Room member_left": if (data.room_id !== this.roomId) { return; } return this._memberLeft(data.member); } }; Show.prototype._handleSendingMessage = function() { return $(document).on('keypress', '[data-behavior~=room-speaker]', (function(_this) { return function(event) { if (event.keyCode !== 13) { return; } event.preventDefault(); App.Env.loco.emit({ signal: 'message', txt: event.target.value, room_id: _this.roomId }); return event.target.value = ''; }; })(this)); }; Show.prototype._memberJoined = function(member) { return $('#members').append("