Skip to content

Commit

Permalink
Don't create a link for the user
Browse files Browse the repository at this point in the history
  • Loading branch information
pusewicz committed Apr 23, 2010
1 parent 5b8cfc4 commit e206305
Showing 1 changed file with 32 additions and 33 deletions.
65 changes: 32 additions & 33 deletions public/javascripts/campfire.js
@@ -1,36 +1,35 @@
var Campfire = Class.create(Widget, {
initialize: function($super, widget_id, config) {
this.messages = [];
return($super(widget_id, config));
},
receive: function(payload) {
console.log("Received some payload: " + payload);
if(this.messages.length >= this.config.nitems) {
this.messages.shift();
}
this.messages.push(payload);
this.update();
},
update: function() {
initialize: function($super, widget_id, config) {
this.messages = [];
return($super(widget_id, config));
},
receive: function(payload) {
if(this.messages.length >= this.config.nitems) {
this.messages.shift();
}
this.messages.push(payload);
this.update();
},
update: function() {
new Draggable($(this.container));
this.container.childElements().invoke('remove');
this.container.appendChild(this.buildWidgetIcon());
this.container.appendChild(this.buildHeader());
this.messages.reverse(false).each(function(message) {
var cont = new Element('p');
cont.appendChild(new Element('img', { src: message.avatar, width: 48, height: 48 }));
cont.appendChild(new Element('a', { href: '#', className: 'author' }).update(message.user));
cont.appendChild(document.createTextNode(message.body));
cont.appendChild(new Element('hr' ));
this.container.appendChild(cont);
}.bind(this));
},
this.container.childElements().invoke('remove');
this.container.appendChild(this.buildWidgetIcon());
this.container.appendChild(this.buildHeader());
this.messages.reverse(false).each(function(message) {
var cont = new Element('p');
cont.appendChild(new Element('img', { src: message.avatar, width: 48, height: 48 }));
cont.appendChild(new Element('div', { className: 'author' }).update(message.user));
cont.appendChild(document.createTextNode(message.body));
cont.appendChild(new Element('hr' ));
this.container.appendChild(cont);
}.bind(this));
},

buildHeader: function() {
return(new Element("h2").update(this.title));
},
buildWidgetIcon: function() {
return(new Element("img", {src: "images/campfire.png", width: 32, height: 32, className: 'campfire icon'}));
}
});
buildHeader: function() {
return(new Element("h2").update(this.title));
},

buildWidgetIcon: function() {
return(new Element("img", {src: "images/campfire.png", width: 32, height: 32, className: 'campfire icon'}));
}
});

0 comments on commit e206305

Please sign in to comment.