Module: ForumHelper
- Includes:
- ReaderHelper
- Defined in:
- app/helpers/forum_helper.rb
Instance Method Summary collapse
- #edit_link(post) ⇒ Object
- #feed_link(url) ⇒ Object
- #link_to_forum(forum, options = {}) ⇒ Object
- #link_to_post(post, options = {}) ⇒ Object
- #link_to_topic(topic, options = {}) ⇒ Object
- #paginated_post_url(post) ⇒ Object
- #remove_link(post) ⇒ Object
- #using_forums? ⇒ Boolean
Instance Method Details
#edit_link(post) ⇒ Object
42 43 44 |
# File 'app/helpers/forum_helper.rb', line 42 def edit_link(post) link_to t('forum_extension.edit'), edit_topic_post_url(post.topic, post), :class => 'edit_post', :id => "edit_post_#{post.id}", :title => t("forum_extension.edit_post") end |
#feed_link(url) ⇒ Object
10 11 12 13 14 |
# File 'app/helpers/forum_helper.rb', line 10 def feed_link(url) if Radiant.config['forum.offer_rss?'] link_to image_tag('/images/furniture/feed_14.png', :alt => t('forum_extension.rss_feed')), url, :class => "rssfeed" end end |
#link_to_forum(forum, options = {}) ⇒ Object
27 28 29 30 |
# File 'app/helpers/forum_helper.rb', line 27 def link_to_forum(forum, ={}) title = .delete(:title) || forum.title link_to title, forum_url(forum), end |
#link_to_post(post, options = {}) ⇒ Object
37 38 39 40 |
# File 'app/helpers/forum_helper.rb', line 37 def link_to_post(post, ={}) title = .delete(:title) || post.holder.title link_to title, paginated_post_url(post), end |
#link_to_topic(topic, options = {}) ⇒ Object
32 33 34 35 |
# File 'app/helpers/forum_helper.rb', line 32 def link_to_topic(topic, ={}) title = .delete(:title) || topic.title link_to title, topic_url(topic), end |
#paginated_post_url(post) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/forum_helper.rb', line 16 def paginated_post_url(post) param_name = WillPaginate::ViewHelpers.[:param_name] if post.page "post.page.url?#{param_name}=#{post.page_when_paginated}##{post.dom_id}" elsif post.first? topic_post_url(post.topic, post) else topic_post_url(post.topic, post, {param_name => post.page_when_paginated, :anchor => post.dom_id}) end end |
#remove_link(post) ⇒ Object
46 47 48 |
# File 'app/helpers/forum_helper.rb', line 46 def remove_link(post) link_to t('forum_extension.delete'), topic_post_url(post.topic, post), :method => 'delete', :class => 'delete_post', :id => "delete_post_#{post.id}", :title => t("remove_post"), :confirm => t('forum_extension.really_remove_post') end |
#using_forums? ⇒ Boolean
5 6 7 8 |
# File 'app/helpers/forum_helper.rb', line 5 def using_forums? @forums_found = Forum.count > 1 unless defined? @forums_found @forums_found end |