diff --git a/app/helpers/navigation_helper.rb b/app/helpers/navigation_helper.rb index 3bdb47b4e..0c4523b9f 100644 --- a/app/helpers/navigation_helper.rb +++ b/app/helpers/navigation_helper.rb @@ -7,8 +7,6 @@ def setup_breadcrumb_navigation session[:breadcrumbs] = session[:breadcrumbs] || [] session[:heading] = nil session[:description] = nil - session[:page_image] = nil - session[:page_image_alt_text] = nil action = params[:action] controller = params[:controller] @@ -246,10 +244,6 @@ def add_landing_page_breadcrumb(path) if @page.is_visible? session[:heading] = @page.title session[:description] = @page.description - if @page.image.present? - session[:page_image] = @page.image_s3_presigned_url(:thumb) - session[:page_image_alt_text] = @page.image_alt_text - end end end end diff --git a/app/models/page.rb b/app/models/page.rb index 5de46c03a..cdacc65a5 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -18,11 +18,9 @@ class Page < ApplicationRecord case_sensitive: false validates :slug, format: { with: Regexp.new('\A' + SLUG_FORMAT.source + '\z'), message: "invalid characters in URL" } - validates_attachment :image, - content_type: { - content_type: %w[image/jpg image/jpeg image/png], - message: "must be one of the following types: jpg, jpeg, or png" - } + validates_attachment_content_type :image, + content_type: ["image/jpg", "image/jpeg", "image/png"], + message: "must be one of the following types: jpg, jpeg, or png" validates :image_alt_text, presence: { message: "can't be blank if Page image is present" }, if: Proc.new { |page| page.image.present? } diff --git a/app/views/shared/_breadcrumbs.html.erb b/app/views/shared/_breadcrumbs.html.erb index 6ddbcb1fb..1d859b3b4 100644 --- a/app/views/shared/_breadcrumbs.html.erb +++ b/app/views/shared/_breadcrumbs.html.erb @@ -16,8 +16,8 @@ breadcrumbs.pop end - page_image = session[:page_image] - alt_text = session[:page_image_alt_text] + page_image = @page.present? && @page.image.present? ? @page.image_s3_presigned_url(:thumb) : nil + alt_text = @page.present? && @page.image_alt_text.present? ? @page.image_alt_text : nil %> <% if @page_group&.is_community? && @page.is_subnav_page # only shown on mobile width %> diff --git a/app/views/shared/_page_heading_banner.html.erb b/app/views/shared/_page_heading_banner.html.erb index b82d9c186..aec1cb98e 100644 --- a/app/views/shared/_page_heading_banner.html.erb +++ b/app/views/shared/_page_heading_banner.html.erb @@ -14,7 +14,7 @@ <% if page_image.present? %>