Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<script type="text/x-handlebars" data-template-name="photo">
<img {{ bindAttr src="imageUrl" title="title" alt="title" style="widthStyle"}}>
<p class="description">{{{description}}}</p>
{{view Ember.TextField valueBinding="title"}}
{{view Ember.TextField valueBinding="author"}}
{{view Ember.TextField valueBinding="caption"}}
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";
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)
<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