delete update

This commit is contained in:
Harry Bomrah 2012-11-23 10:46:42 +08:00
parent 9189ebffee
commit f38f32ac8b
1 changed files with 25 additions and 5 deletions

View File

@ -64,6 +64,26 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
})
return false;
})
$("div[container=true]").unbind("click").on("click",".journal_paper_delete",function(){
var delurl = $(this).attr("href");
var parent = $(this).parent();
o.confirm({
buttons : ["Yes","No"],
highlighted : 2,
message : "Are you sure, you want to delete this paper?"
},function(value){
if(value){
$.ajax({
url : delurl,
type : "DELETE",
success : function(){
parent.slideOut();
}
})
}
})
return false;
})
}
@ -89,7 +109,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des">'+paper.title+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a></li>');
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des">'+paper.title+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a> <a class="journal_paper_delete" href="'+paper.url_delete+'">Delete</a></li>');
column.find("ul").append(li);
if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column);
@ -118,7 +138,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
var img = $('<div class="list_t_des"><a href="'+file.url+'" target="_blank" ><img src="'+file.icon+'" />'+thistitle+'</a></div>');
li.append(img);
})
li.append('<a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a>');
li.append('<a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a> <a class="journal_paper_delete" href="'+paper.url_delete+'">Delete</a>');
column.find("ul").append(li);
if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column);
@ -137,7 +157,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.keywords+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a></li>');
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.keywords+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a> <a class="journal_paper_delete" href="'+paper.url_delete+'">Delete</a></li>');
column.find("ul").append(li);
if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column);
@ -157,7 +177,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a></li>');
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a> <a class="journal_paper_delete" href="'+paper.url_delete+'">Delete</a></li>');
column.find("ul").append(li);
if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column);
@ -176,7 +196,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item" style="height:auto;"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.abstract+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a></li>');
li = $('<li class="list_t_item" style="height:auto;"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.abstract+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a> <a class="journal_paper_delete" href="'+paper.url_delete+'">Delete</a></li>');
column.find("ul").append(li);
$("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>');