Skip to content

Instantly share code, notes, and snippets.

@coop
Created November 7, 2011 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coop/1346411 to your computer and use it in GitHub Desktop.
Save coop/1346411 to your computer and use it in GitHub Desktop.
App.featureDeploys = SC.Object.create({
deploy: function() {
// code in here
}
});
App.FeatureView = SC.View.extend({
classNames: ['feature'],
templateName: 'feature',
createdAt: function () {
return $.timeago.distanceInWords(this.getPath('content.createdAt'));
}.property('createdAt').cacheable()
});
<script type="text/x-handlebars" data-template-name="feature">
<h2>{{content.title}}</h2>
{{#if content.body}}
{{content.body}}
{{/if}}
<abbr {{bindAttr title="content.createdAt"}}>{{createdAt}}</abbr>
{{#if content.waitingDeployment}}
{{#view SC.Button target="App.featureDeploy" action="deploy" class="deploy-now"}}
Deploy
{{/view}}
{{/if}}
{{#if content.isDeployed}}
{{#view SC.Button target="App.featureDeploys" action="view" class="deploy-now"}}
View Feature
{{/view}}
{{/if}}
</script>
<script type="text/x-handlebars">
{{collectionView App.OpenFeaturesView id="open-features"}}
</script>
App.OpenFeaturesView = SC.CollectionView.extend({
content: [],
itemViewClass: App.FeatureView
});
@tatey
Copy link

tatey commented Nov 7, 2011

It's not Backbone.js.

@coop
Copy link
Author

coop commented Nov 7, 2011

@tatey trollololol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment