Skip to content

Commit

Permalink
Remove scaffolding from controller
Browse files Browse the repository at this point in the history
- landing page content items are now fully available from
  content store (in practise) and publishing-api schemas
  (during tests), so this scaffolding is now no longer necessary.
- we no longer need to skip the before action.
  • Loading branch information
KludgeKML committed Feb 24, 2025
1 parent abfecf4 commit bf07822
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions app/controllers/landing_page_controller.rb
Original file line number Diff line number Diff line change
@@ -1,44 +1,3 @@
class LandingPageController < ContentItemsController
slimmer_template "gem_layout_full_width"
skip_before_action :set_content_item_and_cache_control

private

# SCAFFOLDING: can be removed when basic content items are available
# from content-store
def content_item
@content_item ||= ContentItemFactory.build(old_scaffolding_content_item)
end

# SCAFFOLDING: can be removed when basic content items are available
# from content-store
def old_scaffolding_content_item
result = ContentItemLoader.for_request(request).load(request.path)
return result.to_h if result.is_a?(GdsApi::Response)

fake_data
end

# SCAFFOLDING: can be removed when basic content items are available
# from content-store
def fake_data
{
"base_path" => request.path,
"title" => "Landing Page",
"description" => "A landing page example",
"locale" => "en",
"document_type" => "landing_page",
"schema_name" => "landing_page",
"publishing_app" => "whitehall",
"rendering_app" => "frontend",
"update_type" => "major",
"details" => {},
"routes" => [
{
"type" => "exact",
"path" => request.path,
},
],
}
end
end

0 comments on commit bf07822

Please sign in to comment.