Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | <!-- BEGIN PAGE BREADCRUMB --> |
| 2 | <ul class="page-breadcrumb breadcrumb"> |
||
| 3 | <li> |
||
| 4 | <a href="#">Home</a><i class="fa fa-circle"></i> |
||
| 5 | </li> |
||
| 6 | <li class="active" data-ng-bind="$state.current.data.pageTitle"> |
||
| 7 | </li> |
||
| 8 | </ul> |
||
| 9 | <!-- END PAGE BREADCRUMB --> |
||
| 10 | |||
| 11 | <!-- BEGIN MAIN CONTENT --> |
||
| 12 | <div class="note note-success note-bordered"> |
||
| 13 | <h3>Angular File Upload</h3> |
||
| 14 | <p> |
||
| 15 | Angular File Upload is a module for the AngularJS framework. Supports drag-n-drop upload, upload progress, validation filters and a file upload queue. It supports native HTML5 uploads, but degrades to a legacy iframe upload method for older browsers. Works with any server side platform which supports standard HTML form uploads. |
||
| 16 | </p> |
||
| 17 | <p><span class="label label-danger">File upload is disabled in the demo only!</span></p> |
||
| 18 | <p> |
||
| 19 | For more info please check the <a href="https://github.com/nervgh/angular-file-upload">official github page</a> |
||
| 20 | </p> |
||
| 21 | </div> |
||
| 22 | |||
| 23 | <div class="row" ng-controller="FileUploadCtrl" nv-file-drop="" uploader="uploader" filters="queueLimit, customFilter"> |
||
| 24 | <div class="col-md-4"> |
||
| 25 | <!-- BEGIN: ACCORDION DEMO --> |
||
| 26 | <div class="portlet light"> |
||
| 27 | <div class="portlet-title"> |
||
| 28 | <div class="caption font-green-sharp"> |
||
| 29 | <i class="icon-settings font-green-sharp"></i> |
||
| 30 | <span class="caption-subject bold uppercase">Select files</span> |
||
| 31 | <span class="caption-helper hide"></span> |
||
| 32 | </div> |
||
| 33 | <div class="actions"> |
||
| 34 | <a class="btn btn-circle btn-icon-only btn-default" href="#"> |
||
| 35 | <i class="icon-cloud-upload"></i> |
||
| 36 | </a> |
||
| 37 | <a class="btn btn-circle btn-icon-only btn-default" href="#"> |
||
| 38 | <i class="icon-wrench"></i> |
||
| 39 | </a> |
||
| 40 | </div> |
||
| 41 | </div> |
||
| 42 | <div class="portlet-body"> |
||
| 43 | <div ng-show="uploader.isHTML5"> |
||
| 44 | <!-- 3. nv-file-over uploader="link" over-class="className" --> |
||
| 45 | <div class="file-drop-zone margin-bottom-20" nv-file-over="" uploader="uploader" over-class="file-drop-zone-over"> |
||
| 46 | Base drop zone |
||
| 47 | </div> |
||
| 48 | <!-- Example: nv-file-drop="" uploader="{Object}" options="{Object}" filters="{String}" --> |
||
| 49 | <div nv-file-drop="" uploader="uploader" options="{ url: '/foo' }"> |
||
| 50 | <div nv-file-over="" uploader="uploader" over-class="file-drop-zone-over" class="file-drop-zone margin-bottom-20"> |
||
| 51 | Another drop zone with its own settings |
||
| 52 | </div> |
||
| 53 | </div> |
||
| 54 | </div> |
||
| 55 | <!-- Example: nv-file-select="" uploader="{Object}" options="{Object}" filters="{String}" --> |
||
| 56 | Multiple |
||
| 57 | <input type="file" nv-file-select="" uploader="uploader" multiple /><br/> |
||
| 58 | Single |
||
| 59 | <input type="file" nv-file-select="" uploader="uploader" /> |
||
| 60 | </div> |
||
| 61 | </div> |
||
| 62 | <!-- END: ACCORDION DEMO --> |
||
| 63 | </div> |
||
| 64 | <div class="col-md-8"> |
||
| 65 | <!-- BEGIN: ACCORDION DEMO --> |
||
| 66 | <div class="portlet light"> |
||
| 67 | <div class="portlet-title"> |
||
| 68 | <div class="caption font-green-sharp"> |
||
| 69 | <i class="icon-settings font-green-sharp"></i> |
||
| 70 | <span class="caption-subject bold uppercase">Upload queue</span> |
||
| 71 | <span class="caption-helper">Queue length: {{ uploader.queue.length }}</span> |
||
| 72 | </div> |
||
| 73 | <div class="actions"> |
||
| 74 | <div class="btn-group"> |
||
| 75 | <a class="btn btn-circle btn-default btn-sm" href="#" data-toggle="dropdown"> |
||
| 76 | <i class="fa fa-cogs"></i> Settings <i class="fa fa-angle-down"></i> |
||
| 77 | </a> |
||
| 78 | <ul class="dropdown-menu pull-right"> |
||
| 79 | <li> |
||
| 80 | <a href="#"> |
||
| 81 | <i class="fa fa-pencil"></i> Edit </a> |
||
| 82 | </li> |
||
| 83 | <li> |
||
| 84 | <a href="#"> |
||
| 85 | <i class="fa fa-trash-o"></i> Delete </a> |
||
| 86 | </li> |
||
| 87 | <li> |
||
| 88 | <a href="#"> |
||
| 89 | <i class="fa fa-ban"></i> Ban </a> |
||
| 90 | </li> |
||
| 91 | <li class="divider"> |
||
| 92 | </li> |
||
| 93 | <li> |
||
| 94 | <a href="#"> |
||
| 95 | <i class="i"></i> Make admin </a> |
||
| 96 | </li> |
||
| 97 | </ul> |
||
| 98 | </div> |
||
| 99 | <a class="btn btn-circle btn-icon-only btn-default fullscreen" href="#" data-original-title="" title=""> |
||
| 100 | </a> |
||
| 101 | </div> |
||
| 102 | </div> |
||
| 103 | <div class="portlet-body"> |
||
| 104 | <div class="table-scrollable table-scrollable-borderless"> |
||
| 105 | <table class="table table-hover table-light"> |
||
| 106 | <thead> |
||
| 107 | <tr class="uppercase"> |
||
| 108 | <th width="50%">Name</th> |
||
| 109 | <th ng-show="uploader.isHTML5">Size</th> |
||
| 110 | <th ng-show="uploader.isHTML5">Progress</th> |
||
| 111 | <th>Status</th> |
||
| 112 | <th>Actions</th> |
||
| 113 | </tr> |
||
| 114 | </thead> |
||
| 115 | <tbody> |
||
| 116 | <tr ng-repeat="item in uploader.queue"> |
||
| 117 | <td><strong>{{ item.file.name }}</strong></td> |
||
| 118 | <td ng-show="uploader.isHTML5" nowrap>{{ item.file.size/1024/1024|number:2 }} MB</td> |
||
| 119 | <td ng-show="uploader.isHTML5"> |
||
| 120 | <div class="progress progress-sm" style="margin-bottom: 0;"> |
||
| 121 | <div class="progress-bar progress-bar-info" role="progressbar" ng-style="{ 'width': item.progress + '%' }"></div> |
||
| 122 | </div> |
||
| 123 | </td> |
||
| 124 | <td class="text-center"> |
||
| 125 | <span ng-show="item.isSuccess" class="text-success"><i class="glyphicon glyphicon-ok"></i></span> |
||
| 126 | <span ng-show="item.isCancel" class="text-info"><i class="glyphicon glyphicon-ban-circle"></i></span> |
||
| 127 | <span ng-show="item.isError" class="text-danger"><i class="glyphicon glyphicon-remove"></i></span> |
||
| 128 | </td> |
||
| 129 | <td nowrap> |
||
| 130 | <button type="button" class="btn btn-success btn-xs" ng-click="item.upload()" ng-disabled="item.isReady || item.isUploading || item.isSuccess"> |
||
| 131 | <span class="glyphicon glyphicon-upload"></span> Upload |
||
| 132 | </button> |
||
| 133 | <button type="button" class="btn btn-warning btn-xs" ng-click="item.cancel()" ng-disabled="!item.isUploading"> |
||
| 134 | <span class="glyphicon glyphicon-ban-circle"></span> Cancel |
||
| 135 | </button> |
||
| 136 | <button type="button" class="btn btn-danger btn-xs" ng-click="item.remove()"> |
||
| 137 | <span class="glyphicon glyphicon-trash"></span> Remove |
||
| 138 | </button> |
||
| 139 | </td> |
||
| 140 | </tr> |
||
| 141 | </tbody> |
||
| 142 | </table> |
||
| 143 | </div> |
||
| 144 | |||
| 145 | <div> |
||
| 146 | <p>Queue progress:</p> |
||
| 147 | <div class="progress progress-sm" style=""> |
||
| 148 | <div class="progress-bar progress-bar-info" role="progressbar" ng-style="{ 'width': uploader.progress + '%' }"></div> |
||
| 149 | </div> |
||
| 150 | </div> |
||
| 151 | <button type="button" class="btn btn-success btn-s" ng-click="uploader.uploadAll()" ng-disabled="!uploader.getNotUploadedItems().length"> |
||
| 152 | <span class="glyphicon glyphicon-upload"></span> Upload all |
||
| 153 | </button> |
||
| 154 | <button type="button" class="btn btn-warning btn-s" ng-click="uploader.cancelAll()" ng-disabled="!uploader.isUploading"> |
||
| 155 | <span class="glyphicon glyphicon-ban-circle"></span> Cancel all |
||
| 156 | </button> |
||
| 157 | <button type="button" class="btn btn-danger btn-s" ng-click="uploader.clearQueue()" ng-disabled="!uploader.queue.length"> |
||
| 158 | <span class="glyphicon glyphicon-trash"></span> Remove all |
||
| 159 | </button> |
||
| 160 | </div> |
||
| 161 | </div> |
||
| 162 | <!-- END: ACCORDION DEMO --> |
||
| 163 | </div> |
||
| 164 | </div> |
||
| 165 | <!-- END MAIN CONTENT --> |
||
| 166 | |||
| 167 | <!-- BEGIN MAIN JS--> |
||
| 168 | <script> |
||
| 169 | function FileUploadCtrl($scope, FileUploader) { |
||
| 170 | |||
| 171 | var uploader = $scope.uploader = new FileUploader({ |
||
| 172 | url: '../../../assets/global/plugins/angularjs/plugins/angular-file-upload/upload.php' |
||
| 173 | }); |
||
| 174 | |||
| 175 | // FILTERS |
||
| 176 | uploader.filters.push({ |
||
| 177 | name: 'customFilter', |
||
| 178 | fn: function(item /*{File|FileLikeObject}*/ , options) { |
||
| 179 | return this.queue.length < 10; |
||
| 180 | } |
||
| 181 | }); |
||
| 182 | |||
| 183 | // CALLBACKS |
||
| 184 | |||
| 185 | uploader.onWhenAddingFileFailed = function(item /*{File|FileLikeObject}*/ , filter, options) { |
||
| 186 | console.info('onWhenAddingFileFailed', item, filter, options); |
||
| 187 | }; |
||
| 188 | uploader.onAfterAddingFile = function(fileItem) { |
||
| 189 | console.info('onAfterAddingFile', fileItem); |
||
| 190 | }; |
||
| 191 | uploader.onAfterAddingAll = function(addedFileItems) { |
||
| 192 | console.info('onAfterAddingAll', addedFileItems); |
||
| 193 | }; |
||
| 194 | uploader.onBeforeUploadItem = function(item) { |
||
| 195 | console.info('onBeforeUploadItem', item); |
||
| 196 | }; |
||
| 197 | uploader.onProgressItem = function(fileItem, progress) { |
||
| 198 | console.info('onProgressItem', fileItem, progress); |
||
| 199 | }; |
||
| 200 | uploader.onProgressAll = function(progress) { |
||
| 201 | console.info('onProgressAll', progress); |
||
| 202 | }; |
||
| 203 | uploader.onSuccessItem = function(fileItem, response, status, headers) { |
||
| 204 | console.info('onSuccessItem', fileItem, response, status, headers); |
||
| 205 | }; |
||
| 206 | uploader.onErrorItem = function(fileItem, response, status, headers) { |
||
| 207 | console.info('onErrorItem', fileItem, response, status, headers); |
||
| 208 | }; |
||
| 209 | uploader.onCancelItem = function(fileItem, response, status, headers) { |
||
| 210 | console.info('onCancelItem', fileItem, response, status, headers); |
||
| 211 | }; |
||
| 212 | uploader.onCompleteItem = function(fileItem, response, status, headers) { |
||
| 213 | console.info('onCompleteItem', fileItem, response, status, headers); |
||
| 214 | }; |
||
| 215 | uploader.onCompleteAll = function() { |
||
| 216 | console.info('onCompleteAll'); |
||
| 217 | }; |
||
| 218 | |||
| 219 | console.info('uploader', uploader); |
||
| 220 | }; |
||
| 221 | </script> |
||
| 222 | <!-- BEGIN MAIN JS --> |