Skip to content

Instantly share code, notes, and snippets.

@patrickjholloway
Created May 29, 2013 22:09
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 patrickjholloway/5674238 to your computer and use it in GitHub Desktop.
Save patrickjholloway/5674238 to your computer and use it in GitHub Desktop.
<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