Fix some eval JS issues.

master
Nick Sergeant 2012-04-07 22:38:26 -04:00
parent e93e71bb2d
commit 40cae482de
4 changed files with 11 additions and 9 deletions

View File

@ -67,9 +67,10 @@
this.select();
// Local vars
that = this;
var editPane = this.editTemplate({snipt: this.model.toJSON()});
var snipt = this.model.toJSON();
snipt.code = this.model.escape('code');
var editPane = this.editTemplate({snipt: snipt});
// Init main view
window.site.$main.hide();
@ -204,9 +205,10 @@
return false;
},
render: function() {
this.$el.html(this.template({
snipt: this.model.toJSON()
}));
var snipt = this.model.toJSON();
snipt.code = this.model.escape('code');
this.$el.html(this.template({snipt: snipt}));
this.initLocalVars();
if (this.model.get('public') === true) {
@ -305,7 +307,7 @@
}
var data = {
code: $('div.raw', $el).html(),
code: $('textarea.raw', $el).text(),
created: $created.attr('title'),
created_formatted: $created.text(),
embed_url: $('div.embed-url', $el).text(),

View File

@ -18,7 +18,7 @@
<span class="lines">(<%= snipt.line_count %> lines)</span>
</a>
<% } %>
<div class="raw"><%= snipt.code %></div>
<textarea class="raw"><%= snipt.code %></textarea>
</section>
<div class="ruler top-x"></div>
<div class="ruler bottom-x"></div>

View File

@ -17,7 +17,7 @@
<span class="lines">({{ snipt.line_count }} lines)</span>
</a>
{% endif %}
<div class="raw">{{ snipt.code }}</div>
<textarea class="raw">{{ snipt.code|safe }}</textarea>
</section>
<div class="ruler top-x"></div>
<div class="ruler bottom-x"></div>

View File

@ -92,7 +92,7 @@
{% endif %}
</ul>
</nav>
{% if request.user.is_authenticated %}
{% if request.user.is_authenticated and has_snipts %}
<aside class="nav">
<ul>
<li><button class="btn btn-info btn-large" id="add-snipt">Add Snipt <i class="icon-search icon-plus icon-white"></i></button></li>