Browse Source

Fix #60: Enhance upload button for disable/enable when used with `<a>` tag

Kartik Visweswaran 10 years ago
parent
commit
d66e684fd3
6 changed files with 13 additions and 5 deletions
  1. 7 0
      CHANGE.md
  2. 1 1
      README.md
  3. 1 1
      bower.json
  4. 1 1
      examples/index.html
  5. 3 2
      js/fileinput.js
  6. 0 0
      js/fileinput.min.js

+ 7 - 0
CHANGE.md

@@ -1,3 +1,10 @@
+version 2.9.1
+=============
+**Date:** 01-Dec-2014
+
+1. (enh #60): Enhance upload button for disable/enable when used with `<a>` tag.
+
+
 version 2.9.0
 =============
 **Date:** 23-Nov-2014

+ 1 - 1
README.md

@@ -7,7 +7,7 @@ wide variety of files i.e. images, text, html, video, audio, flash, and objects.
 
 ![File Input Screenshot](https://lh3.googleusercontent.com/-3FiEmc_okc4/VBw_d2LBAJI/AAAAAAAAAL8/KbVj5X9Dus0/w596-h454-no/FileInput.jpg)
 
-> NOTE: The latest version of the plugin v2.9.0 has been released. Refer the [CHANGE LOG](https://github.com/kartik-v/bootstrap-fileinput/blob/master/CHANGE.md) for details.
+> NOTE: The latest version of the plugin v2.9.1 has been released. Refer the [CHANGE LOG](https://github.com/kartik-v/bootstrap-fileinput/blob/master/CHANGE.md) for details.
 
 ## Features  
 

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
     "name": "bootstrap-fileinput",
-    "version": "2.9.0",
+    "version": "2.9.1",
     "homepage": "https://github.com/kartik-v/bootstrap-fileinput",
     "authors": [
         "Kartik Visweswaran <[email protected]>"

+ 1 - 1
examples/index.html

@@ -27,7 +27,7 @@
                     <input id="file-3" type="file" multiple=true>
                 </div>
                 <div class="form-group">
-                    <input id="file-4" type="file" class="file">
+                    <input id="file-4" type="file" class="file" data-upload-url="http://plugins.krajee.com/test">
                 </div>
                 <div class="form-group">
                     <button class="btn btn-warning" type="button">Disable Test</button>

+ 3 - 2
js/fileinput.js

@@ -286,6 +286,7 @@
         listen: function () {
             var self = this, $el = self.$element, $cap = self.$captionContainer, $btnFile = self.$btnFile;
             $el.on('change', $.proxy(self.change, self));
+            
             $(window).on('resize', function() {
                 setTimeout(function() {
                     self.autoSizeCaption();
@@ -784,10 +785,10 @@
             if (self.isDisabled) {
                 status = ' disabled ';
             }
-            if (isEmpty(self.uploadUrl)) {
+            if (isEmpty(self.uploadUrl) || self.isDisabled) {
                 content = '<button type="submit" class="' + css + '"' + status + '>' + self.uploadIcon + self.uploadLabel + '</button>';
             } else {
-                content = '<a href="' + self.uploadUrl + '" class="' + self.uploadClass + '"' + status + '>' + self.uploadIcon + self.uploadLabel + '</a>';
+                content = '<a href="' + self.uploadUrl + '" class="' + css + '"' + status + '>' + self.uploadIcon + self.uploadLabel + '</a>';
             }
             return content;
         }

File diff suppressed because it is too large
+ 0 - 0
js/fileinput.min.js


Some files were not shown because too many files changed in this diff