Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created July 2, 2010 03:23
Show Gist options
  • Save joegaudet/460883 to your computer and use it in GitHub Desktop.
Save joegaudet/460883 to your computer and use it in GitHub Desktop.
contentView: SC.View.design({
layout: { top: 0, right: 0, bottom: 0, left: 0 },
childViews: 'stackedView'.w(),
stackedView: SC.StackedView.design({
layout: { top: 0, right: 0, bottom: 0, left: 0 },
contentBinding: 'DarkHorse.feedsController.arrangedObjects',
selectionBinding: 'DarkHorse.feedsController.selection',
contentExampleView: DarkHorse.FeedItemView
})
}),
sc_require('mixins/builders/fade_builder');
DarkHorse.FeedItemView = SC.View.extend(SC.StaticLayout, {
childViews: 'contentView image triangle'.w(),
useStaticLayout: YES,
init: function(){
sc_super();
var innerClassNames = ['feedItem'];
// var triangleClassNames = [];
// for(var i = 0; i < this.contentViewClassNames.length; i++){
// innerClassNames.push(this.contentViewClassNames[i]);
// triangleClassNames.push(this.contentViewClassNames[i]);
// }
//
// this.setPath("contentView.classNames",innerClassNames);
// this.setPath("triangle.classNames",triangleClassNames);
this.setPath("contentView.content",this.get('content'));
},
image:SC.ImageView.design({
layout: { top: 10, right: 0, bottom: 0, left: 10 },
valueBinding: '.parentView.content.icon'
}),
triangle:SC.View.design({
layout: { top: 20, left: 89, width: 20, height: 20 },
backgroundColor: 'white',
classNames: ['triangle']
}),
contentView: SC.View.extend({
useStaticLayout: YES,
// layout: {top: 5, width: 500, bottom: 5, left: 99 },
childViews: 'source slug content'.w(),
init: function(){
sc_super();
console.log("Init?");
this.more = this.createChildView(this.more);
},
mouseEntered: function(event){
this.buildInChild(this.more);
},
mouseExited: function(event){
this.buildOutChild(this.more);
},
source: SC.LabelView.design({
layout: { top: 10, right: 10, height: 15, left: 10 },
valueBinding: '.parentView.content.sourceLine',
fontWeight: SC.BOLD_WEIGHT
}),
slug: SC.LabelView.design({
layout: { top: 30, left: 10, height: 20, right: 10 },
valueBinding: '.parentView.content.subject',
classNames: 'feedSubject',
fontWeight: SC.BOLD_WEIGHT
}),
content: SC.LabelView.design(SC.StaticLayout,{
valueBinding: '.parentView.content.content'
}),
more: SC.LabelView.design(SCUI.SimpleButton, DarkHorse.FadeBuilder,{
layout: { height: 18, right: 5, bottom: 5, width:80 },
classNames: ['showFeedButton'],
textAlign: SC.ALIGN_CENTER,
valueBinding: '.parentView.content.showSourceText',
target: 'parentView.parentView',
action: 'showSource',
fontWeight: SC.BOLD_WEIGHT,
color: '#999',
fadeSpeed: 0.2
})
}),
showSource: function(){
// override me
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment