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">
<tr>
<td><%=name%></td>
<td><%=redirectURL%></td>
<td><#=name#></td>
<td><#=redirectURL#></td>
<td>
<ul>
<% for (var i in grantType) { %>
<li><%=grantType[i]%></li>
<% } %>
<# for (var i in grantType) { #>
<li><#=grantType[i]#></li>
<# } #>
</ul>
</td>
<td>
<ul>
<% for (var i in scope) { %>
<li><%=scope[i]%></li>
<% } %>
<# for (var i in scope) { #>
<li><#=scope[i]#></li>
<# } #>
</ul>
</td>
<td><%=authority%></td>
<td><%=description%>
<td><#=authority#></td>
<td><#=description#>
</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>
<button data-controls-modal="modal-from-dom" data-backdrop="true" data-keyboard="true"
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
// John Resig - http://ejohn.org/ - MIT Licensed
(function(){
@ -19,13 +22,15 @@
"with(obj){p.push('" +
// Convert the template into pure JavaScript
str.replace(/[\r\t\n]/g, " ")
.replace(/'(?=[^%]*%>)/g,"\t")
str
.replace(/[\r\t\n]/g, " ")
.replace(/'(?=[^#]*#>)/g, "\t")
.split("'").join("\\'")
.split("\t").join("'")
.replace(/<%=(.+?)%>/g, "',$1,'")
.split("<%").join("');")
.split("%>").join("p.push('")
.replace(/<#=(.+?)#>/g, "',$1,'")
.split("<#").join("');")
.split("#>").join("p.push('")
.split("\r").join("\\'")
+ "');}return p.join('');");
// Provide some basic currying to the user