Fix saving

master
Nick Sergeant 2012-07-20 21:59:34 -04:00
parent 7866a9b715
commit 9b321d5cee
3 changed files with 3 additions and 3 deletions

View File

@ -157,7 +157,7 @@ if(this.model.get('public')===true){this.$el.removeClass('private-snipt');}else{
if(this.model.get('user').username===window.user){this.$el.addClass('editable');}else{this.$el.removeClass('editable');}
if(this.model.get('line_count')>8&&!window.detail){this.$el.addClass('expandable');}else{this.$el.removeClass('expandable');}
$('script#disqus').remove();window.site.$body.append('<script id="disqus" type="text/javascript">'+$('script#disqus-template').text()+'</script>');if(this.$el.attr('id')==='new-snipt'){this.$el.fadeIn('fast');this.$el.attr('id','snipt-'+this.model.get('id'));}
return this;},save:function(){$('button.save, button.save-and-close, button.delete, button.cancel',window.site.$main_edit).attr('disabled','disabled');that.model.save({'title':$('input#snipt_title').val(),'tags':$('label.tags textarea').val(),'tags_list':$('label.tags textarea').val(),'lexer':$('select[name="lexer"]').val(),'lexer_name':$('select[name="lexer"] option:selected').text(),'code':window.editor.getSession().getValue(),'blog_post':$('label.blog-post input').is(':checked'),'publish_date':$('label.publish-date input').val(),'public':$('label.public input').is(':checked')},{success:function(model,response){$('button.save, button.save-and-close, button.delete, button.cancel',window.site.$main_edit).removeAttr('disabled');},error:function(model,response){alert('There was a problem saving your snipt. We\'ve been notified. Sorry about that!');}});},select:function(fromClick){$('article.selected',window.site.snipt_list.$el).removeClass('selected');this.$el.addClass('selected');if(fromClick!==true){if(window.site.$snipts.index(this.$el)===0){window.scrollTo(0,0);}else{window.site.$html_body.animate({scrollTop:this.$el.offset().top-50},0);}}
return this;},save:function(){$('button.save, button.save-and-close, button.delete, button.cancel',window.site.$main_edit).attr('disabled','disabled');that.model.save({'title':$('input#snipt_title').val(),'tags':$('label.tags textarea').val(),'tags_list':$('label.tags textarea').val(),'lexer':$('select[name="lexer"]').val(),'lexer_name':$('select[name="lexer"] option:selected').text(),'code':window.editor.getValue(),'blog_post':$('label.blog-post input').is(':checked'),'publish_date':$('label.publish-date input').val(),'public':$('label.public input').is(':checked')},{success:function(model,response){$('button.save, button.save-and-close, button.delete, button.cancel',window.site.$main_edit).removeAttr('disabled');},error:function(model,response){alert('There was a problem saving your snipt. We\'ve been notified. Sorry about that!');}});},select:function(fromClick){$('article.selected',window.site.snipt_list.$el).removeClass('selected');this.$el.addClass('selected');if(fromClick!==true){if(window.site.$snipts.index(this.$el)===0){window.scrollTo(0,0);}else{window.site.$html_body.animate({scrollTop:this.$el.offset().top-50},0);}}
window.$selected=this.$el;},selectFromClick:function(e){this.select(true);e.stopPropagation();window.site.$aside_nav.removeClass('open');}});Snipt.SniptListView=Backbone.View.extend({el:'section#snipts',initialize:function(opts){var that=this;opts.snipts.each(this.addExistingSnipt);this.keyboardShortcuts();var cmd;if(navigator.platform=='MacPPC'||navigator.platform=='MacIntel'){cmd='Cmd';}
else{cmd='Ctrl';}
$('span.cmd-ctrl').text(cmd);$('button#add-snipt').click(function(){that.addNewSnipt();});},addExistingSnipt:function(){var $el=$(this);var $created=$('li.created',$el);var $h1=$('header h1 a',$el);var $public=$('div.public',$el);var $blog_post=$('div.blog-post',$el);var $publish_date=$('div.publish-date',$el);var $user=$('li.author a',$el);var is_public=$public.text()==='True'?true:false;var is_blog_post=$blog_post.text()==='True'?true:false;var tag_lis=$('section.tags li',$el);var tags=[];for(var i=0;i<tag_lis.length;i++){var $tag=$('a',tag_lis.eq(i));tags[i]={name:$tag.text(),absolute_url:$tag.attr('href')};}

View File

@ -357,7 +357,7 @@
'tags_list': $('label.tags textarea').val(),
'lexer': $('select[name="lexer"]').val(),
'lexer_name': $('select[name="lexer"] option:selected').text(),
'code': window.editor.getSession().getValue(),
'code': window.editor.getValue(),
'blog_post': $('label.blog-post input').is(':checked'),
'publish_date': $('label.publish-date input').val(),
'public': $('label.public input').is(':checked')

View File

@ -10,7 +10,7 @@ if(this.model.get('public')===true){this.$el.removeClass('private-snipt');}else{
if(this.model.get('user').username===window.user){this.$el.addClass('editable');}else{this.$el.removeClass('editable');}
if(this.model.get('line_count')>8&&!window.detail){this.$el.addClass('expandable');}else{this.$el.removeClass('expandable');}
$('script#disqus').remove();window.site.$body.append('<script id="disqus" type="text/javascript">'+$('script#disqus-template').text()+'</script>');if(this.$el.attr('id')==='new-snipt'){this.$el.fadeIn('fast');this.$el.attr('id','snipt-'+this.model.get('id'));}
return this;},save:function(){$('button.save, button.save-and-close, button.delete, button.cancel',window.site.$main_edit).attr('disabled','disabled');that.model.save({'title':$('input#snipt_title').val(),'tags':$('label.tags textarea').val(),'tags_list':$('label.tags textarea').val(),'lexer':$('select[name="lexer"]').val(),'lexer_name':$('select[name="lexer"] option:selected').text(),'code':window.editor.getSession().getValue(),'blog_post':$('label.blog-post input').is(':checked'),'publish_date':$('label.publish-date input').val(),'public':$('label.public input').is(':checked')},{success:function(model,response){$('button.save, button.save-and-close, button.delete, button.cancel',window.site.$main_edit).removeAttr('disabled');},error:function(model,response){alert('There was a problem saving your snipt. We\'ve been notified. Sorry about that!');}});},select:function(fromClick){$('article.selected',window.site.snipt_list.$el).removeClass('selected');this.$el.addClass('selected');if(fromClick!==true){if(window.site.$snipts.index(this.$el)===0){window.scrollTo(0,0);}else{window.site.$html_body.animate({scrollTop:this.$el.offset().top-50},0);}}
return this;},save:function(){$('button.save, button.save-and-close, button.delete, button.cancel',window.site.$main_edit).attr('disabled','disabled');that.model.save({'title':$('input#snipt_title').val(),'tags':$('label.tags textarea').val(),'tags_list':$('label.tags textarea').val(),'lexer':$('select[name="lexer"]').val(),'lexer_name':$('select[name="lexer"] option:selected').text(),'code':window.editor.getValue(),'blog_post':$('label.blog-post input').is(':checked'),'publish_date':$('label.publish-date input').val(),'public':$('label.public input').is(':checked')},{success:function(model,response){$('button.save, button.save-and-close, button.delete, button.cancel',window.site.$main_edit).removeAttr('disabled');},error:function(model,response){alert('There was a problem saving your snipt. We\'ve been notified. Sorry about that!');}});},select:function(fromClick){$('article.selected',window.site.snipt_list.$el).removeClass('selected');this.$el.addClass('selected');if(fromClick!==true){if(window.site.$snipts.index(this.$el)===0){window.scrollTo(0,0);}else{window.site.$html_body.animate({scrollTop:this.$el.offset().top-50},0);}}
window.$selected=this.$el;},selectFromClick:function(e){this.select(true);e.stopPropagation();window.site.$aside_nav.removeClass('open');}});Snipt.SniptListView=Backbone.View.extend({el:'section#snipts',initialize:function(opts){var that=this;opts.snipts.each(this.addExistingSnipt);this.keyboardShortcuts();var cmd;if(navigator.platform=='MacPPC'||navigator.platform=='MacIntel'){cmd='Cmd';}
else{cmd='Ctrl';}
$('span.cmd-ctrl').text(cmd);$('button#add-snipt').click(function(){that.addNewSnipt();});},addExistingSnipt:function(){var $el=$(this);var $created=$('li.created',$el);var $h1=$('header h1 a',$el);var $public=$('div.public',$el);var $blog_post=$('div.blog-post',$el);var $publish_date=$('div.publish-date',$el);var $user=$('li.author a',$el);var is_public=$public.text()==='True'?true:false;var is_blog_post=$blog_post.text()==='True'?true:false;var tag_lis=$('section.tags li',$el);var tags=[];for(var i=0;i<tag_lis.length;i++){var $tag=$('a',tag_lis.eq(i));tags[i]={name:$tag.text(),absolute_url:$tag.attr('href')};}