Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
KludgeKML committed Sep 4, 2024
1 parent 499d8fa commit d765c5d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 29 deletions.
24 changes: 0 additions & 24 deletions app/controllers/concerns/content_item_loader.rb

This file was deleted.

4 changes: 4 additions & 0 deletions app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def content_item
@content_item ||= request.env[:content_item] || request_content_item(content_item_slug || "/#{params[:slug]}")
end

def content_item_obj
@content_item_object = ContentItemFactory.build(content_item)
end

def content_item_slug
nil # set to override content item fetched from Content Store
end
Expand Down
6 changes: 1 addition & 5 deletions app/controllers/take_part_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
class TakePartController < ContentItemsController
include ContentItemLoader

def model_type
TakePart
end
helper_method :view_context

def content_item_slug
request.path
Expand Down
11 changes: 11 additions & 0 deletions app/models/content_item_factory.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class ContentItemFactory
def self.build(content_hash)
content_item_class(content_hash).new(content_hash)
end

def self.content_item_class(content_hash)
return TakePart if content_hash["document_type"] == "take_part"

ContentItem
end
end

0 comments on commit d765c5d

Please sign in to comment.