From 5011b0dcc2c35a0213e0a15a2143d890d00e012a Mon Sep 17 00:00:00 2001
From: codepb
Date: Tue, 2 Jun 2015 08:59:10 +0100
Subject: [PATCH 01/25] Update readme.md to include documentation on async
---
readme.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/readme.md b/readme.md
index 5267759..7ed4472 100644
--- a/readme.md
+++ b/readme.md
@@ -134,6 +134,7 @@ There are a number of options the plugin accepts. These can be set by passing an
The full list of options are:
- "overwriteCache" (default false) - Whether to ignore the cache and reload the template (if you've previously loaded the template, but it might have changed, you'll want to set this to true.
+- "async" (default true) - Whether to load templates asynchronously (if templates require an Ajax call)
- "complete" (default null) - Callback function to call on complete. Will always be called regardless of success or failure.
- "success" (default null) - Callback function to call on successful completion.
- "error" (default, outputting error message to template container) - Callback function to call on error.
From 312cc023d312081430c79ce63f26a59be39fcb63 Mon Sep 17 00:00:00 2001
From: Paul Burgess
Date: Thu, 3 Sep 2015 15:38:31 +0100
Subject: [PATCH 02/25] beforeInsert/afterInsert callbacks and error info
additions
Added the data to beforeInsert and afterInsert callbacks: fixes #69.
Updated the error callback to add in the error coming from the ajax
call. fixes #67.
---
Examples/SimpleExample/example.html | 2 +-
Examples/index.html | 2 +-
bower.json | 2 +-
.../jquery.loadTemplate-1.4.5.min.js | 1 -
...-1.4.5.js => jquery.loadTemplate-1.5.0.js} | 27 ++++++++++---------
.../jquery.loadTemplate-1.5.0.min.js | 1 +
loadTemplate.jquery.json | 2 +-
tests/index.html | 2 +-
8 files changed, 21 insertions(+), 18 deletions(-)
delete mode 100644 jquery-loadTemplate/jquery.loadTemplate-1.4.5.min.js
rename jquery-loadTemplate/{jquery.loadTemplate-1.4.5.js => jquery.loadTemplate-1.5.0.js} (97%)
create mode 100644 jquery-loadTemplate/jquery.loadTemplate-1.5.0.min.js
diff --git a/Examples/SimpleExample/example.html b/Examples/SimpleExample/example.html
index 6f77930..d5fc7a4 100644
--- a/Examples/SimpleExample/example.html
+++ b/Examples/SimpleExample/example.html
@@ -88,7 +88,7 @@
Example of loading a template from a script tag within the same document.
-
+
diff --git a/bower.json b/bower.json
index 01af15b..b33029b 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "jquery-load-template",
- "version": "1.4.5",
+ "version": "1.5.0",
"authors": [
{ "name": "Paul Burgess"}
],
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.4.5.min.js b/jquery-loadTemplate/jquery.loadTemplate-1.4.5.min.js
deleted file mode 100644
index 64dab52..0000000
--- a/jquery-loadTemplate/jquery.loadTemplate-1.4.5.min.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(a){var v={},u={},h={};function n(F,B,D){var A=this,z,C,E;B=B||{};E=a.extend(true,{async:true,overwriteCache:false,complete:null,success:null,error:function(){a(this).each(function(){a(this).html(E.errorMessage)})},errorMessage:"There was an error loading the template.",paged:false,pageNo:1,elemPerPage:10,append:false,prepend:false,beforeInsert:null,afterInsert:null,bindingOptions:{ignoreUndefined:false,ignoreNull:false,ignoreEmptyString:false}},D);if(a.type(B)==="array"){return s.call(this,F,B,E)}if(!g(F)){z=a(F);if(typeof F==="string"&&F.indexOf("#")===0){E.isFile=false}}C=E.isFile||(typeof E.isFile==="undefined"&&(typeof z==="undefined"||z.length===0));if(C&&!E.overwriteCache&&v[F]){q(F,A,B,E)}else{if(C&&!E.overwriteCache&&v.hasOwnProperty(F)){c(F,A,B,E)}else{if(C){m(F,A,B,E)}else{o(z,A,B,E)}}}return this}function b(A,z){if(z){h[A]=z}else{h=a.extend(h,A)}}function g(z){return typeof z==="string"&&z.indexOf("/")>-1}function s(I,A,F){F=F||{};var z=this,J=A.length,C=F.prepend&&!F.append,B=0,H=0,D=false,E;if(F.paged){var G=(F.pageNo-1)*F.elemPerPage;A=A.slice(G,G+F.elemPerPage);J=A.length}E=a.extend({},F,{complete:function(){if(this.html){if(C){z.prepend(this.html())}else{z.append(this.html())}}B++;if(B===J||D){if(D&&F&&typeof F.error==="function"){F.error.call(z)}if(F&&typeof F.complete==="function"){F.complete()}}},success:function(){H++;if(H===J){if(F&&typeof F.success==="function"){F.success()}}},error:function(){D=true}});if(!F.append&&!F.prepend){z.html("")}if(C){A.reverse()}a(A).each(function(){var K=a("");n.call(K,I,this,E);if(D){return false}});return this}function c(C,A,z,B){if(u[C]){u[C].push({data:z,selection:A,settings:B})}else{u[C]=[{data:z,selection:A,settings:B}]}}function q(D,B,A,C){var z=v[D].clone();p.call(B,z,A,C);if(typeof C.success==="function"){C.success()}}function w(){return new Date().getTime()}function x(z){if(z.indexOf("?")!==-1){return z+"&_="+w()}else{return z+"?_="+w()}}function m(D,B,A,C){var z=a("");v[D]=null;var E=D;if(C.overwriteCache){E=x(E)}a.ajax({url:E,async:C.async,success:function(F){z.html(F);l(z,D,B,A,C)},error:function(){k(D,B,A,C)}})}function o(z,C,B,D){var A=a("");if(z.is("script")||z.is("template")){z=a.parseHTML(a.trim(z.html()))}A.html(z);p.call(C,A,B,D);if(typeof D.success==="function"){D.success()}}function p(B,z,A){f(B,z,A);a(this).each(function(){var C=a(B.html());if(A.beforeInsert){A.beforeInsert(C)}if(A.append){a(this).append(C)}else{if(A.prepend){a(this).prepend(C)}else{a(this).html(C)}}if(A.afterInsert){A.afterInsert(C)}});if(typeof A.complete==="function"){A.complete.call(a(this))}}function k(C,A,z,B){var D;if(typeof B.error==="function"){B.error.call(A)}a(u[C]).each(function(E,F){if(typeof F.settings.error==="function"){F.settings.error.call(F.selection)}});if(typeof B.complete==="function"){B.complete.call(A)}while(u[C]&&(D=u[C].shift())){if(typeof D.settings.complete==="function"){D.settings.complete.call(D.selection)}}if(typeof u[C]!=="undefined"&&u[C].length>0){u[C]=[]}}function l(z,D,B,A,C){var E;v[D]=z.clone();p.call(B,z,A,C);if(typeof C.success==="function"){C.success.call(B)}while(u[D]&&(E=u[D].shift())){p.call(E.selection,v[D].clone(),E.data,E.settings);if(typeof E.settings.success==="function"){E.settings.success.call(E.selection)}}}function f(B,z,A){z=z||{};t("data-content",B,z,A,function(C,D){C.html(e(C,D,"content",A))});t("data-content-append",B,z,A,function(C,D){C.append(e(C,D,"content",A))});t("data-content-prepend",B,z,A,function(C,D){C.prepend(e(C,D,"content",A))});t("data-content-text",B,z,A,function(C,D){C.text(e(C,D,"content",A))});t("data-innerHTML",B,z,A,function(C,D){C.html(e(C,D,"content",A))});t("data-src",B,z,A,function(C,D){C.attr("src",e(C,D,"src",A))},function(C){C.remove()});t("data-href",B,z,A,function(C,D){C.attr("href",e(C,D,"href",A))},function(C){C.remove()});t("data-alt",B,z,A,function(C,D){C.attr("alt",e(C,D,"alt",A))});t("data-id",B,z,A,function(C,D){C.attr("id",e(C,D,"id",A))});t("data-value",B,z,A,function(C,D){C.attr("value",e(C,D,"value",A))});t("data-class",B,z,A,function(C,D){C.addClass(e(C,D,"class",A))});t("data-link",B,z,A,function(C,E){var D=a("");D.attr("href",e(C,E,"link",A));D.html(C.html());C.html(D)});t("data-link-wrap",B,z,A,function(C,E){var D=a("");D.attr("href",e(C,E,"link-wrap",A));C.wrap(D)});t("data-options",B,z,A,function(C,D){a(D).each(function(){var E=a("");E.attr("value",this).text(this).appendTo(C)})});r(B,z,A)}function t(z,E,A,D,B,C){a("["+z+"]",E).each(function(){var F=a(this),G=F.attr(z),H=j(A,G);if(!y(F,H,D)){F.remove();return}F.removeAttr(z);if(typeof H!=="undefined"&&B){B(F,H)}else{if(C){C(F)}}});return}function y(A,C,B){var z=i(A,B);if(z.ignoreUndefined&&typeof C==="undefined"){return false}else{if(z.ignoreNull&&C===null){return false}else{if(z.ignoreEmptyString&&C===""){return false}else{return true}}}}function i(A,B){var z={};if(A instanceof jQuery&&A.attr("data-binding-options")){z=a.parseJSON(A.attr("data-binding-options"));A.removeAttr("data-binding-options")}else{if(typeof A==="object"&&A.hasOwnProperty("bindingOptions")){z=A.bindingOptions}}return a.extend({},B.bindingOptions,z)}function r(B,z,A){a("[data-template-bind]",B).each(function(){var C=a(this),D=a.parseJSON(C.attr("data-template-bind"));C.removeAttr("data-template-bind");a(D).each(function(){var F;if(typeof(this.value)==="object"){F=j(z,this.value.data)}else{F=j(z,this.value)}if(this.attribute){if(!y(this,F,A)){C.remove();return}switch(this.attribute){case"content":case"innerHTML":C.html(d(C,F,this));break;case"contentAppend":C.append(d(C,F,this));break;case"contentPrepend":C.prepend(d(C,F,this));break;case"contentText":C.text(d(C,F,this));break;case"options":var E=this;a(F).each(function(){var G=a("");G.attr("value",this[E.value.value]).text(d(C,this[E.value.content],E)).attr("selected",typeof this[E.value.selected]==undefined?false:this[E.value.selected]).appendTo(C)});break;default:C.attr(this.attribute,d(C,F,this))}}})})}function d(z,C,A,B){if(A.formatter&&h[A.formatter]){return(function(D){return h[A.formatter].call(z,C,A.formatOptions,D)})(B)}return C}function j(z,A){if(A==="this"){return z}var B=A.split("."),C,D=z;while((C=B.shift())&&typeof D!=="undefined"&&D!=null){D=D[C]}return D}function e(z,F,A,E){var D=z.attr("data-format-target"),C;if(D===A||(!D&&A==="content")){C=z.attr("data-format");if(C&&typeof h[C]==="function"){var B=z.attr("data-format-options");return(function(G){return h[C].call(z[0],F,B,a.extend({},G))})(E)}}return F}b("nestedTemplateFormatter",function(D,A,z){if(!A){return}if(typeof A==="string"&&A[0]==="{"){A=a.parseJSON(A)}var B=A.parentElement||"div";var C=A.template||A;if(A.parentElement){return a("<"+B+"/>").loadTemplate(C,D,z)}else{return a("<"+B+"/>").loadTemplate(C,D,z).children()}});a.fn.loadTemplate=n;a.addTemplateFormatter=b})(jQuery);
\ No newline at end of file
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.4.5.js b/jquery-loadTemplate/jquery.loadTemplate-1.5.0.js
similarity index 97%
rename from jquery-loadTemplate/jquery.loadTemplate-1.4.5.js
rename to jquery-loadTemplate/jquery.loadTemplate-1.5.0.js
index 46275a8..209cfa3 100644
--- a/jquery-loadTemplate/jquery.loadTemplate-1.4.5.js
+++ b/jquery-loadTemplate/jquery.loadTemplate-1.5.0.js
@@ -83,6 +83,7 @@
done = 0,
success = 0,
errored = false,
+ errorObjects = [],
newOptions;
if (settings.paged) {
@@ -95,6 +96,7 @@
{},
settings,
{
+ async: false,
complete: function () {
if (this.html) {
if (doPrepend) {
@@ -106,7 +108,7 @@
done++;
if (done === todo || errored) {
if (errored && settings && typeof settings.error === "function") {
- settings.error.call($that);
+ settings.error.call($that, errorObjects);
}
if (settings && typeof settings.complete === "function") {
settings.complete();
@@ -121,8 +123,9 @@
}
}
},
- error: function () {
+ error: function (e) {
errored = true;
+ errorObjects.push(e);
}
}
);
@@ -188,8 +191,8 @@
$templateContainer.html(templateContent);
handleTemplateLoadingSuccess($templateContainer, template, selection, data, settings);
},
- error: function () {
- handleTemplateLoadingError(template, selection, data, settings);
+ error: function (e) {
+ handleTemplateLoadingError(template, selection, data, settings, e);
}
});
}
@@ -215,7 +218,7 @@
$(this).each(function () {
var $templateHtml = $(template.html());
if (settings.beforeInsert) {
- settings.beforeInsert($templateHtml);
+ settings.beforeInsert($templateHtml, data);
}
if (settings.append) {
@@ -226,7 +229,7 @@
$(this).html($templateHtml);
}
if (settings.afterInsert) {
- settings.afterInsert($templateHtml);
+ settings.afterInsert($templateHtml, data);
}
});
@@ -235,16 +238,16 @@
}
}
- function handleTemplateLoadingError(template, selection, data, settings) {
+ function handleTemplateLoadingError(template, selection, data, settings, error) {
var value;
if (typeof settings.error === "function") {
- settings.error.call(selection);
+ settings.error.call(selection, error);
}
$(queue[template]).each(function (key, value) {
if (typeof value.settings.error === "function") {
- value.settings.error.call(value.selection);
+ value.settings.error.call(value.selection, error);
}
});
@@ -309,7 +312,7 @@
}, function ($elem) {
$elem.remove();
});
-
+
processElements("data-href", template, data, settings, function ($elem, value) {
$elem.attr("href", applyFormatters($elem, value, "href", settings));
}, function ($elem) {
@@ -520,9 +523,9 @@
var parentElement = options.parentElement || "div";
var template = options.template || options;
-
+
//If a parent is specified, return it; otherwise only return the generated children.
- if(options.parentElement)
+ if (options.parentElement)
return $("<" + parentElement + "/>").loadTemplate(template, value, internalSettings);
else
return $("<" + parentElement + "/>").loadTemplate(template, value, internalSettings).children();
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.0.min.js b/jquery-loadTemplate/jquery.loadTemplate-1.5.0.min.js
new file mode 100644
index 0000000..1333b7b
--- /dev/null
+++ b/jquery-loadTemplate/jquery.loadTemplate-1.5.0.min.js
@@ -0,0 +1 @@
+(function(a){var v={},u={},h={};function n(F,B,D){var A=this,z,C,E;B=B||{};E=a.extend(true,{async:true,overwriteCache:false,complete:null,success:null,error:function(){a(this).each(function(){a(this).html(E.errorMessage)})},errorMessage:"There was an error loading the template.",paged:false,pageNo:1,elemPerPage:10,append:false,prepend:false,beforeInsert:null,afterInsert:null,bindingOptions:{ignoreUndefined:false,ignoreNull:false,ignoreEmptyString:false}},D);if(a.type(B)==="array"){return s.call(this,F,B,E)}if(!g(F)){z=a(F);if(typeof F==="string"&&F.indexOf("#")===0){E.isFile=false}}C=E.isFile||(typeof E.isFile==="undefined"&&(typeof z==="undefined"||z.length===0));if(C&&!E.overwriteCache&&v[F]){q(F,A,B,E)}else{if(C&&!E.overwriteCache&&v.hasOwnProperty(F)){c(F,A,B,E)}else{if(C){m(F,A,B,E)}else{o(z,A,B,E)}}}return this}function b(A,z){if(z){h[A]=z}else{h=a.extend(h,A)}}function g(z){return typeof z==="string"&&z.indexOf("/")>-1}function s(J,A,G){G=G||{};var z=this,K=A.length,C=G.prepend&&!G.append,B=0,I=0,D=false,E=[],F;if(G.paged){var H=(G.pageNo-1)*G.elemPerPage;A=A.slice(H,H+G.elemPerPage);K=A.length}F=a.extend({},G,{async:false,complete:function(){if(this.html){if(C){z.prepend(this.html())}else{z.append(this.html())}}B++;if(B===K||D){if(D&&G&&typeof G.error==="function"){G.error.call(z,E)}if(G&&typeof G.complete==="function"){G.complete()}}},success:function(){I++;if(I===K){if(G&&typeof G.success==="function"){G.success()}}},error:function(L){D=true;E.push(L)}});if(!G.append&&!G.prepend){z.html("")}if(C){A.reverse()}a(A).each(function(){var L=a("");n.call(L,J,this,F);if(D){return false}});return this}function c(C,A,z,B){if(u[C]){u[C].push({data:z,selection:A,settings:B})}else{u[C]=[{data:z,selection:A,settings:B}]}}function q(D,B,A,C){var z=v[D].clone();p.call(B,z,A,C);if(typeof C.success==="function"){C.success()}}function w(){return new Date().getTime()}function x(z){if(z.indexOf("?")!==-1){return z+"&_="+w()}else{return z+"?_="+w()}}function m(D,B,A,C){var z=a("");v[D]=null;var E=D;if(C.overwriteCache){E=x(E)}a.ajax({url:E,async:C.async,success:function(F){z.html(F);l(z,D,B,A,C)},error:function(F){k(D,B,A,C,F)}})}function o(z,C,B,D){var A=a("");if(z.is("script")||z.is("template")){z=a.parseHTML(a.trim(z.html()))}A.html(z);p.call(C,A,B,D);if(typeof D.success==="function"){D.success()}}function p(B,z,A){f(B,z,A);a(this).each(function(){var C=a(B.html());if(A.beforeInsert){A.beforeInsert(C,z)}if(A.append){a(this).append(C)}else{if(A.prepend){a(this).prepend(C)}else{a(this).html(C)}}if(A.afterInsert){A.afterInsert(C,z)}});if(typeof A.complete==="function"){A.complete.call(a(this))}}function k(D,B,z,C,A){var E;if(typeof C.error==="function"){C.error.call(B,A)}a(u[D]).each(function(F,G){if(typeof G.settings.error==="function"){G.settings.error.call(G.selection,A)}});if(typeof C.complete==="function"){C.complete.call(B)}while(u[D]&&(E=u[D].shift())){if(typeof E.settings.complete==="function"){E.settings.complete.call(E.selection)}}if(typeof u[D]!=="undefined"&&u[D].length>0){u[D]=[]}}function l(z,D,B,A,C){var E;v[D]=z.clone();p.call(B,z,A,C);if(typeof C.success==="function"){C.success.call(B)}while(u[D]&&(E=u[D].shift())){p.call(E.selection,v[D].clone(),E.data,E.settings);if(typeof E.settings.success==="function"){E.settings.success.call(E.selection)}}}function f(B,z,A){z=z||{};t("data-content",B,z,A,function(C,D){C.html(e(C,D,"content",A))});t("data-content-append",B,z,A,function(C,D){C.append(e(C,D,"content",A))});t("data-content-prepend",B,z,A,function(C,D){C.prepend(e(C,D,"content",A))});t("data-content-text",B,z,A,function(C,D){C.text(e(C,D,"content",A))});t("data-innerHTML",B,z,A,function(C,D){C.html(e(C,D,"content",A))});t("data-src",B,z,A,function(C,D){C.attr("src",e(C,D,"src",A))},function(C){C.remove()});t("data-href",B,z,A,function(C,D){C.attr("href",e(C,D,"href",A))},function(C){C.remove()});t("data-alt",B,z,A,function(C,D){C.attr("alt",e(C,D,"alt",A))});t("data-id",B,z,A,function(C,D){C.attr("id",e(C,D,"id",A))});t("data-value",B,z,A,function(C,D){C.attr("value",e(C,D,"value",A))});t("data-class",B,z,A,function(C,D){C.addClass(e(C,D,"class",A))});t("data-link",B,z,A,function(C,E){var D=a("");D.attr("href",e(C,E,"link",A));D.html(C.html());C.html(D)});t("data-link-wrap",B,z,A,function(C,E){var D=a("");D.attr("href",e(C,E,"link-wrap",A));C.wrap(D)});t("data-options",B,z,A,function(C,D){a(D).each(function(){var E=a("");E.attr("value",this).text(this).appendTo(C)})});r(B,z,A)}function t(z,E,A,D,B,C){a("["+z+"]",E).each(function(){var F=a(this),G=F.attr(z),H=j(A,G);if(!y(F,H,D)){F.remove();return}F.removeAttr(z);if(typeof H!=="undefined"&&B){B(F,H)}else{if(C){C(F)}}});return}function y(A,C,B){var z=i(A,B);if(z.ignoreUndefined&&typeof C==="undefined"){return false}else{if(z.ignoreNull&&C===null){return false}else{if(z.ignoreEmptyString&&C===""){return false}else{return true}}}}function i(A,B){var z={};if(A instanceof jQuery&&A.attr("data-binding-options")){z=a.parseJSON(A.attr("data-binding-options"));A.removeAttr("data-binding-options")}else{if(typeof A==="object"&&A.hasOwnProperty("bindingOptions")){z=A.bindingOptions}}return a.extend({},B.bindingOptions,z)}function r(B,z,A){a("[data-template-bind]",B).each(function(){var C=a(this),D=a.parseJSON(C.attr("data-template-bind"));C.removeAttr("data-template-bind");a(D).each(function(){var F;if(typeof(this.value)==="object"){F=j(z,this.value.data)}else{F=j(z,this.value)}if(this.attribute){if(!y(this,F,A)){C.remove();return}switch(this.attribute){case"content":case"innerHTML":C.html(d(C,F,this));break;case"contentAppend":C.append(d(C,F,this));break;case"contentPrepend":C.prepend(d(C,F,this));break;case"contentText":C.text(d(C,F,this));break;case"options":var E=this;a(F).each(function(){var G=a("");G.attr("value",this[E.value.value]).text(d(C,this[E.value.content],E)).attr("selected",typeof this[E.value.selected]==undefined?false:this[E.value.selected]).appendTo(C)});break;default:C.attr(this.attribute,d(C,F,this))}}})})}function d(z,C,A,B){if(A.formatter&&h[A.formatter]){return(function(D){return h[A.formatter].call(z,C,A.formatOptions,D)})(B)}return C}function j(z,A){if(A==="this"){return z}var B=A.split("."),C,D=z;while((C=B.shift())&&typeof D!=="undefined"&&D!=null){D=D[C]}return D}function e(z,F,A,E){var D=z.attr("data-format-target"),C;if(D===A||(!D&&A==="content")){C=z.attr("data-format");if(C&&typeof h[C]==="function"){var B=z.attr("data-format-options");return(function(G){return h[C].call(z[0],F,B,a.extend({},G))})(E)}}return F}b("nestedTemplateFormatter",function(D,A,z){if(!A){return}if(typeof A==="string"&&A[0]==="{"){A=a.parseJSON(A)}var B=A.parentElement||"div";var C=A.template||A;if(A.parentElement){return a("<"+B+"/>").loadTemplate(C,D,z)}else{return a("<"+B+"/>").loadTemplate(C,D,z).children()}});a.fn.loadTemplate=n;a.addTemplateFormatter=b})(jQuery);
\ No newline at end of file
diff --git a/loadTemplate.jquery.json b/loadTemplate.jquery.json
index 3ff9610..383ad61 100644
--- a/loadTemplate.jquery.json
+++ b/loadTemplate.jquery.json
@@ -6,7 +6,7 @@
"templates",
"templating"
],
- "version": "1.4.5",
+ "version": "1.5.0",
"author": {
"name": "Paul Burgess and other contributors",
"url": "https://github.com/codepb/jquery-template"
diff --git a/tests/index.html b/tests/index.html
index e1d7e36..e70f28a 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -3,7 +3,7 @@
loadTemplate Test Suite
-
+
From 68a627762d2cc2ec50c0c08839d007f82ae1f831 Mon Sep 17 00:00:00 2001
From: Paul Burgess
Date: Thu, 3 Sep 2015 15:45:52 +0100
Subject: [PATCH 03/25] updating package.json
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 84b6879..a1ac9c4 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.loadtemplate",
- "version": "1.4.5",
+ "version": "1.5.0",
"author": "Paul Burgess",
"description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
"homepage": "http://codepb.github.io/jquery-template/",
From 5a34a469fed9195bf03450912827a75ba9daf69b Mon Sep 17 00:00:00 2001
From: Laurent
Date: Tue, 22 Sep 2015 14:33:20 +0200
Subject: [PATCH 04/25] bower.json fix
---
bower.json | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bower.json b/bower.json
index b33029b..19cae22 100644
--- a/bower.json
+++ b/bower.json
@@ -8,7 +8,7 @@
"repository": {
"type": "git",
"url": "git://github.com/codepb/jquery-template.git"
- }
+ },
"description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
"main": "jquery-loadTemplate/jquery.loadTemplate.js",
"ignore": [
@@ -22,7 +22,7 @@
"MIT-LICENSE.txt",
"package.json",
"readme.md"
- ]
+ ],
"keywords": [
"templates",
"templating",
@@ -30,5 +30,5 @@
],
"dependencies": {
"jquery": ">=1.8"
- },
+ }
}
From f2a788762d631076e086812e72fbbf9c50a6a09e Mon Sep 17 00:00:00 2001
From: codepb
Date: Mon, 30 Nov 2015 10:29:16 +0000
Subject: [PATCH 05/25] Update to include information about arrays
Fixes #78
---
readme.md | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/readme.md b/readme.md
index 7ed4472..b8cb88b 100644
--- a/readme.md
+++ b/readme.md
@@ -58,6 +58,10 @@ Similarly the content of the template could be held in a separate html file with
The plugin has a number of data-... attributes that can be used to populate various attributes with the data. There is also the powerful data-template-bind attribute that accepts a JSON object, enabling binding to any attribute, or the content of the element.
+#### Arrays
+
+You can pass an array of objects instead of a single object and the template will be populated and added to the container for each item in the array. There are options built in that allow you to page the results from an array as well. See the options section below and the included examples.
+
### Data Formatters
It is also possible to define data formatters. These are assigned through the `$.addTemplateFormatter` method. This function either accepts a map of functions and the keys that they will be referenced by, or a single function with a single key as two separate parameters. Each formatter takes two values, the value being assigned, and a template to use to define how this data is displayed. The data-format-template may be empty. Example usage of this is below:
@@ -95,7 +99,7 @@ Formatters must be added before they are used else a template will not be able t
### Bindings
There are a number of different bindings and ways to bind the data. The following attributes are available:
-- "data-innerHTML" (<= 1.4.5) - binds the value supplied to the content (innerHTML) of the element (uses $(elem).html(value))
+- "data-innerHTML" (>= 1.4.5) - binds the value supplied to the content (innerHTML) of the element (uses $(elem).html(value))
- "data-content" - alias for the newer "data-innerHTML"
- "data-content-text" - binds the value supplied to the content of the element as text (uses $(elem).text(value))
- "data-content-append" - appends the value to the end of the element (uses $(elem).append(value))
From 8935e352a20f5838e3d5755b8b3927c2ef1e593b Mon Sep 17 00:00:00 2001
From: sorenwojo
Date: Thu, 21 Jan 2016 16:42:54 +0100
Subject: [PATCH 06/25] Fire afterInsert when item from array has been inserted
Added different handling of afterInsert event when data is an array.
When data is not an array event will be fired as before.
---
.../jquery.loadTemplate-1.5.0.js | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.0.js b/jquery-loadTemplate/jquery.loadTemplate-1.5.0.js
index 209cfa3..d0f8954 100644
--- a/jquery-loadTemplate/jquery.loadTemplate-1.5.0.js
+++ b/jquery-loadTemplate/jquery.loadTemplate-1.5.0.js
@@ -2,7 +2,8 @@
"use strict";
var templates = {},
queue = {},
- formatters = {};
+ formatters = {},
+ isArray;
function loadTemplate(template, data, options) {
var $that = this,
@@ -39,6 +40,7 @@
}, options);
if ($.type(data) === "array") {
+ isArray = true;
return processArray.call(this, template, data, settings);
}
@@ -97,12 +99,16 @@
settings,
{
async: false,
- complete: function () {
+ complete: function (data) {
if (this.html) {
+ var insertedElement;
if (doPrepend) {
- $that.prepend(this.html());
+ insertedElement = $(this.html()).prependTo($that);
} else {
- $that.append(this.html());
+ insertedElement = $(this.html()).appendTo($that);
+ }
+ if (settings.afterInsert && data) {
+ settings.afterInsert(insertedElement, data);
}
}
done++;
@@ -228,13 +234,13 @@
} else {
$(this).html($templateHtml);
}
- if (settings.afterInsert) {
+ if (settings.afterInsert && !isArray) {
settings.afterInsert($templateHtml, data);
}
});
if (typeof settings.complete === "function") {
- settings.complete.call($(this));
+ settings.complete.call($(this), data);
}
}
From 501ce5b1c491a66c247866f3321c9416550e23ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B8ren=20J=C3=B8rgensen?=
Date: Fri, 29 Jan 2016 22:43:58 +0100
Subject: [PATCH 07/25] Fixed failing test
Moved incrementation of counter to before comparison as template now has been added when event is fired.
---
tests/files/callback.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/files/callback.js b/tests/files/callback.js
index b9899d4..40abd43 100644
--- a/tests/files/callback.js
+++ b/tests/files/callback.js
@@ -49,12 +49,12 @@
afterInsert : function(elem){
sequence.push('after');
+ ++afterInsertCounter;
+
if ($('#render').children().length === afterInsertCounter) {
elemSequence.push(true);
}
-
- ++afterInsertCounter;
-
+
},
complete : function(){
sequence.push('complete');
From 3c0dadf03e6ef99940f41bcc27825bed982eed6f Mon Sep 17 00:00:00 2001
From: Paul Burgess
Date: Mon, 29 Feb 2016 09:54:13 +0000
Subject: [PATCH 08/25] Updating version
---
Examples/index.html | 2 +-
bower.json | 2 +-
jquery-loadTemplate/jquery.loadTemplate-1.5.0.min.js | 1 -
...query.loadTemplate-1.5.0.js => jquery.loadTemplate-1.5.1.js} | 0
jquery-loadTemplate/jquery.loadTemplate-1.5.1.min.js | 1 +
loadTemplate.jquery.json | 2 +-
package.json | 2 +-
tests/index.html | 2 +-
8 files changed, 6 insertions(+), 6 deletions(-)
delete mode 100644 jquery-loadTemplate/jquery.loadTemplate-1.5.0.min.js
rename jquery-loadTemplate/{jquery.loadTemplate-1.5.0.js => jquery.loadTemplate-1.5.1.js} (100%)
create mode 100644 jquery-loadTemplate/jquery.loadTemplate-1.5.1.min.js
diff --git a/Examples/index.html b/Examples/index.html
index d12c8a1..a5b2e3c 100644
--- a/Examples/index.html
+++ b/Examples/index.html
@@ -9,7 +9,7 @@
-
+
diff --git a/bower.json b/bower.json
index dda5299..6940479 100644
--- a/bower.json
+++ b/bower.json
@@ -1,16 +1,14 @@
{
"name": "jquery-load-template",
- "version": "1.5.1",
"authors": [
{ "name": "Paul Burgess"}
],
"homepage": "http://codepb.github.io/jquery-template/",
"repository": {
"type": "git",
- "url": "git://github.com/codepb/jquery-template.git"
+ "url": "https://github.com/codepb/jquery-template.git"
},
"description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
- "main": "jquery-loadTemplate/jquery.loadTemplate.js",
"ignore": [
"Examples",
"tests",
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.1.js b/jquery-loadTemplate/jquery.loadTemplate-1.5.2.js
similarity index 100%
rename from jquery-loadTemplate/jquery.loadTemplate-1.5.1.js
rename to jquery-loadTemplate/jquery.loadTemplate-1.5.2.js
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.1.min.js b/jquery-loadTemplate/jquery.loadTemplate-1.5.2.min.js
similarity index 100%
rename from jquery-loadTemplate/jquery.loadTemplate-1.5.1.min.js
rename to jquery-loadTemplate/jquery.loadTemplate-1.5.2.min.js
diff --git a/loadTemplate.jquery.json b/loadTemplate.jquery.json
index be5219b..6ed8bf6 100644
--- a/loadTemplate.jquery.json
+++ b/loadTemplate.jquery.json
@@ -6,7 +6,7 @@
"templates",
"templating"
],
- "version": "1.5.1",
+ "version": "1.5.2",
"author": {
"name": "Paul Burgess and other contributors",
"url": "https://github.com/codepb/jquery-template"
diff --git a/package.json b/package.json
index b4133f8..15ab0af 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.loadtemplate",
- "version": "1.5.1",
+ "version": "1.5.2",
"author": "Paul Burgess",
"description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
"homepage": "http://codepb.github.io/jquery-template/",
diff --git a/tests/index.html b/tests/index.html
index eda91b2..3c74f9e 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -3,7 +3,7 @@
loadTemplate Test Suite
-
+
From 538aad652d4e16eba1e88488e94980456df4d61c Mon Sep 17 00:00:00 2001
From: Paul Burgess
Date: Mon, 29 Feb 2016 11:12:34 +0000
Subject: [PATCH 10/25] Attempting to fix bower.json
---
Examples/index.html | 2 +-
bower.json | 19 ++++++++++---------
...-1.5.2.js => jquery.loadTemplate-1.5.3.js} | 0
...in.js => jquery.loadTemplate-1.5.3.min.js} | 0
loadTemplate.jquery.json | 2 +-
package.json | 2 +-
tests/index.html | 2 +-
7 files changed, 14 insertions(+), 13 deletions(-)
rename jquery-loadTemplate/{jquery.loadTemplate-1.5.2.js => jquery.loadTemplate-1.5.3.js} (100%)
rename jquery-loadTemplate/{jquery.loadTemplate-1.5.2.min.js => jquery.loadTemplate-1.5.3.min.js} (100%)
diff --git a/Examples/index.html b/Examples/index.html
index 4b46dbe..8303ace 100644
--- a/Examples/index.html
+++ b/Examples/index.html
@@ -9,7 +9,7 @@
-
+
diff --git a/bower.json b/bower.json
index 6940479..d90121b 100644
--- a/bower.json
+++ b/bower.json
@@ -1,31 +1,32 @@
{
"name": "jquery-load-template",
+ "homepage": "http://codepb.github.io/jquery-template/",
"authors": [
- { "name": "Paul Burgess"}
+ ["Paul Burgess "]
],
- "homepage": "http://codepb.github.io/jquery-template/",
+ "description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
"repository": {
"type": "git",
"url": "https://github.com/codepb/jquery-template.git"
},
- "description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
+ "main": "jquery-loadTemplate-1.5.3.js"
+ "keywords": [
+ "templates",
+ "templating",
+ "jquery-plugin"
+ ],
"ignore": [
"Examples",
"tests",
".gitattributes",
".gitignore",
".travis.yml",
- "bower.json",
"loadTemplate.jquery.json",
"MIT-LICENSE.txt",
"package.json",
"readme.md"
],
- "keywords": [
- "templates",
- "templating",
- "jquery-plugin"
- ],
+
"dependencies": {
"jquery": ">=1.8"
}
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.2.js b/jquery-loadTemplate/jquery.loadTemplate-1.5.3.js
similarity index 100%
rename from jquery-loadTemplate/jquery.loadTemplate-1.5.2.js
rename to jquery-loadTemplate/jquery.loadTemplate-1.5.3.js
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.2.min.js b/jquery-loadTemplate/jquery.loadTemplate-1.5.3.min.js
similarity index 100%
rename from jquery-loadTemplate/jquery.loadTemplate-1.5.2.min.js
rename to jquery-loadTemplate/jquery.loadTemplate-1.5.3.min.js
diff --git a/loadTemplate.jquery.json b/loadTemplate.jquery.json
index 6ed8bf6..6d5588b 100644
--- a/loadTemplate.jquery.json
+++ b/loadTemplate.jquery.json
@@ -6,7 +6,7 @@
"templates",
"templating"
],
- "version": "1.5.2",
+ "version": "1.5.3",
"author": {
"name": "Paul Burgess and other contributors",
"url": "https://github.com/codepb/jquery-template"
diff --git a/package.json b/package.json
index 15ab0af..04cc460 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.loadtemplate",
- "version": "1.5.2",
+ "version": "1.5.3",
"author": "Paul Burgess",
"description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
"homepage": "http://codepb.github.io/jquery-template/",
diff --git a/tests/index.html b/tests/index.html
index 3c74f9e..005ff3b 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -3,7 +3,7 @@
loadTemplate Test Suite
-
+
From d32135f3bf98312bf139afb765abf07fb962a910 Mon Sep 17 00:00:00 2001
From: Paul Burgess
Date: Mon, 29 Feb 2016 11:15:49 +0000
Subject: [PATCH 11/25] Fixed issue with author tag in bower.json
---
Examples/index.html | 2 +-
bower.json | 7 +++----
....loadTemplate-1.5.3.js => jquery.loadTemplate-1.5.4.js} | 0
...plate-1.5.3.min.js => jquery.loadTemplate-1.5.4.min.js} | 0
loadTemplate.jquery.json | 2 +-
package.json | 2 +-
tests/index.html | 2 +-
7 files changed, 7 insertions(+), 8 deletions(-)
rename jquery-loadTemplate/{jquery.loadTemplate-1.5.3.js => jquery.loadTemplate-1.5.4.js} (100%)
rename jquery-loadTemplate/{jquery.loadTemplate-1.5.3.min.js => jquery.loadTemplate-1.5.4.min.js} (100%)
diff --git a/Examples/index.html b/Examples/index.html
index 8303ace..d0af2e8 100644
--- a/Examples/index.html
+++ b/Examples/index.html
@@ -9,7 +9,7 @@
-
+
diff --git a/bower.json b/bower.json
index d90121b..49b4d26 100644
--- a/bower.json
+++ b/bower.json
@@ -2,14 +2,14 @@
"name": "jquery-load-template",
"homepage": "http://codepb.github.io/jquery-template/",
"authors": [
- ["Paul Burgess "]
+ "Paul Burgess "
],
"description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
"repository": {
"type": "git",
"url": "https://github.com/codepb/jquery-template.git"
},
- "main": "jquery-loadTemplate-1.5.3.js"
+ "main": "jquery.loadTemplate-1.5.4.js"
"keywords": [
"templates",
"templating",
@@ -25,8 +25,7 @@
"MIT-LICENSE.txt",
"package.json",
"readme.md"
- ],
-
+ ],
"dependencies": {
"jquery": ">=1.8"
}
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.3.js b/jquery-loadTemplate/jquery.loadTemplate-1.5.4.js
similarity index 100%
rename from jquery-loadTemplate/jquery.loadTemplate-1.5.3.js
rename to jquery-loadTemplate/jquery.loadTemplate-1.5.4.js
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.3.min.js b/jquery-loadTemplate/jquery.loadTemplate-1.5.4.min.js
similarity index 100%
rename from jquery-loadTemplate/jquery.loadTemplate-1.5.3.min.js
rename to jquery-loadTemplate/jquery.loadTemplate-1.5.4.min.js
diff --git a/loadTemplate.jquery.json b/loadTemplate.jquery.json
index 6d5588b..7183432 100644
--- a/loadTemplate.jquery.json
+++ b/loadTemplate.jquery.json
@@ -6,7 +6,7 @@
"templates",
"templating"
],
- "version": "1.5.3",
+ "version": "1.5.4",
"author": {
"name": "Paul Burgess and other contributors",
"url": "https://github.com/codepb/jquery-template"
diff --git a/package.json b/package.json
index 04cc460..7b1f717 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.loadtemplate",
- "version": "1.5.3",
+ "version": "1.5.4",
"author": "Paul Burgess",
"description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
"homepage": "http://codepb.github.io/jquery-template/",
diff --git a/tests/index.html b/tests/index.html
index 005ff3b..2c10302 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -3,7 +3,7 @@
loadTemplate Test Suite
-
+
From ae7ffa01cfd399853923348b630180c116337e34 Mon Sep 17 00:00:00 2001
From: Paul Burgess
Date: Mon, 29 Feb 2016 11:19:06 +0000
Subject: [PATCH 12/25] fixed missing comma after main in bower.json
---
bower.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bower.json b/bower.json
index 49b4d26..4b5dbb2 100644
--- a/bower.json
+++ b/bower.json
@@ -9,7 +9,7 @@
"type": "git",
"url": "https://github.com/codepb/jquery-template.git"
},
- "main": "jquery.loadTemplate-1.5.4.js"
+ "main": "jquery.loadTemplate-1.5.4.js",
"keywords": [
"templates",
"templating",
From 98b5eb84b4a948228b3bf4aa93160d44bcd5ff12 Mon Sep 17 00:00:00 2001
From: Paul Burgess
Date: Mon, 29 Feb 2016 11:20:30 +0000
Subject: [PATCH 13/25] Updating Version
---
Examples/index.html | 2 +-
bower.json | 2 +-
...query.loadTemplate-1.5.4.js => jquery.loadTemplate-1.5.5.js} | 0
...adTemplate-1.5.4.min.js => jquery.loadTemplate-1.5.5.min.js} | 0
loadTemplate.jquery.json | 2 +-
package.json | 2 +-
tests/index.html | 2 +-
7 files changed, 5 insertions(+), 5 deletions(-)
rename jquery-loadTemplate/{jquery.loadTemplate-1.5.4.js => jquery.loadTemplate-1.5.5.js} (100%)
rename jquery-loadTemplate/{jquery.loadTemplate-1.5.4.min.js => jquery.loadTemplate-1.5.5.min.js} (100%)
diff --git a/Examples/index.html b/Examples/index.html
index d0af2e8..f09337f 100644
--- a/Examples/index.html
+++ b/Examples/index.html
@@ -9,7 +9,7 @@
-
+
diff --git a/bower.json b/bower.json
index 4b5dbb2..e9ad1c0 100644
--- a/bower.json
+++ b/bower.json
@@ -9,7 +9,7 @@
"type": "git",
"url": "https://github.com/codepb/jquery-template.git"
},
- "main": "jquery.loadTemplate-1.5.4.js",
+ "main": "jquery.loadTemplate-1.5.5.js",
"keywords": [
"templates",
"templating",
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.4.js b/jquery-loadTemplate/jquery.loadTemplate-1.5.5.js
similarity index 100%
rename from jquery-loadTemplate/jquery.loadTemplate-1.5.4.js
rename to jquery-loadTemplate/jquery.loadTemplate-1.5.5.js
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.4.min.js b/jquery-loadTemplate/jquery.loadTemplate-1.5.5.min.js
similarity index 100%
rename from jquery-loadTemplate/jquery.loadTemplate-1.5.4.min.js
rename to jquery-loadTemplate/jquery.loadTemplate-1.5.5.min.js
diff --git a/loadTemplate.jquery.json b/loadTemplate.jquery.json
index 7183432..6f8ac34 100644
--- a/loadTemplate.jquery.json
+++ b/loadTemplate.jquery.json
@@ -6,7 +6,7 @@
"templates",
"templating"
],
- "version": "1.5.4",
+ "version": "1.5.5",
"author": {
"name": "Paul Burgess and other contributors",
"url": "https://github.com/codepb/jquery-template"
diff --git a/package.json b/package.json
index 7b1f717..ba1a933 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.loadtemplate",
- "version": "1.5.4",
+ "version": "1.5.5",
"author": "Paul Burgess",
"description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
"homepage": "http://codepb.github.io/jquery-template/",
diff --git a/tests/index.html b/tests/index.html
index 2c10302..50e6ddf 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -3,7 +3,7 @@
loadTemplate Test Suite
-
+
From 54c882c2aefa361e6faa7cdfc6abcf8c68bd505b Mon Sep 17 00:00:00 2001
From: Paul Burgess
Date: Mon, 29 Feb 2016 11:31:33 +0000
Subject: [PATCH 14/25] moved to a new dist folder. New version
---
.gitignore | 1 -
Examples/index.html | 2 +-
bower.json | 2 +-
.../jquery.loadTemplate-1.5.6.js | 0
.../jquery.loadTemplate-1.5.6.min.js | 0
loadTemplate.jquery.json | 2 +-
package.json | 2 +-
tests/index.html | 2 +-
8 files changed, 5 insertions(+), 6 deletions(-)
rename jquery-loadTemplate/jquery.loadTemplate-1.5.5.js => dist/jquery.loadTemplate-1.5.6.js (100%)
rename jquery-loadTemplate/jquery.loadTemplate-1.5.5.min.js => dist/jquery.loadTemplate-1.5.6.min.js (100%)
diff --git a/.gitignore b/.gitignore
index b9d6bd9..38a363a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -192,7 +192,6 @@ $RECYCLE.BIN/
# Packages
*.egg
*.egg-info
-dist/
build/
eggs/
parts/
diff --git a/Examples/index.html b/Examples/index.html
index f09337f..6d1388a 100644
--- a/Examples/index.html
+++ b/Examples/index.html
@@ -9,7 +9,7 @@
-
+
diff --git a/bower.json b/bower.json
index e9ad1c0..1c946fa 100644
--- a/bower.json
+++ b/bower.json
@@ -9,7 +9,7 @@
"type": "git",
"url": "https://github.com/codepb/jquery-template.git"
},
- "main": "jquery.loadTemplate-1.5.5.js",
+ "main": "dist/jquery.loadTemplate-1.5.6.js",
"keywords": [
"templates",
"templating",
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.5.js b/dist/jquery.loadTemplate-1.5.6.js
similarity index 100%
rename from jquery-loadTemplate/jquery.loadTemplate-1.5.5.js
rename to dist/jquery.loadTemplate-1.5.6.js
diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.5.5.min.js b/dist/jquery.loadTemplate-1.5.6.min.js
similarity index 100%
rename from jquery-loadTemplate/jquery.loadTemplate-1.5.5.min.js
rename to dist/jquery.loadTemplate-1.5.6.min.js
diff --git a/loadTemplate.jquery.json b/loadTemplate.jquery.json
index 6f8ac34..d8a6eea 100644
--- a/loadTemplate.jquery.json
+++ b/loadTemplate.jquery.json
@@ -6,7 +6,7 @@
"templates",
"templating"
],
- "version": "1.5.5",
+ "version": "1.5.6",
"author": {
"name": "Paul Burgess and other contributors",
"url": "https://github.com/codepb/jquery-template"
diff --git a/package.json b/package.json
index ba1a933..a9339ae 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.loadtemplate",
- "version": "1.5.5",
+ "version": "1.5.6",
"author": "Paul Burgess",
"description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
"homepage": "http://codepb.github.io/jquery-template/",
diff --git a/tests/index.html b/tests/index.html
index 50e6ddf..2b0a61d 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -3,7 +3,7 @@
loadTemplate Test Suite
-
+
From 6733ea1c0e05f421fe5e9c43bd2bb1df3e6fde27 Mon Sep 17 00:00:00 2001
From: codepb
Date: Tue, 8 Mar 2016 21:27:51 +0000
Subject: [PATCH 15/25] fixing reference to data-format-template
fixes #90
---
readme.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/readme.md b/readme.md
index b8cb88b..7a6d4bd 100644
--- a/readme.md
+++ b/readme.md
@@ -64,7 +64,7 @@ You can pass an array of objects instead of a single object and the template wil
### Data Formatters
-It is also possible to define data formatters. These are assigned through the `$.addTemplateFormatter` method. This function either accepts a map of functions and the keys that they will be referenced by, or a single function with a single key as two separate parameters. Each formatter takes two values, the value being assigned, and a template to use to define how this data is displayed. The data-format-template may be empty. Example usage of this is below:
+It is also possible to define data formatters. These are assigned through the `$.addTemplateFormatter` method. This function either accepts a map of functions and the keys that they will be referenced by, or a single function with a single key as two separate parameters. Each formatter takes two values, the value being assigned, and a template to use to define how this data is displayed. The data-format-options may be empty. Example usage of this is below:
$.addTemplateFormatter("UpperCaseFormatter",
function(value, template) {
From c57638100d464d9ecd33c4a53b2c80121daafc6a Mon Sep 17 00:00:00 2001
From: Michal Brauner
Date: Fri, 25 Mar 2016 19:42:35 +0100
Subject: [PATCH 16/25] fix package.json - missing "main" option
---
package.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/package.json b/package.json
index a9339ae..ad8504e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,7 @@
{
"name": "jquery.loadtemplate",
"version": "1.5.6",
+ "main": "dist/jquery.loadTemplate-1.5.6.js",
"author": "Paul Burgess",
"description": "jQuery plugin for loading and using templates. The plugin is designed to be simple yet powerful, and supports loading templates from within the page, or using AJAX to load html files.",
"homepage": "http://codepb.github.io/jquery-template/",
From 62bb1f012f974b8961a73fe77784155b90806815 Mon Sep 17 00:00:00 2001
From: Paul Burgess
Date: Fri, 1 Apr 2016 16:24:21 +0100
Subject: [PATCH 17/25] Fixed issue with binding the value of selects
now uses .val to bind value. Fixed templates so the javascript
properties are also copied with the template into the dom
---
Examples/SimpleExample/Templates/simple.html | 2 +-
Examples/SimpleExample/example.html | 4 +++-
Examples/index.html | 4 ++--
bower.json | 2 +-
dist/jquery.loadTemplate-1.5.6.min.js | 1 -
...-1.5.6.js => jquery.loadTemplate-1.5.7.js} | 21 ++++++++++++-------
dist/jquery.loadTemplate-1.5.7.min.js | 1 +
loadTemplate.jquery.json | 2 +-
package.json | 4 ++--
tests/index.html | 2 +-
10 files changed, 26 insertions(+), 17 deletions(-)
delete mode 100644 dist/jquery.loadTemplate-1.5.6.min.js
rename dist/{jquery.loadTemplate-1.5.6.js => jquery.loadTemplate-1.5.7.js} (97%)
create mode 100644 dist/jquery.loadTemplate-1.5.7.min.js
diff --git a/Examples/SimpleExample/Templates/simple.html b/Examples/SimpleExample/Templates/simple.html
index c844792..2e75af5 100644
--- a/Examples/SimpleExample/Templates/simple.html
+++ b/Examples/SimpleExample/Templates/simple.html
@@ -3,7 +3,7 @@
-
+
Example of loading a template from a script tag within the same document.
-
+