Sha256: ae4a3f61d09460553e33340ea31e11ff5ac1b4716c7eed9401e1152eac40763e
Contents?: true
Size: 802 Bytes
Versions: 3
Compression:
Stored size: 802 Bytes
Contents
module TypeStation class PagePresenter < BasePresenter presents :page delegate :to_param, :title, :path, :slug, :template_name, :template_name?, :redirect_to, :redirect?, to: :page def initialize(object, template) super(object, template) build_content_methods end def edit_url h.type_station.admin_page_url(page) end def children @children ||= page.children.map {|p| PagePresenter.new(p, @template)} end def parent @parent ||= PagePresenter.new(page.parent, @template) end private def build_content_methods page.content_attributes.each do |key, content_object| self.class.send :define_method, key do ContentPresenter.new(content_object, @template) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems