Last active
January 29, 2017 06:48
-
-
Save andersdn/4b03c7253fdfc19827d7 to your computer and use it in GitHub Desktop.
Revisions
-
andersdn revised this gist
Nov 30, 2015 . No changes.There are no files selected for viewing
-
andersdn revised this gist
Nov 30, 2015 . No changes.There are no files selected for viewing
-
andersdn revised this gist
Nov 30, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ function _tpl(templateName,callback) { $(document).ready(function(){ var template_data = { 'foo':'bar', 'baz':['apple','bananna','custard'] }; _tpl('dashboard',function(template){ -
andersdn revised this gist
Nov 30, 2015 . 2 changed files with 1 addition and 1 deletion.There are no files selected for viewing
File renamed without changes.This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // underscore template loader function _tpl(templateName,callback) { var tmpl_url = '_tlp-' + templateName + '.html'; $.ajax({ url: tmpl_url, method: 'GET', -
andersdn revised this gist
Nov 30, 2015 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,13 +14,13 @@ function _tpl(templateName,callback) { $(document).ready(function(){ var template_data = { 'foor':'bar' 'baz':['apple','bananna','custard'] }; _tpl('dashboard',function(template){ var tpl = _.template(template); $("#container").html(tpl(template_data)); }) }) -
andersdn revised this gist
Nov 30, 2015 . 2 changed files with 1 addition and 1 deletion.There are no files selected for viewing
File renamed without changes.This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // underscore template loader function _tpl(templateName,callback) { var tmpl_url = templateName + '.html'; $.ajax({ url: tmpl_url, method: 'GET', -
andersdn created this gist
Nov 30, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ <html> <body> <h1>Foo is <%= foo %></h1> <% _.each(baz,function(value,index){ %> <h2>Baz <%= index %> is <%= value %> <h2> <% }) %> </body> </html> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="main.js"></script> </head> <body> <div id="container"></div> </body> </html> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ // underscore template loader function _tpl(templateName,callback) { var tmpl_url = templateName + '.tpl'; $.ajax({ url: tmpl_url, method: 'GET', async: false, contentType: 'text', success: function (data) { callback(data); } }); } $(document).ready(function(){ var template_data = { 'foor':'bar' 'baz':['apple','bananna','custard'] }; _tpl('dashboard',function(template){ var tpl = _.template(template); $("#container").html(tpl(template_data)); }) })