diff --git a/bower.json b/bower.json index f58991d20..09d0394b3 100644 --- a/bower.json +++ b/bower.json @@ -3,7 +3,9 @@ "version": "0.7.2", "devDependencies": { "jasmine": "https://github.com/jcbrand/jasmine.git#1_3_x", - "otr": "0.2.7" + "otr": "0.2.7", + "requirejs-text": "~2.0.10", + "requirejs-tpl-jfparadis": "*" }, "dependencies": { "requirejs": "2.1.8", @@ -20,7 +22,9 @@ "strophe.muc": "https://raw.github.com/strophe/strophejs-plugins/02310ad1b8da2962cd05b0f4bceaecca134efed4/muc/strophe.muc.js", "otr": "0.2.7", "crypto-js": "~3.1.2", - "almond": "~0.2.6" + "almond": "~0.2.6", + "requirejs-text": "~2.0.10", + "requirejs-tpl-jfparadis": "*" }, "exportsOverride": {} } diff --git a/converse.js b/converse.js index 3a87d609c..6eb38ed6e 100644 --- a/converse.js +++ b/converse.js @@ -12,27 +12,26 @@ console = { log: function () {}, error: function () {} }; } if (typeof define === 'function' && define.amd) { - define("converse", ["converse-dependencies"], function(otr) { - // Use Mustache style syntax for variable interpolation - _.templateSettings = { - evaluate : /\{\[([\s\S]+?)\]\}/g, - interpolate : /\{\{([\s\S]+?)\}\}/g - }; - if (typeof otr !== "undefined") { - return factory(jQuery, _, otr.OTR, otr.DSA, console); - } else { - return factory(jQuery, _, undefined, undefined, console); + define("converse", + ["converse-dependencies", "converse-templates"], + function(otr, templates) { + if (typeof otr !== "undefined") { + return factory(jQuery, _, otr.OTR, otr.DSA, console, templates); + } else { + return factory(jQuery, _, undefined, undefined, console, templates); + } } - }); + ); } else { // Browser globals + // FIXME _.templateSettings = { evaluate : /\{\[([\s\S]+?)\]\}/g, interpolate : /\{\{([\s\S]+?)\}\}/g }; root.converse = factory(jQuery, _, OTR, DSA, console || {log: function(){}}); } -}(this, function ($, _, OTR, DSA, console) { +}(this, function ($, _, OTR, DSA, console, templates) { $.fn.addHyperlinks = function() { if (this.length > 0) { this.each(function(i, obj) { @@ -86,6 +85,7 @@ }; var converse = { + templates: templates, emit: function(evt, data) { $(this).trigger(evt, data); }, @@ -731,99 +731,6 @@ 'click .toggle-call': 'toggleCall' }, - template: _.template( - '
' + - '' + - '' + - '
{{ fullname }}
' + - '
' + - '

' + - '

' + - '
' + - '
' + - '{[ if ('+converse.show_toolbar+') { ]}' + - ''+ - '{[ } ]}' + - '