Skip to content

Commit

Permalink
Don't attempt to render pages for Governments
Browse files Browse the repository at this point in the history
This content is new to the Publishing API, and while I believe
Government Frontend is the appropriate place for it to be rendered, I
want to put of that decision, and the decisions around how to render
it until after the intended changes to history mode have been made, as
that's what I'm focusing on.
  • Loading branch information
Christopher Baines committed Nov 25, 2019
1 parent ece9e7f commit b15bec7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class ContentItemsController < ApplicationController
rescue_from ActionController::UnknownFormat, with: :error_406
rescue_from PresenterBuilder::RedirectRouteReturned, with: :error_redirect
rescue_from PresenterBuilder::SpecialRouteReturned, with: :error_notfound
rescue_from PresenterBuilder::GovernmentReturned, with: :error_notfound

attr_accessor :content_item, :taxonomy_navigation

Expand Down
6 changes: 6 additions & 0 deletions app/services/presenter_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def initialize(content_item, content_item_path)
def presenter
raise SpecialRouteReturned if special_route?
raise RedirectRouteReturned, content_item if redirect_route?
raise GovernmentReturned if government_content_item?

presenter_name.constantize.new(content_item, content_item_path)
end
Expand All @@ -23,6 +24,10 @@ def redirect_route?
content_item && content_item["schema_name"] == "redirect"
end

def government_content_item?
content_item && content_item["document_type"] == "government"
end

def presenter_name
if service_sign_in_format?
return service_sign_in_presenter_name
Expand Down Expand Up @@ -57,4 +62,5 @@ def initialize(content_item)
end
end
class SpecialRouteReturned < StandardError; end
class GovernmentReturned < StandardError; end
end

0 comments on commit b15bec7

Please sign in to comment.