Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created July 20, 2010 04:50
Show Gist options
  • Save joegaudet/482546 to your computer and use it in GitHub Desktop.
Save joegaudet/482546 to your computer and use it in GitHub Desktop.
DarkHorse.FeedItemRenderer = SC.Renderer.extend({
init: function(attrs){
sc_super();
console.log("FeedItemRenderer:Render");
console.log(attrs);
},
render: function(context){
// triangle
context.begin('div').addClass("triangle");
context.end();
context.begin('div').addClass("feedItem");
context.addClass('static');
this.renderContent(context);
context = context.end();
},
renderContent: function(context){
context.begin('div').addClass('content');
var content = this.escapeHTML ? SC.RenderContext.escapeHTML(this.content.get('content')) : this.content.get('content');
context.push(content);
context.end();
},
updateContent: function(){
var content = this.escapeHTML ? SC.RenderContext.escapeHTML(this.content.get('content')) : this.content.get('content');
this.$(".content")[0].innerHTML = content;
},
update: function(){
this.
},
didAttachLayer: function(){
console.log("Hey!");
}
});
DarkHorse.FeedItemView = SC.View.extend({
useStaticLayout: YES,
createRenderer: function(){
return DarkHorse.FeedItemRenderer;
},
updateRenderer: function(renderer){
var content = this.get('content');
var attrs = {
content: content
};
renderer.attr(attrs);
renderer.update();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment