From 1524f0899ab0cb1c40e8cfe4639f2c5b09d37a76 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Fri, 18 Jan 2013 13:06:34 +0000 Subject: [PATCH] Move control.handlebars template to default JavaScript application --- src/messenger/build.xml | 23 ++++++++++++++++++- src/messenger/webim/js/compiled/chat_app.js | 2 +- .../compiled/default/model_views/control.js | 2 +- .../webim/js/compiled/default_app.js | 4 ++-- .../js/source/default/model_views/control.js | 2 +- .../js/templates/compiled/default_app.tpl.js | 1 + .../default/default_control.handlebars} | 0 7 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 src/messenger/webim/js/templates/compiled/default_app.tpl.js rename src/messenger/webim/{styles/dialogs/silver/handlebars_templates/control.handlebars => js/templates/source/default/default_control.handlebars} (100%) diff --git a/src/messenger/build.xml b/src/messenger/build.xml index bf5201f1..37388d9a 100644 --- a/src/messenger/build.xml +++ b/src/messenger/build.xml @@ -129,14 +129,22 @@ - + Build "${app_name}" JavaScript application + + + + + + ; + @@ -255,6 +263,18 @@ Compile Handlebars templates of the Core + + + + + + + + + + + + @@ -264,6 +284,7 @@ + Done diff --git a/src/messenger/webim/js/compiled/chat_app.js b/src/messenger/webim/js/compiled/chat_app.js index 282b22ab..4ce02eb4 100644 --- a/src/messenger/webim/js/compiled/chat_app.js +++ b/src/messenger/webim/js/compiled/chat_app.js @@ -5,7 +5,7 @@ License: http://mibew.org/license.php */ (function(a){a.Regions={};a.Objects.Models.Controls={};a.Objects.Models.Status={}})(Mibew); -(function(b){b.registerHelper("allowTags",function(a){a=a.replace(/<(span|strong)>(.*?)<\/\1>/g,"<$1>$2");a=a.replace(/<span class="(.*?)">(.*?)<\/span>/g,'$2');return new b.SafeString(a)})})(Handlebars); +;(function(b){b.registerHelper("allowTags",function(a){a=a.replace(/<(span|strong)>(.*?)<\/\1>/g,"<$1>$2");a=a.replace(/<span class="(.*?)">(.*?)<\/span>/g,'$2');return new b.SafeString(a)})})(Handlebars); MibewAPIChatInteraction=function(){this.obligatoryArguments={"*":{threadId:null,token:null,"return":{},references:{}},result:{errorCode:0}};this.reservedFunctionNames=["result"]};MibewAPIChatInteraction.prototype=new MibewAPIInteraction; (function(b,c){b.Models.Status=b.Models.Base.extend({defaults:{visible:!0,weight:0,hideTimeout:4E3,title:""},initialize:function(){this.hideTimer=null},autoHide:function(a){a=a||this.get("hideTimeout");this.hideTimer&&clearTimeout(this.hideTimer);this.hideTimer=setTimeout(c.bind(function(){this.set({visible:!1})},this),a)}})})(Mibew,_); (function(a,b){a.Models.Avatar=a.Models.Base.extend({defaults:{imageLink:!1},initialize:function(){a.Objects.server.registerFunction("setupAvatar",b.bind(this.apiSetupAvatar,this))},apiSetupAvatar:function(a){a.imageLink&&this.set({imageLink:a.imageLink})}})})(Mibew,_); diff --git a/src/messenger/webim/js/compiled/default/model_views/control.js b/src/messenger/webim/js/compiled/default/model_views/control.js index 21aaa4ae..c7616a18 100644 --- a/src/messenger/webim/js/compiled/default/model_views/control.js +++ b/src/messenger/webim/js/compiled/default/model_views/control.js @@ -5,5 +5,5 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(b,c,d){b.Views.Control=c.Marionette.ItemView.extend({template:d.templates.control,modelEvents:{change:"render"},events:{mouseover:"mouseOver",mouseleave:"mouseLeave"},attributes:function(){var a=[];a.push("control");this.className&&(a.push(this.className),this.className="");var b=this.getDashedControlType();b&&a.push(b);return{"class":a.join(" ")}},mouseOver:function(){var a=this.getDashedControlType();this.$el.addClass("active"+(a?"-"+a:""))},mouseLeave:function(){var a=this.getDashedControlType(); +(function(b,c,d){b.Views.Control=c.Marionette.ItemView.extend({template:d.templates.default_control,modelEvents:{change:"render"},events:{mouseover:"mouseOver",mouseleave:"mouseLeave"},attributes:function(){var a=[];a.push("control");this.className&&(a.push(this.className),this.className="");var b=this.getDashedControlType();b&&a.push(b);return{"class":a.join(" ")}},mouseOver:function(){var a=this.getDashedControlType();this.$el.addClass("active"+(a?"-"+a:""))},mouseLeave:function(){var a=this.getDashedControlType(); this.$el.removeClass("active"+(a?"-"+a:""))},getDashedControlType:function(){"undefined"==typeof this.dashedControlType&&(this.dashedControlType=b.Utils.toDashFormat(this.model.getModelType())||"");return this.dashedControlType}})})(Mibew,Backbone,Handlebars); diff --git a/src/messenger/webim/js/compiled/default_app.js b/src/messenger/webim/js/compiled/default_app.js index cdb52642..93bce77a 100644 --- a/src/messenger/webim/js/compiled/default_app.js +++ b/src/messenger/webim/js/compiled/default_app.js @@ -5,7 +5,7 @@ License: http://mibew.org/license.php */ var Mibew={};(function(a,b){b.Marionette.TemplateCache.prototype.compileTemplate=function(a){return Handlebars.compile(a)};a.Models={};a.Collections={};a.Views={};a.Objects={};a.Objects.Models={};a.Objects.Collections={}})(Mibew,Backbone); -(function(e,a){a.registerHelper("apply",function(c,b){var f=c,e=/^[0-9A-z_]+$/;b=b.split(/\s*,\s*/);for(var d in b)if(b.hasOwnProperty(d)&&e.test(b[d])){if("function"!=typeof a.helpers[b[d]])throw Error("Unregistered helper '"+b[d]+"'!");f=a.helpers[b[d]](f).toString()}return new a.SafeString(f)});a.registerHelper("formatTime",function(c){var b=new Date(1E3*c);c=b.getHours().toString();var a=b.getMinutes().toString(),b=b.getSeconds().toString();return(10",f})})();(function(e,a){a.registerHelper("apply",function(c,b){var f=c,e=/^[0-9A-z_]+$/;b=b.split(/\s*,\s*/);for(var d in b)if(b.hasOwnProperty(d)&&e.test(b[d])){if("function"!=typeof a.helpers[b[d]])throw Error("Unregistered helper '"+b[d]+"'!");f=a.helpers[b[d]](f).toString()}return new a.SafeString(f)});a.registerHelper("formatTime",function(c){var b=new Date(1E3*c);c=b.getHours().toString();var a=b.getMinutes().toString(),b=b.getSeconds().toString();return(10$1'))});a.registerHelper("nl2br",function(c){return new a.SafeString(c.replace(/\n/g,"
"))});a.registerHelper("L10n",function(a){return e.Localization.get(a)||""})})(Mibew,Handlebars); (function(b,d){b.Localization={};var c={};b.Localization.get=function(a){return!c.hasOwnProperty(a)?!1:c[a]};b.Localization.set=function(a){d.extend(c,a)}})(Mibew,_); (function(b,f,g,c){b.Server=function(a){this.updateTimer=null;this.options=c.extend({url:"",requestsFrequency:2,reconnectPause:1,onTimeout:function(){},onTransportError:function(){},onCallError:function(){},onUpdateError:function(){},onResponseError:function(){}},a);this.callbacks={};this.callPeriodically=[];this.ajaxRequest=null;this.buffer=[];this.functions={};this.mibewAPI=new f(new this.options.interactionType)};b.Server.prototype.callFunctions=function(a,e,b){try{if(!(a instanceof Array))throw Error("The first arguments must be an array"); @@ -23,7 +23,7 @@ b.Server.prototype.registerFunction=function(a,b){a in this.functions||(this.fun (function(a,b){a.Models.Sound=b.Model.extend({play:function(a){this.set({file:a});this.trigger("sound:play",this)}})})(Mibew,Backbone); (function(a,b){a.Models.User=b.Model.extend({defaults:{isAgent:!1,canPost:!0,typing:!1,name:"",canChangeName:!1,dafaultName:!0}})})(Mibew,Backbone); (function(a,b){a.Collections.Controls=b.Collection.extend({comparator:function(a){return a.get("weight")}})})(Mibew,Backbone); -(function(b,c,d){b.Views.Control=c.Marionette.ItemView.extend({template:d.templates.control,modelEvents:{change:"render"},events:{mouseover:"mouseOver",mouseleave:"mouseLeave"},attributes:function(){var a=[];a.push("control");this.className&&(a.push(this.className),this.className="");var b=this.getDashedControlType();b&&a.push(b);return{"class":a.join(" ")}},mouseOver:function(){var a=this.getDashedControlType();this.$el.addClass("active"+(a?"-"+a:""))},mouseLeave:function(){var a=this.getDashedControlType(); +(function(b,c,d){b.Views.Control=c.Marionette.ItemView.extend({template:d.templates.default_control,modelEvents:{change:"render"},events:{mouseover:"mouseOver",mouseleave:"mouseLeave"},attributes:function(){var a=[];a.push("control");this.className&&(a.push(this.className),this.className="");var b=this.getDashedControlType();b&&a.push(b);return{"class":a.join(" ")}},mouseOver:function(){var a=this.getDashedControlType();this.$el.addClass("active"+(a?"-"+a:""))},mouseLeave:function(){var a=this.getDashedControlType(); this.$el.removeClass("active"+(a?"-"+a:""))},getDashedControlType:function(){"undefined"==typeof this.dashedControlType&&(this.dashedControlType=b.Utils.toDashFormat(this.model.getModelType())||"");return this.dashedControlType}})})(Mibew,Backbone,Handlebars); (function(a,b,c){a.Views.Sound=b.Marionette.ItemView.extend({template:c.templates.sound,className:"sound-player",modelEvents:{"sound:play":"render"}})})(Mibew,Backbone,Handlebars); (function(d,b,e){d.Views.CollectionBase=b.Marionette.CollectionView.extend({itemView:b.Marionette.ItemView,buildItemView:function(a,b,c){c=e.extend({model:a},c);return(a=a.getModelType())&&d.Views[a]?new d.Views[a](c):new b(c)}})})(Mibew,Backbone,_); diff --git a/src/messenger/webim/js/source/default/model_views/control.js b/src/messenger/webim/js/source/default/model_views/control.js index f37d37b7..6bb7cae8 100644 --- a/src/messenger/webim/js/source/default/model_views/control.js +++ b/src/messenger/webim/js/source/default/model_views/control.js @@ -18,7 +18,7 @@ * Template function * @type Function */ - template: Handlebars.templates.control, + template: Handlebars.templates.default_control, /** * Map model events to the view methods diff --git a/src/messenger/webim/js/templates/compiled/default_app.tpl.js b/src/messenger/webim/js/templates/compiled/default_app.tpl.js new file mode 100644 index 00000000..f26b7da4 --- /dev/null +++ b/src/messenger/webim/js/templates/compiled/default_app.tpl.js @@ -0,0 +1 @@ +(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.default_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i="function",j=this.escapeExpression;return f+="",h=c.title,h?g=h.call(b,{hash:{}}):(g=b.title,g=typeof g===i?g():g),f+=j(g)+"",f})})() \ No newline at end of file diff --git a/src/messenger/webim/styles/dialogs/silver/handlebars_templates/control.handlebars b/src/messenger/webim/js/templates/source/default/default_control.handlebars similarity index 100% rename from src/messenger/webim/styles/dialogs/silver/handlebars_templates/control.handlebars rename to src/messenger/webim/js/templates/source/default/default_control.handlebars