diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml index c4b0fc90b..75fd72716 100644 --- a/app/views/blogs/_blog.html.haml +++ b/app/views/blogs/_blog.html.haml @@ -14,4 +14,4 @@ - if mine?(post) .destroy_link - = link_to 'Delete', blog_path(post), :confirm => 'Are you sure?', :method => :delete + = link_to 'Delete', blog_path(post), :confirm => 'Are you sure?', :method => :delete, :remote=> true diff --git a/app/views/bookmarks/_bookmark.html.haml b/app/views/bookmarks/_bookmark.html.haml index 4b5ab6865..9e58d056f 100644 --- a/app/views/bookmarks/_bookmark.html.haml +++ b/app/views/bookmarks/_bookmark.html.haml @@ -15,4 +15,4 @@ - if mine?(post) .destroy_link - = link_to 'Delete', bookmark_path(post), :confirm => 'Are you sure?', :method => :delete + = link_to 'Delete', bookmark_path(post), :confirm => 'Are you sure?', :method => :delete, :remote => true diff --git a/app/views/status_messages/_status_message.html.haml b/app/views/status_messages/_status_message.html.haml index f90687e61..f3e94c09d 100644 --- a/app/views/status_messages/_status_message.html.haml +++ b/app/views/status_messages/_status_message.html.haml @@ -11,4 +11,4 @@ - if mine?(post) .destroy_link - = link_to 'Delete', status_message_path(post), :confirm => 'Are you sure?', :method => :delete + = link_to 'Delete', status_message_path(post), :confirm => 'Are you sure?', :method => :delete, :remote => true diff --git a/public/javascripts/publisher.js b/public/javascripts/publisher.js index ad7ff2f09..d3fad10c9 100644 --- a/public/javascripts/publisher.js +++ b/public/javascripts/publisher.js @@ -1,38 +1,19 @@ $(document).ready( function() { - $("#publisher_content_pickers .status_message").click(function(){ - if( $("#new_status_message").css("display") == "none" ) { + $("#publisher_content_pickers .status_message").click(selectPublisherTab); + + $("#publisher_content_pickers .bookmark").click(selectPublisherTab); + + $("#publisher_content_pickers .blog").click(selectPublisherTab); + + function selectPublisherTab(){ + var form_id = "#new_" + this.className + if( $(form_id).css("display") == "none" ) { $("#publisher_content_pickers").children("li").removeClass("selected"); $("#publisher_form form").fadeOut(50); $(this).toggleClass("selected"); - $("#new_status_message").delay(50).fadeIn(200); + $(form_id).delay(50).fadeIn(200); } - }); - - $("#publisher_content_pickers .bookmark").click(function(){ - if( $("#new_bookmark").css("display") == "none" ) { - $("#publisher_content_pickers").children("li").removeClass("selected"); - $("#publisher_form form").fadeOut(50); - - $(this).toggleClass("selected"); - $("#new_bookmark").delay(50).fadeIn(200); - } - }); - - $("#publisher_content_pickers .blog").click(function(){ - if( $("#new_blog").css("display") == "none" ) { - $("#publisher_content_pickers").children("li").removeClass("selected"); - $("#publisher_form form").fadeOut(50); - - $(this).toggleClass("selected"); - $("#new_blog").delay(50).fadeIn(200); - } - }); - - //$("#publisher").mouseout(function(){ - //$("#publisher_form form").fadeOut(200); - //$("#publisher_content_pickers li").removeClass("selected"); - //}); - + } });