From fffd3aebfc97783fc889253fa6b4876872a58e73 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 2 Jul 2010 15:36:07 -0700 Subject: [PATCH 1/2] Added remote is true to stream partials, no more redirecting --- app/views/blogs/_blog.html.haml | 2 +- app/views/bookmarks/_bookmark.html.haml | 2 +- app/views/status_messages/_status_message.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 From a0cdd7cb0ed3caaefb7540aacd3c40f6c8eb08ef Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 3 Jul 2010 13:14:29 -0700 Subject: [PATCH 2/2] RS; Refactored publisher, tested it, it seems to work perfectly, but I could be wrong. --- public/javascripts/publisher.js | 36 ++++++++++----------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/public/javascripts/publisher.js b/public/javascripts/publisher.js index dd5094aee..d3fad10c9 100644 --- a/public/javascripts/publisher.js +++ b/public/javascripts/publisher.js @@ -1,33 +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); - } - }); - + } });