Explorar o código

Fix #48: Trigger `fileloaded` event when `showPreview` is `false`

Kartik Visweswaran %!s(int64=10) %!d(string=hai) anos
pai
achega
235fdc7d59
Modificáronse 5 ficheiros con 11 adicións e 4 borrados
  1. 2 1
      CHANGE.md
  2. 1 1
      composer.json
  3. 7 2
      examples/index.html
  4. 1 0
      js/fileinput.js
  5. 0 0
      js/fileinput.min.js

+ 2 - 1
CHANGE.md

@@ -1,8 +1,9 @@
 version 2.7.0
 =============
-**Date:** 08-Nov-2014
+**Date:** 11-Nov-2014
 
 1. Set release to stable in composer.json.
+2. enh #48: Trigger `fileloaded` event when `showPreview` is `false`.
 
 version 2.6.0
 =============

+ 1 - 1
composer.json

@@ -11,7 +11,7 @@
             "homepage": "http://www.krajee.com/"
         }
     ],
-	"minimum-stability": "dev",
+	"minimum-stability": "stable",
     "autoload": {
         "psr-4": {
             "kartik\\plugins\\fileinput\\": ""

+ 7 - 2
examples/index.html

@@ -35,7 +35,7 @@
                     <button class="btn btn-default" type="reset">Reset</button>
                 </div>
                 <div class="form-group">
-                    <input type="file" id="test-upload">
+                    <input type="file" id="test-upload" multiple>
                     <div id="errorBlock" class="help-block"></div>
                 </div>
             </form>
@@ -64,10 +64,15 @@
     });
     $(document).ready(function() {
         $("#test-upload").fileinput({
-            'showPreview' : true,
+            'showPreview' : false,
             'allowedFileExtensions' : ['jpg', 'png','gif'],
             'elErrorContainer': '#errorBlock'
         });
+        /*
+        $("#test-upload").on('fileloaded', function(event, file, previewId, index) {
+            alert('i = ' + index + ', id = ' + previewId + ', file = ' + file.name);
+        });
+        */
     });
 	</script>
 </html>

+ 1 - 0
js/fileinput.js

@@ -587,6 +587,7 @@
                     }
                 }
                 if (!self.showPreview) {
+                    $el.trigger('fileloaded', [file, previewId, i]);
                     setTimeout(readFile(i + 1), 1000);
                     return;
                 }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
js/fileinput.min.js


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio