mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
latest changes
This commit is contained in:
@ -787,4 +787,36 @@ angular.module('biomed.directives', [])
|
||||
};
|
||||
}
|
||||
};
|
||||
})
|
||||
.directive('dropzone', function() {
|
||||
return {
|
||||
scope: {
|
||||
dropzone: '=',
|
||||
existing: '='
|
||||
},
|
||||
controller: function($scope, $element, $attrs) {
|
||||
var config, dropzone;
|
||||
config = $scope.dropzone;
|
||||
|
||||
dropzone = new Dropzone($element[0], config.options);
|
||||
angular.forEach(config.eventHandlers, function (handler, event) {
|
||||
dropzone.on(event, handler);
|
||||
});
|
||||
|
||||
$scope.$watch('existing', function() {
|
||||
var existing = $scope.existing;
|
||||
|
||||
console.log(dropzone);
|
||||
|
||||
if (existing) {
|
||||
for (var i = 0; i < existing.length; i++) {
|
||||
var file = { name: existing[i], size: 0, accepted: true, filename: existing[i] };
|
||||
dropzone.options.addedfile.call(dropzone, file);
|
||||
dropzone.options.thumbnail.call(dropzone, file, "http://atlanticbiomedical.com/images/" + existing[i]);
|
||||
dropzone.files.push(file);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user