Ugh
parent
030e204b65
commit
634485e654
|
@ -1,6 +1,20 @@
|
||||||
(function(Snipt) {
|
(function(Snipt) {
|
||||||
|
|
||||||
Snipt.SniptModel = Backbone.Model.extend({
|
Snipt.SniptModel = Backbone.Model.extend({
|
||||||
|
toSafe: function() {
|
||||||
|
var snipt = this.toJSON();
|
||||||
|
snipt.code = this.escape('code');
|
||||||
|
snipt.title = this.escape('title');
|
||||||
|
snipt.tags_list = this.escape('tags_list');
|
||||||
|
|
||||||
|
if (typeof snipt.tags === 'object') {
|
||||||
|
for (tag in snipt.tags) {
|
||||||
|
snipt.tags[tag].name = _.escape(snipt.tags[tag].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return snipt;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
Snipt.SniptView = Backbone.View.extend({
|
Snipt.SniptView = Backbone.View.extend({
|
||||||
|
|
||||||
|
@ -68,9 +82,7 @@
|
||||||
this.select();
|
this.select();
|
||||||
|
|
||||||
that = this;
|
that = this;
|
||||||
var snipt = this.model.toJSON();
|
var editPane = this.editTemplate({snipt: this.model.toSafe()});
|
||||||
snipt.code = this.model.escape('code');
|
|
||||||
var editPane = this.editTemplate({snipt: snipt});
|
|
||||||
|
|
||||||
// Init main view
|
// Init main view
|
||||||
window.site.$main.hide();
|
window.site.$main.hide();
|
||||||
|
@ -205,10 +217,8 @@
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
var snipt = this.model.toJSON();
|
|
||||||
snipt.code = this.model.escape('code');
|
|
||||||
|
|
||||||
this.$el.html(this.template({snipt: snipt}));
|
this.$el.html(this.template({snipt: this.model.toSafe()}));
|
||||||
this.initLocalVars();
|
this.initLocalVars();
|
||||||
|
|
||||||
if (this.model.get('public') === true) {
|
if (this.model.get('public') === true) {
|
||||||
|
|
Loading…
Reference in New Issue