Преглед на файлове

Upgrade to release v4.1.7

Kartik Visweswaran преди 10 години
родител
ревизия
b8555e019c
променени са 8 файла, в които са добавени 468 реда и са изтрити 341 реда
  1. 12 1
      CHANGE.md
  2. 71 4
      README.md
  3. 1 1
      bower.json
  4. 10 1
      css/fileinput.css
  5. 1 1
      css/fileinput.min.css
  6. 1 1
      examples/index.html
  7. 371 331
      js/fileinput.js
  8. 1 1
      js/fileinput.min.js

+ 12 - 1
CHANGE.md

@@ -1,3 +1,14 @@
+version 4.1.7
+=============
+**Date**: 31-Jan-2015
+
+1. (enh #149): Custom tags support for layoutTemplates and previewTemplates (new properties `customLayoutTags` and `customPreviewTags` included).
+2. (enh #151): New `filebatchselected` event triggered after every batch of files are selected.
+3. (enh #152): New faster `replaceAll` method instead of regexp parsing to replace tags in templates.
+4. (enh #153): Improve error handler for trapping FileReader security exceptions and new property `msgFileSecured` will display the security exception message.
+5. (enh #154): Code cleanup and restructure for JS lint changes (using JSHint Code cleanup library).
+6. (enh #155): Allow display of long file names without spaces/word breaks.
+
 version 4.1.6
 =============
 **Date:** 20-Jan-2015
@@ -6,7 +17,7 @@ version 4.1.6
 2. (enh #131): Allow empty values in extra data to be submitted.
 3. (enh #136):Create new upload method that can be called externally.
 4. (enh #137): Trigger new events - `filedisabled` and `fileenabled`.
-4. (enh #139): Reset file stack correctly on ajax upload completion.
+5. (enh #139): Reset file stack correctly on ajax upload completion.
 
 version 4.1.5
 =============

+ 71 - 4
README.md

@@ -7,7 +7,7 @@ The plugin incorporates a simple HTML markup with enhanced CSS styling of a HTML
 
 ![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 v4.1.6 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 v4.1.7 has been released. Refer the [CHANGE LOG](https://github.com/kartik-v/bootstrap-fileinput/blob/master/CHANGE.md) for details. 
 
 ## Features  
 
@@ -483,10 +483,55 @@ This is by default setup as following:
 
 #### allowedPreviewMimeTypes
 
-_array_ the list of allowed mime types for preview. This is set to null by default which means all possible mime types are allowed. This setting works in combination
-with `allowedPreviewTypes` to filter only the needed file types allowed for preview. You can check this [list of allowed mime types](http://www.sitepoint.com/web-foundations/mime-types-complete-list/)
-to add to this list if needed.
+_array_ the list of allowed mime types for preview. This is set to null by default which means all possible mime types are allowed. This setting works in combination with `allowedPreviewTypes` to filter only the needed file types allowed for preview. You can check this [list of allowed mime types](http://www.sitepoint.com/web-foundations/mime-types-complete-list/) to add to this list if needed.
 
+#### customLayoutTags
+
+_object_ the list of additional custom tags that will be replaced in the **layout** templates. This should be an associative array object of `key: value` pairs, where:
+
+- `key`: _string_, is the tag to be replaced and as a standard is recommended to be enclosed between braces.
+- `value`: _string|function_, is the value that will replace the tag key above. This can be setup either as a string or callback function.
+
+For example:
+
+```js
+// example 1 - tags with value set as string
+customLayoutTags: {
+    '{tagA}': '<span class="label label-default">Tag A</span>',
+    '{tagB}': 'Tag B',
+}
+
+// example 2 - tags with value set as callback
+customLayoutTags: {
+    '{tagC}': function() {
+        return $("#element-id").val();
+    }
+}
+```
+
+#### customPreviewTags
+
+_object_ the list of additional custom tags that will be replaced in the **preview** templates. This should be an associative array object of `key: value` pairs, where:
+
+- `key`: _string_, is the tag to be replaced and as a standard is recommended to be enclosed between braces.
+- `value`: _string|function_, is the value that will replace the tag key above. This can be setup either as a string or callback function.
+
+For example:
+
+```js
+// example 1 - tags with value set as string
+customPreviewTags: {
+    '{tagA}': '<span class="label label-default">Tag A</span>',
+    '{tagB}': 'Tag B',
+}
+
+// example 2 - tags with value set as callback
+customPreviewTags: {
+    '{tagC}': function() {
+        return $("#element-id").val();
+    }
+}
+```
 #### previewSettings
 
 _object_ the format settings (width and height) for rendering each preview file type. This is by default setup as following:
@@ -639,6 +684,16 @@ where:
 
 - `{name}`: will be replaced by the file name being uploaded
 
+#### msgFileSecured
+_string_ the exception message to be displayed when the file selected is not allowed to be accessed due to a security exception. Defaults to:
+
+```
+Security restrictions prevent reading the file "{name}".
+```
+where:
+
+- `{name}`: will be replaced by the file name being uploaded
+
 #### msgFileNotReadable
 _string_ the exception message to be displayed when the file selected is not readable by the FileReader API. Defaults to:
 
@@ -917,6 +972,18 @@ $('#input-id').on('filebrowse', function(event) {
 });
 ```
 
+#### filebatchselected
+This event is triggered after a batch of files are selected and displayed in the preview.
+Additional parameters available are: 
+
+- `files`: the file stack array (or empty object if not available).
+
+```js
+$('#input-id').on('filebatchselected', function(event, files) {
+    console.log('File batch selected triggered');
+});
+```
+
 #### fileselectnone
 This event is triggered when no files are selected by the user for a repeat selection scenario (i.e. on a file input that already contains previously selected files). This event is better applicable for browsers like Google Chrome, which clear the file input when the file selection dialog is cancelled. For other browsers, this event is typically triggered only when one resets the form or clears file input (using the remove button).
 

+ 1 - 1
bower.json

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

+ 10 - 1
css/fileinput.css

@@ -1,7 +1,7 @@
 /*!
  * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015
  * @package bootstrap-fileinput
- * @version 4.1.6
+ * @version 4.1.7
  *
  * File input styling for Bootstrap 3.0
  * Built for Yii Framework 2.0
@@ -56,6 +56,7 @@
     overflow: hidden;
     max-height: 20px;
     padding-right: 10px;
+    word-break: break-all;
 }
 
 .file-caption-ellipsis {
@@ -68,6 +69,14 @@
     cursor: default;
 }
 
+.kv-has-ellipsis .file-caption-ellipsis {
+    display: inline;
+}
+
+.kv-has-ellipsis {
+    padding-right: 17px;
+}
+
 .kv-search-container .kv-search-clear {
     position: absolute;
     padding: 10px;

Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
css/fileinput.min.css


+ 1 - 1
examples/index.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<!-- release v4.1.6, copyright 2015 Kartik Visweswaran -->
+<!-- release v4.1.7, copyright 2015 Kartik Visweswaran -->
 <html lang="en">
     <head>
         <meta charset="UTF-8"/>

Файловите разлики са ограничени, защото са твърде много
+ 371 - 331
js/fileinput.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
js/fileinput.min.js


Някои файлове не бяха показани, защото твърде много файлове са промени