From da581331c706f46dfd119d1e532152c93fdd8c58 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Sat, 20 Nov 2010 15:38:28 -0600 Subject: total refactor here --- app/controllers/blog/posts_controller.rb | 4 ---- app/views/blog/posts/_post.html.erb | 7 ++++++- app/views/blog/posts/show.html.erb | 5 ----- config/routes.rb | 1 - public/javascripts/refinerycms-blog.js | 15 ++------------- 5 files changed, 8 insertions(+), 24 deletions(-) diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index 10ec867..95ccbbe 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -28,10 +28,6 @@ class Blog::PostsController < BlogController end end end - - def update_nav - render :partial => 'nav' - end def comment if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid? diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb index f34091a..c5e90bb 100644 --- a/app/views/blog/posts/_post.html.erb +++ b/app/views/blog/posts/_post.html.erb @@ -20,4 +20,9 @@ <% if BlogPost::ShareThis.enabled? %> <% end %> - \ No newline at end of file + +<% if next_or_previous?(@blog_post) -%> + +<% end -%> \ No newline at end of file diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb index d277ef5..1c725d5 100644 --- a/app/views/blog/posts/show.html.erb +++ b/app/views/blog/posts/show.html.erb @@ -10,11 +10,6 @@ <% content_for :body_content_left do %>
<%= render 'post' %> - <% if next_or_previous?(@blog_post) -%> - - <% end -%>
<% if BlogPost.comments_allowed? %> diff --git a/config/routes.rb b/config/routes.rb index 1474c3f..01fb501 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -42,7 +42,6 @@ else match 'categories/:id', :to => 'categories#show', :as => 'blog_category' match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments' get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts' - get ':id/update_nav.js', :to => 'posts#update_nav', :as => 'update_blog_nav' end scope(:path => 'refinery', :as => 'admin', :module => 'admin') do diff --git a/public/javascripts/refinerycms-blog.js b/public/javascripts/refinerycms-blog.js index 5b586a0..c5512d2 100644 --- a/public/javascripts/refinerycms-blog.js +++ b/public/javascripts/refinerycms-blog.js @@ -1,25 +1,14 @@ $(document).ready(function(){ - height = $('#show_blog_post').height(); - $('#show_blog_post').height(height); $('#next_prev_article a:not(".home")').live('click',function(){ url = this.href + ".js"; nav_url = $(this).attr('data-nav-url'); - $('#blog_post, #next_prev_article').fadeOut(); + $('#show_blog_post').fadeOut(); $.ajax({ url: url, success: function(data) { - $('#blog_post').html(data).fadeIn(); - $.ajax({ - url: nav_url, - success: function(data) { - $('#next_prev_article').html(data).fadeIn(); - } - }) + $('#show_blog_post').html(data).fadeIn(); } }); - $('#show_blog_post').animate({ - height: 'auto' - }); return false; }) }) \ No newline at end of file -- cgit v1.2.3