瀏覽代碼

Fix #462: Responsive buttons and new property `buttonLabelClass`

Kartik Visweswaran 9 年之前
父節點
當前提交
629ec209db
共有 3 個文件被更改,包括 11 次插入4 次删除
  1. 3 0
      README.md
  2. 8 4
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 3 - 0
README.md

@@ -188,6 +188,9 @@ _boolean_ whether to persist display of the uploaded file thumbnails in the prev
 ### autoReplace
 _boolean_ whether to automatically replace the files in the preview after the `maxFileCount` limit is reached and a new set of file(s) is/are selected. This will only work if a valid  `maxFileCount` is set. Defaults to `false`.
 
+### buttonLabelClass
+_string_ CSS class to be set for the button labels (i.e. browse, remove, upload, and cancel). Defaults to `hidden-xs`, whereby labels are hidden for small screen devices.
+
 ### captionClass
 _string_ any additional CSS class to append to the caption container.
 

+ 8 - 4
js/fileinput.js

@@ -2490,6 +2490,9 @@
                     return '';
             }
             css += type === 'browse' ? ' btn-file' : ' fileinput-' + type + ' fileinput-' + type + '-button';
+            if (!isEmpty(label)) {
+                label = ' <span class="' + self.buttonLabelClass + '">' + label + '</span>';
+            }
             return tmplt.replace('{type}', btnType)
                 .replace('{css}', css)
                 .replace('{title}', title)
@@ -2574,13 +2577,14 @@
         previewFileIconClass: 'file-icon-4x',
         previewFileIconSettings: {},
         previewFileExtSettings: {},
-        browseIcon: '<i class="glyphicon glyphicon-folder-open"></i> &nbsp;',
+        buttonLabelClass: 'hidden-xs',
+        browseIcon: '<i class="glyphicon glyphicon-folder-open"></i>',
         browseClass: 'btn btn-primary',
-        removeIcon: '<i class="glyphicon glyphicon-trash"></i> ',
+        removeIcon: '<i class="glyphicon glyphicon-trash"></i>',
         removeClass: 'btn btn-default',
-        cancelIcon: '<i class="glyphicon glyphicon-ban-circle"></i> ',
+        cancelIcon: '<i class="glyphicon glyphicon-ban-circle"></i>',
         cancelClass: 'btn btn-default',
-        uploadIcon: '<i class="glyphicon glyphicon-upload"></i> ',
+        uploadIcon: '<i class="glyphicon glyphicon-upload"></i>',
         uploadClass: 'btn btn-default',
         uploadUrl: null,
         uploadAsync: true,

文件差異過大導致無法顯示
+ 0 - 0
js/fileinput.min.js


部分文件因文件數量過多而無法顯示