Altering resig js tmpl library. JSP has a hate passion for it.

pull/59/head
Michael Jett 2012-03-13 16:27:21 -04:00
parent f3e53386f9
commit c015329e52
2 changed files with 24 additions and 19 deletions

View File

@ -65,26 +65,26 @@
<script type="text/html" id="client_tmpl"> <script type="text/html" id="client_tmpl">
<tr> <tr>
<td><%=name%></td> <td><#=name#></td>
<td><%=redirectURL%></td> <td><#=redirectURL#></td>
<td> <td>
<ul> <ul>
<% for (var i in grantType) { %> <# for (var i in grantType) { #>
<li><%=grantType[i]%></li> <li><#=grantType[i]#></li>
<% } %> <# } #>
</ul> </ul>
</td> </td>
<td> <td>
<ul> <ul>
<% for (var i in scope) { %> <# for (var i in scope) { #>
<li><%=scope[i]%></li> <li><#=scope[i]#></li>
<% } %> <# } #>
</ul> </ul>
</td> </td>
<td><%=authority%></td> <td><#=authority#></td>
<td><%=description%> <td><#=description#>
</td> </td>
<td><input type="checkbox" "<%=(refreshTokens == 1 ? 'checked' : '')%> value="" id="" name="" disabled></td> <td><input type="checkbox" "<#=(refreshTokens == 1 ? 'checked' : '')#> value="" id="" name="" disabled></td>
<td> <td>
<button data-controls-modal="modal-from-dom" data-backdrop="true" data-keyboard="true" <button data-controls-modal="modal-from-dom" data-backdrop="true" data-keyboard="true"
class="btn">edit class="btn">edit

View File

@ -1,3 +1,6 @@
// A slightly modified version of the Resig Templating library
// JSP hates the original
// Simple JavaScript Templating // Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed // John Resig - http://ejohn.org/ - MIT Licensed
(function(){ (function(){
@ -19,13 +22,15 @@
"with(obj){p.push('" + "with(obj){p.push('" +
// Convert the template into pure JavaScript // Convert the template into pure JavaScript
str.replace(/[\r\t\n]/g, " ") str
.replace(/'(?=[^%]*%>)/g,"\t") .replace(/[\r\t\n]/g, " ")
.replace(/'(?=[^#]*#>)/g, "\t")
.split("'").join("\\'") .split("'").join("\\'")
.split("\t").join("'") .split("\t").join("'")
.replace(/<%=(.+?)%>/g, "',$1,'") .replace(/<#=(.+?)#>/g, "',$1,'")
.split("<%").join("');") .split("<#").join("');")
.split("%>").join("p.push('") .split("#>").join("p.push('")
.split("\r").join("\\'")
+ "');}return p.join('');"); + "');}return p.join('');");
// Provide some basic currying to the user // Provide some basic currying to the user