Ver Fonte

Namespace.template: markup & html

soyjavi há 14 anos atrás
pai
commit
0efdaae754
1 ficheiros alterados com 17 adições e 6 exclusões
  1. 17 6
      src/view/Lungo.View.Template.js

+ 17 - 6
src/view/Lungo.View.Template.js

@@ -61,11 +61,8 @@ LUNGO.View.Template = (function(lng, undefined) {
      */
      */
     var render = function(element, template_id, data) {
     var render = function(element, template_id, data) {
         if (lng.View.Template.exists(template_id)) {
         if (lng.View.Template.exists(template_id)) {
-            var template_markup = this.get(template_id);
-            var markup = lng.View.Template.process(template_markup, data);
-
             var container = lng.dom(element);
             var container = lng.dom(element);
-            container.html(markup);
+            container.html(this.markup(template_id, data));
         } else {
         } else {
             lng.Core.log(3, ERROR.BINDING_TEMPLATE + template_id);
             lng.Core.log(3, ERROR.BINDING_TEMPLATE + template_id);
         }
         }
@@ -76,10 +73,23 @@ LUNGO.View.Template = (function(lng, undefined) {
      *
      *
      * @method markup
      * @method markup
      *
      *
+     * @param {String} Databinding Template Id
+     * @param {Object} Data for binding
+     */
+    var markup = function(template_id, data) {
+        var template_markup = this.get(template_id);
+        return lng.View.Template.process(template_markup, data);
+    };
+
+    /**
+     * Performs databinding process for a data set and a given html
+     *
+     * @method html
+     *
      * @param {String} Markup for binding
      * @param {String} Markup for binding
      * @param {Object} Data for binding
      * @param {Object} Data for binding
      */
      */
-    var markup = function(markup, data) {
+    var html = function(markup, data) {
         return lng.View.Template.process(markup, data);
         return lng.View.Template.process(markup, data);
     };
     };
 
 
@@ -88,7 +98,8 @@ LUNGO.View.Template = (function(lng, undefined) {
         exists: exists,
         exists: exists,
         get: get,
         get: get,
         render: render,
         render: render,
-        markup: markup
+        markup: markup,
+        html: html
     };
     };
 
 
 })(LUNGO);
 })(LUNGO);