소스 검색

Icon layout template undefined when using user template

When overriding at least one layout template, the plugin does not load the default layout templates into the layoutTemplates array. In that case, the icon layout is not retrieved correctly in setCaption function since it tries to access the layoutTemplates array instead of using the getLayoutTemplate function.

This issue can be reproduced by setting the layoutTemplates option as follow:
'layoutTemplates' => ['main1' => "{preview}\n<div class=\"kv-upload-progress hide\"></div>\n<div class=\"input-group {class}\">\n{caption}\n<div class=\"input-group-btn\">\n{remove}\n{cancel}\n{upload}\n{browse}\n</div>\n</div>"]
Gaël Wogenstahl 10 년 전
부모
커밋
59c97dcb95
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      js/fileinput.js

+ 2 - 2
js/fileinput.js

@@ -1466,7 +1466,7 @@
         },
         setCaption: function(content) {
             var self = this, title = $('<div>' + content + '</div>').text(),
-                icon = self.layoutTemplates['icon'], 
+                icon = self.getLayoutTemplate('icon'), 
                 out = icon + title;
             if (self.$caption.length == 0) {
                 return;
@@ -1663,4 +1663,4 @@
             $input.fileinput();
         }
     });
-})(window.jQuery);
+})(window.jQuery);