delete fixed

This commit is contained in:
Harry Bomrah 2012-11-23 13:22:01 +08:00
parent 8009c6aa34
commit 3933c048b0
2 changed files with 8 additions and 4 deletions

View File

@ -50,7 +50,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
return false; return false;
}) })
$("div[container=true]").unbind("click").on("click",".journal_paper_edit",function(){ $("div[container=true]").unbind(".edit").on("click.edit",".journal_paper_edit",function(){
$.ajax({ $.ajax({
url : $(this).attr("href"), url : $(this).attr("href"),
type : "get", type : "get",
@ -64,7 +64,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
}) })
return false; return false;
}) })
$("div[container=true]").unbind("click").on("click",".journal_paper_delete",function(){ $("div[container=true]").unbind(".delete").on("click.delete",".journal_paper_delete",function(){
var delurl = $(this).attr("href"); var delurl = $(this).attr("href");
var parent = $(this).parent(); var parent = $(this).parent();
o.confirm({ o.confirm({
@ -76,8 +76,11 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
$.ajax({ $.ajax({
url : delurl, url : delurl,
type : "DELETE", type : "DELETE",
success : function(){ success : function(data){
parent.slideOut(); if(data.success){
parent.hide("slide",function(){parent.remove();});
o.notify(data.msg,"success");
}
} }
}) })
} }

View File

@ -83,6 +83,7 @@ class Desktop::JournalPagesController < ApplicationController
def destroy def destroy
@writing_journal = WritingJournal.find(params[:id]) @writing_journal = WritingJournal.find(params[:id])
@writing_journal.destroy @writing_journal.destroy
render :json => {success: true,msg: "Paper deleted successfully!"}
end end
def get_journals_json def get_journals_json