Quellcode durchsuchen

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

Kartik Visweswaran vor 9 Jahren
Ursprung
Commit
629ec209db
3 geänderte Dateien mit 11 neuen und 4 gelöschten Zeilen
  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,

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
js/fileinput.min.js


Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.