diff --git a/bower.json b/bower.json index 376023c..3ff7711 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "asf-cloudinary-file-upload", - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "author": "SaifJerbi", "main": [ diff --git a/dist/asf-cloudinary-file-upload.js b/dist/asf-cloudinary-file-upload.js index ee61f91..efd03e8 100644 --- a/dist/asf-cloudinary-file-upload.js +++ b/dist/asf-cloudinary-file-upload.js @@ -28,7 +28,7 @@ CloudinaryFileUploadCtrl.$inject = ['$scope', 'Upload','cloudinary']; var d = new Date(); cloudinary.config().cloud_name= $scope.form.cloudName; cloudinary.config().upload_preset = $scope.form.uploadPreset; - + $scope.uploadFiles = function(files){ $scope.files = files; if (!$scope.files) return; @@ -46,12 +46,10 @@ CloudinaryFileUploadCtrl.$inject = ['$scope', 'Upload','cloudinary']; file.progress = Math.round((e.loaded * 100.0) / e.total); file.status = "Uploading... " + file.progress + "%"; }).success(function (data, status, headers, config) { - $scope.photos = $scope.photos || []; file.result = data; file.result.success= true; - $scope.model.image = data; - $scope.photos.push(data); file.status = "Uploaded"; + $scope.model[$scope.form.key] = data; }).error(function (data, status, headers, config) { file.result = data; file.result.failed= true; diff --git a/dist/asf-cloudinary-file-upload.min.js b/dist/asf-cloudinary-file-upload.min.js index 1157d02..2189e0f 100644 --- a/dist/asf-cloudinary-file-upload.min.js +++ b/dist/asf-cloudinary-file-upload.min.js @@ -1 +1 @@ -angular.module("templates",[]).run(["$templateCache",function(e){e.put("src/templates/asf-cloudinary-file-upload.html",'
\n\x3c!-- Surrounding DIV for sfField builder to add a sfField directive to. --\x3e\n\n
\n
\n

{{form.label}}:

\n
\n \n \n
\n
\n
\n
')}]),function(){"use strict";function e(e,l){e.defineAddOn("bootstrapDecorator","cloudinaryfileupload","src/templates/asf-cloudinary-file-upload.html",l.stdBuilders)}function l(e,l,s){new Date;s.config().cloud_name=e.form.cloudName,s.config().upload_preset=e.form.uploadPreset,e.uploadFiles=function(a){e.files=a,e.files&&angular.forEach(a,function(a){a&&!a.$error&&(a.upload=l.upload({url:"https://api.cloudinary.com/v1_1/"+s.config().cloud_name+"/upload",skipAuthorization:!!e.form.skipAuthorization&&e.form.skipAuthorization,fields:{upload_preset:s.config().upload_preset,tags:"myphotoalbum"},file:a}).progress(function(e){a.progress=Math.round(100*e.loaded/e.total),a.status="Uploading... "+a.progress+"%"}).success(function(l,s,o,r){e.photos=e.photos||[],a.result=l,a.result.success=!0,e.model.image=l,e.photos.push(l),a.status="Uploaded"}).error(function(e,l,s,o){a.result=e,a.result.failed=!0,a.status=e.error.message}))})}}var s=angular.module("cloudinaryFileUpload",["schemaForm","templates","cloudinary","ngFileUpload"]);s.config(e),e.$inject=["schemaFormDecoratorsProvider","sfBuilderProvider"],s.controller("cloudinaryFileUploadCtrl",l),l.$inject=["$scope","Upload","cloudinary"]}(); \ No newline at end of file +angular.module("templates",[]).run(["$templateCache",function(e){e.put("src/templates/asf-cloudinary-file-upload.html",'
\n\x3c!-- Surrounding DIV for sfField builder to add a sfField directive to. --\x3e\n\n
\n
\n

{{form.label}}:

\n
\n \n \n
\n
\n
\n
')}]),function(){"use strict";function e(e,l){e.defineAddOn("bootstrapDecorator","cloudinaryfileupload","src/templates/asf-cloudinary-file-upload.html",l.stdBuilders)}function l(e,l,s){new Date;s.config().cloud_name=e.form.cloudName,s.config().upload_preset=e.form.uploadPreset,e.uploadFiles=function(r){e.files=r,e.files&&angular.forEach(r,function(r){r&&!r.$error&&(r.upload=l.upload({url:"https://api.cloudinary.com/v1_1/"+s.config().cloud_name+"/upload",skipAuthorization:!!e.form.skipAuthorization&&e.form.skipAuthorization,fields:{upload_preset:s.config().upload_preset,tags:"myphotoalbum"},file:r}).progress(function(e){r.progress=Math.round(100*e.loaded/e.total),r.status="Uploading... "+r.progress+"%"}).success(function(l,s,a,i){r.result=l,r.result.success=!0,r.status="Uploaded",e.model[e.form.key]=l}).error(function(e,l,s,a){r.result=e,r.result.failed=!0,r.status=e.error.message}))})}}var s=angular.module("cloudinaryFileUpload",["schemaForm","templates","cloudinary","ngFileUpload"]);s.config(e),e.$inject=["schemaFormDecoratorsProvider","sfBuilderProvider"],s.controller("cloudinaryFileUploadCtrl",l),l.$inject=["$scope","Upload","cloudinary"]}(); \ No newline at end of file diff --git a/src/module.js b/src/module.js index 704d3aa..f531345 100644 --- a/src/module.js +++ b/src/module.js @@ -27,7 +27,7 @@ CloudinaryFileUploadCtrl.$inject = ['$scope', 'Upload','cloudinary']; var d = new Date(); cloudinary.config().cloud_name= $scope.form.cloudName; cloudinary.config().upload_preset = $scope.form.uploadPreset; - + $scope.uploadFiles = function(files){ $scope.files = files; if (!$scope.files) return; @@ -45,12 +45,10 @@ CloudinaryFileUploadCtrl.$inject = ['$scope', 'Upload','cloudinary']; file.progress = Math.round((e.loaded * 100.0) / e.total); file.status = "Uploading... " + file.progress + "%"; }).success(function (data, status, headers, config) { - $scope.photos = $scope.photos || []; file.result = data; file.result.success= true; - $scope.model.image = data; - $scope.photos.push(data); file.status = "Uploaded"; + $scope.model[$scope.form.key] = data; }).error(function (data, status, headers, config) { file.result = data; file.result.failed= true;