From 292c2e4a031360e5b58385f4b6b7f3e47a8ca988 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 11 Oct 2023 16:39:45 -0400 Subject: Fixed broken blog post urls --- app/controllers/admin/blogs_controller.rb | 2 +- app/views/admin/blogs/_form.html.haml | 2 +- app/views/admin/blogs/index.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/controllers/admin/blogs_controller.rb b/app/controllers/admin/blogs_controller.rb index c6d0168..8e288a8 100644 --- a/app/controllers/admin/blogs_controller.rb +++ b/app/controllers/admin/blogs_controller.rb @@ -13,7 +13,7 @@ class Admin::BlogsController < Admin::AdminController @blog = Blog.find(params[:id]) if @blog.published - redirect_to blog_post_url(@blog.slug) + redirect_to @blog else render layout: "application" end diff --git a/app/views/admin/blogs/_form.html.haml b/app/views/admin/blogs/_form.html.haml index 01177c1..625c85e 100644 --- a/app/views/admin/blogs/_form.html.haml +++ b/app/views/admin/blogs/_form.html.haml @@ -18,7 +18,7 @@ - unless f.object.new_record? #entry-preview-link.details-module - if f.object.published - = link_to "View post", blog_post_url(f.object.slug_was), target: "entry-preview" + = link_to "View post", blog_url(f.object.slug_was), target: "entry-preview" - else = link_to "Preview post", admin_blog_url(f.object.id), target: "entry-preview" .details-module diff --git a/app/views/admin/blogs/index.html.haml b/app/views/admin/blogs/index.html.haml index c74fef5..ebe1b68 100644 --- a/app/views/admin/blogs/index.html.haml +++ b/app/views/admin/blogs/index.html.haml @@ -10,5 +10,5 @@ %td= blog.published_at.strftime("%B %d, %Y, %l:%M%P") %td %ul.admin-actions - %li= link_to "View", blog_post_url(blog.slug) + %li= link_to "View", blog %li= link_to "Edit", edit_admin_blog_url(blog.id) -- cgit 1.4.1