Created
April 16, 2013 02:54
-
-
Save pzuraq/5393002 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Case.UploadFileView = Ember.TextField.extend({ | |
type: 'file', | |
attributeBindings: ['name', 'multiple'], | |
change: function(evt) { | |
var self = this; | |
var input = evt.target; | |
if (input.files && input.files[0]) { | |
for(var i = 0; i < input.files.length; ++i) { | |
var reader = new FileReader(); | |
var that = this; | |
reader.onload = function(e) { | |
var fileToUpload = e.srcElement.result, | |
fileArrayName = self.get('name'), | |
fileArray = self.get('controller').get(fileArrayName); | |
fileArray.pushObject(fileToUpload); | |
self.get('controller').set(fileArrayName, fileArray); | |
} | |
reader.readAsDataURL(input.files[i]); | |
} | |
} | |
} | |
}); |
This file contains hidden or 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
Case.VehiclePhotosController = Ember.ObjectController.extend({ | |
photoQueue: Ember.A(), | |
photoQueueSorted: function() { | |
console.log(this.get('photoQueue')); | |
return this.get('photoQueue').filter(function(photo) {return true;}); | |
}.property('photoQueue.@each'), | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment