Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<script type="text/x-handlebars" data-template-name="photo">
<h2>{{title}}</h2>
<img {{ bindAttr src="imageUrl" title="title" alt="title" style="widthStyle"}}>
<p class="description">{{{description}}}</p>
<label/>Title<label/>
{{view Ember.TextField valueBinding="title"}}
<label/>Author<label/>
{{view Ember.TextField valueBinding="author"}}
<label/>Caption<label/>
{{view Ember.TextField valueBinding="caption"}}
</script>
App.Photo = DS.Model.extend({
title: DS.attr('string'),
caption: DS.attr('string'),
xDimension: DS.attr('number'),
yDimension: DS.attr('number'),
author: DS.attr('string'),
imageUrl: function() {
return "images/" + this.get('id') + ".jpg";
}.property('id'),
description: function() {
return '<b>' + this.get('title') + '</b>' + ' by ' + this.get('author') + '<br/><em>' + this.get('caption') + '<em>';
}.property('title', 'author', 'caption')
})
pic = App.Photo.find(1)
pic.store.commit()
<button {{action "save" target="photo"}}>Save</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.