Sha256: 21a0faf34becc07115c0d963d06c8d53ff75a9f3c8f9f8d6b72b14faf98c1901
Contents?: true
Size: 993 Bytes
Versions: 1
Compression:
Stored size: 993 Bytes
Contents
class ForumPage < Page attr_accessor :forum, :topic, :post helper_method :forum, :topic, :post, :forums, :topics, :posts description I18n.t 'forum_page.description' def cache? !restricted? end def find_by_path(path, live = true, clean = true) path = clean_path(path) if clean my_path = self.path_without_parts if path =~ /^#{Regexp.quote(my_path)}(.*)/ read_parameters($1) self else nil end end def read_parameters(path) unless path.blank? parts = path.split(/\/+/) if forum_id = parts.pop forum = Forum.find(@forum_id) if topic_id = parts.pop topic = forum.topics.find(@topic_id) if post_id = parts.pop post = topic.posts.find(@topic_id) end end end end end def forums Forum.visible_to(Reader.current) end def topics Topic.visible_to(Reader.current) end def posts Post.visible_to(Reader.current) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
radiant-forum-extension-3.0.7 | app/models/forum_page.rb |