Module: Thredded::ApplicationHelper
- Defined in:
- app/helpers/thredded/application_helper.rb
Instance Method Summary collapse
- #edit_post_path(post) ⇒ Object
- #paginate(collection, args = {}) ⇒ Object
-
#thredded_page(&block) ⇒ Object
Render the page container with the supplied block as content.
-
#time_ago(datetime) ⇒ String
Html_safe datetime presentation.
-
#user_link(user) ⇒ String
Html_safe link to the user.
-
#user_path(user) ⇒ String
Path to the user as specified by user_path.
Instance Method Details
#edit_post_path(post) ⇒ Object
33 34 35 36 37 38 39 |
# File 'app/helpers/thredded/application_helper.rb', line 33 def edit_post_path(post) if post.private_topic_post? edit_private_topic_private_post_path(post.postable, post) else (, post.postable, post) end end |
#paginate(collection, args = {}) ⇒ Object
29 30 31 |
# File 'app/helpers/thredded/application_helper.rb', line 29 def paginate(collection, args = {}) super(collection, args.reverse_merge(views_prefix: 'thredded')) end |
#thredded_page(&block) ⇒ Object
Render the page container with the supplied block as content.
4 5 6 7 8 9 |
# File 'app/helpers/thredded/application_helper.rb', line 4 def thredded_page(&block) # enable the host app to easily check whether a thredded view is being rendered: content_for :thredded, true content_for :thredded_page_content, &block render partial: 'thredded/shared/page' end |
#time_ago(datetime) ⇒ String
Returns html_safe datetime presentation.
25 26 27 |
# File 'app/helpers/thredded/application_helper.rb', line 25 def time_ago(datetime) render partial: 'thredded/shared/time_ago', locals: { datetime: datetime } end |
#user_link(user) ⇒ String
Returns html_safe link to the user.
19 20 21 |
# File 'app/helpers/thredded/application_helper.rb', line 19 def user_link(user) render partial: 'thredded/users/link', locals: { user: user } end |
#user_path(user) ⇒ String
Returns path to the user as specified by Thredded.user_path.
13 14 15 |
# File 'app/helpers/thredded/application_helper.rb', line 13 def user_path(user) Thredded.user_path(self, user) end |