Created
December 16, 2011 15:55
-
-
Save lukemelia/1486569 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.ProjectSelectView = Ember.CollectionView.extend({ | |
selected: null, | |
itemViewClass: Ember.View.extend({ | |
attributeBindings:['selected'], | |
valueBinding: 'content.selected' | |
}), | |
valueChanged: function(){ | |
this.$().val( this.get('selected') ); | |
}.observes('selected'), | |
didInsertElement: function(){ | |
var self = this; | |
this.$().change(function(){ | |
var val = $('select option:selected').val(); | |
console.log(val) | |
self.set('value', val); | |
}); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Project | |
App.Project = Ember.Object.extend({ | |
_id: '', | |
title: '', | |
info: '', | |
testimonial: '', | |
type: '', | |
created_at: '', | |
updated_at: '', | |
photos: [], | |
available_types: [ | |
{value: 'landscape', name: 'Landscape', selected: false}, | |
{value: 'remodel', name: 'Remodel', selected: true}, | |
{value: 'new', name: 'New', selected: false} | |
], | |
formattedDate: function () { | |
return (new Date(this.get("created_at"))).toDateString(); | |
}.property("created_at").cacheable(), | |
formattedType: function () { | |
return this.get("type").charAt(0).toUpperCase() + this.get("type").slice(1); | |
}.property("type") | |
}); | |
App.currentProject = App.Project.create(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment