2
0
Эх сурвалжийг харах

Need to configure _.templateSettings in converse.js

The tpl configuration in main.js is only for externally loaded templates, if we
use inline templates (as is the case with the room invite feature), we need to
configure _.templateSettings as well.
JC Brand 10 жил өмнө
parent
commit
9b0f701893
2 өөрчлөгдсөн 10 нэмэгдсэн , 0 устгасан
  1. 9 0
      converse.js
  2. 1 0
      main.js

+ 9 - 0
converse.js

@@ -31,6 +31,15 @@
     if (typeof console === "undefined" || typeof console.log === "undefined") {
     if (typeof console === "undefined" || typeof console.log === "undefined") {
         console = { log: function () {}, error: function () {} };
         console = { log: function () {}, error: function () {} };
     }
     }
+    
+    // Configuration of underscore templates (this config is distict to the
+    // config of requirejs-tpl in main.js). This one is for normal inline
+    // templates.
+    // Use Mustache style syntax for variable interpolation
+    _.templateSettings = {
+        evaluate : /\{\[([\s\S]+?)\]\}/g,
+        interpolate : /\{\{([\s\S]+?)\}\}/g
+    };
 
 
     // TODO: these non-backbone methods should all be moved to utils.
     // TODO: these non-backbone methods should all be moved to utils.
     $.fn.addHyperlinks = function() {
     $.fn.addHyperlinks = function() {

+ 1 - 0
main.js

@@ -104,6 +104,7 @@ config = {
     },
     },
 
 
     tpl: {
     tpl: {
+        // Configuration for requirejs-tpl
         // Use Mustache style syntax for variable interpolation
         // Use Mustache style syntax for variable interpolation
         templateSettings: {
         templateSettings: {
             evaluate : /\{\[([\s\S]+?)\]\}/g,
             evaluate : /\{\[([\s\S]+?)\]\}/g,