|
- module ForumsHelper
- def forum_breadcrumb(item)
- forum = item.is_a?(Memo) ? item.forum : item
- links = [link_to(l(:label_forum_plural), forums_path(item))]
- forums = forum.ancestors.reverse
- if item.is_a?(Memo)
- forums << forum
- end
- links += forums.map {|ancestor| link_to(h(ancestor.name), forum_path(ancestor))}
- breadcrumb links
- end
-
- def forums_options_for_select(forums)
- options = []
- Forum.forum_tree(forums) do |forum, level|
- label = (level > 0 ? ' ' * 2 * level + '» ' : '').html_safe
- label << forum.name
- options << [label, forum.id]
- end
- options
- end
-
- # this method is used to get all projects that tagged one tag
- # added by william
- def get_forums_by_tag(tag_name)
- Forum.tagged_with(tag_name).order('updated_at desc')
- end
- end
|