Permalink
Browse files

reworked validation

  • Loading branch information...
1 parent 10b2dc8 commit daa918617e7a4e76d2df67110d4628312423d2c3 Danial Farid committed Aug 14, 2015
View
@@ -24,6 +24,7 @@
"ngFileUpload":true,
"FormData":true,
"Blob":true,
- "ActiveXObject":false
+ "ActiveXObject":false,
+ "$document":false
}
}
View
@@ -14,7 +14,7 @@ module.exports = function (grunt) {
}
},
files: {
- 'dist/ng-file-upload.js': ['src/upload.js', 'src/select.js', 'src/drop.js', 'src/data-url.js'],
+ 'dist/ng-file-upload.js': ['src/upload.js', 'src/select.js', 'src/data-url.js', 'src/validate.js', 'src/drop.js'],
'dist/ng-file-upload-shim.js': ['src/shim-upload.js', 'src/shim-elem.js', 'src/shim-filereader.js'],
'dist/ng-file-upload-all.js': ['dist/ng-file-upload-shim.js', 'dist/ng-file-upload.js']
}
@@ -71,7 +71,7 @@ fieldset label {
width: 170px;
height: 170px;
text-align: center;
- padding-top: 100px;
+ padding: 100px 10px 0 10px;
margin-left: 10px;
}
@@ -90,7 +90,7 @@
ngf-multiple="multiple" ngf-accept="accept" accept="{{acceptSelect}}"
ng-disabled="disabled" ngf-capture="capture"
ngf-drag-over-class="{accept:'dragover', reject:'dragover-err', delay:100}"
- ngf-min-size="minSize" ngf-max-size="maxSize"
+ ngf-validate="validateObj"
ngf-keep="keep" ngf-keep-distinct="keepDistinct" ngf-reset-on-click="resetOnClick"
ngf-reset-model-on-click="resetModelOnClick"
ngf-allow-dir="allowDir" class="drop-box" ngf-drop-available="dropAvailable">Select File,
@@ -102,8 +102,7 @@
<label>ngf-accept (accept/reject file model): <input type="text" ng-model="accept"></label><br/>
<label>accept (for select browser dependent): <input type="text" ng-model="acceptSelect"></label><br/>
<label>ngf-capture (for mobile): <input type="text" ng-model="capture"></label><br/>
- <label>ngf-min-size: <input type="text" ng-model="minSize"></label><br/>
- <label>ngf-max-size: <input type="text" ng-model="maxSize"></label><br/>
+ <label>ngf-validate: <input type="text" ng-model="validate" size="49"></label><br/>
<label><input type="checkbox" ng-model="multiple">ngf-multiple (allow multiple files)</label><br/>
<label><input type="checkbox" ng-model="disabled">ng-disabled</label><br/>
<label><input type="checkbox" ng-model="allowDir">ngf-allow-dir (allow directory drop Chrome only)</label><br/>
@@ -117,10 +116,10 @@
<div class="preview">
<div>Preview image/audio/video:</div>
- <img ngf-src="files[0]" ng-show="files[0].type.indexOf('image') > -1" ngf-accept="'image/*'">
- <audio controls ngf-src="files[0]" ng-show="files[0].type.indexOf('audio') > -1"
+ <img ng-src="{{files[0] | ngfDataUrl}}" ng-show="files[0].type.indexOf('image') > -1" ngf-accept="'image/*'">
+ <audio controls ng-src="{{files[0] | ngfDataUrl}}" ng-show="files[0].type.indexOf('audio') > -1"
ngf-accept="'audio/*'"></audio>
- <video controls ngf-src="files[0]" ng-show="files[0].type.indexOf('video') > -1"
+ <video controls ng-src="{{files[0] | ngfDataUrl}}" ng-show="files[0].type.indexOf('video') > -1"
ngf-accept="'video/*'"></video>
</div>
</fieldset>
@@ -129,12 +128,12 @@
</div>
<ul style="clear:both" ng-show="rejFiles.length > 0" class="response">
<li class="sel-file" ng-repeat="f in rejFiles">
- Rejected file: {{f.$error}}, {{f.name}} - size: {{f.size}}B - type: {{f.type}}
+ Rejected file: {{f.$error}} {{f.$errorParam}}, {{f.name}} - size: {{f.size}}B - type: {{f.type}}
</li>
</ul>
<ul style="clear:both" ng-show="files.length > 0" class="response">
<li class="sel-file" ng-repeat="f in files">
- <img ng-show="f.type.indexOf('image') > -1" ngf-src="f" class="thumb" ngf-accept="'image/*'">
+ <img ng-show="f.type.indexOf('image') > -1" ng-src="{{f | ngfDataUrl}}" class="thumb" ngf-accept="'image/*'">
<span class="progress" ng-show="f.progress >= 0">
<div style="width:{{f.progress}}%">{{f.progress}}%</div>
</span>
@@ -1,4 +1,4 @@
-/*! 6.1.2 */
+/*! 6.2.0 */
/*! FileAPI 2.0.7 - BSD | git://github.com/mailru/FileAPI.git
* FileAPI — a set of javascript tools for working with files. Multiupload, drag'n'drop and chunked file upload. Images: crop, resize and auto orientation by EXIF.
*/
Oops, something went wrong.

0 comments on commit daa9186

Please sign in to comment.