diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index 1ee9f55d4..ecac6ee5a 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -1,6 +1,4 @@ class ContentController < ApplicationController - include ContentHelper - def accessibility_statement render_content_page :accessibility_statement end @@ -8,4 +6,19 @@ class ContentController < ApplicationController def privacy_notice render_content_page :privacy_notice, page_title: "Privacy notice for tenants and buyers of new social housing" end + +private + + def render_content_page(page_name, page_title: nil, locals: {}) + raw_content = File.read("app/views/content/#{page_name}.md") + content_with_erb_tags_replaced = ApplicationController.renderer.render( + inline: raw_content, + locals:, + ) + + @page_title = page_title || page_name.to_s.humanize + @page_content = GovukMarkdown.render(content_with_erb_tags_replaced).html_safe + + render "content/page" + end end diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb deleted file mode 100644 index 1f81e9a3c..000000000 --- a/app/helpers/content_helper.rb +++ /dev/null @@ -1,14 +0,0 @@ -module ContentHelper - def render_content_page(page_name, page_title: nil, locals: {}) - raw_content = File.read("app/views/content/#{page_name}.md") - content_with_erb_tags_replaced = ApplicationController.renderer.render( - inline: raw_content, - locals:, - ) - - page_title ||= page_name.to_s.humanize - page_content = GovukMarkdown.render(content_with_erb_tags_replaced).html_safe - - render "content/page", locals: { page_title:, page_content: } - end -end diff --git a/app/views/content/page.html.erb b/app/views/content/page.html.erb index 87b59160e..39acc46f9 100644 --- a/app/views/content/page.html.erb +++ b/app/views/content/page.html.erb @@ -1,9 +1,9 @@ -<%= content_for :title, page_title %> +<%= content_for :title, @page_title %>