public
Created

  • Download Gist
FeatureView.js
JavaScript
1 2 3 4 5 6 7 8
App.FeatureView = SC.View.extend({
classNames: ['feature'],
templateName: 'feature',
 
createdAt: function () {
return $.timeago.distanceInWords(this.getPath('content.createdAt'));
}.property('createdAt').cacheable()
});
OpenFeaturesView.js
JavaScript
1 2 3 4
App.OpenFeaturesView = SC.CollectionView.extend({
content: [],
itemViewClass: App.FeatureView
});
featureDeploys.js
JavaScript
1 2 3 4 5
App.featureDeploys = SC.Object.create({
deploy: function() {
// code in here
}
});
index.html.erb
HTML+ERB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<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>

It's not Backbone.js.

@tatey trollololol

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.