Module: MyForum::ApplicationHelper
- Defined in:
- app/helpers/my_forum/application_helper.rb
Instance Method Summary collapse
- #draw_navigation ⇒ Object
- #errors_for(obj) ⇒ Object
- #online_users ⇒ Object
-
#time(datetime) ⇒ Object
TODO deprecate!.
- #today_was_users ⇒ Object
- #upload_allowed_extensions ⇒ Object
Instance Method Details
#draw_navigation ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/my_forum/application_helper.rb', line 4 def html_li = content_tag :li, link_to('Forums', root_path) if @forum html_li += content_tag :li, '→'.html_safe html_li += content_tag :li, link_to(@forum.name, forum_path(@forum)) end if @forum && @topic && !@topic.new_record? html_li += content_tag :li, '→'.html_safe html_li += content_tag :li, link_to(@topic.name.html_safe, forum_topic_path(@forum, @topic)) end html = content_tag :ul, class: 'draw-navigation' do html_li end html.html_safe end |
#errors_for(obj) ⇒ Object
32 33 34 35 36 |
# File 'app/helpers/my_forum/application_helper.rb', line 32 def errors_for(obj) return if obj.errors.blank? content_tag :div, obj.errors..to_sentence, class: 'errors_for' end |
#online_users ⇒ Object
24 25 26 |
# File 'app/helpers/my_forum/application_helper.rb', line 24 def online_users User.online.pluck(:login).join(', ') end |
#time(datetime) ⇒ Object
TODO deprecate!
39 40 41 |
# File 'app/helpers/my_forum/application_helper.rb', line 39 def time(datetime) forum_time(datetime) end |
#today_was_users ⇒ Object
28 29 30 |
# File 'app/helpers/my_forum/application_helper.rb', line 28 def today_was_users User.today_visited.pluck(:login).join(', ') end |
#upload_allowed_extensions ⇒ Object
43 44 45 |
# File 'app/helpers/my_forum/application_helper.rb', line 43 def upload_allowed_extensions Attachment::ALLOWED_FILE_EXTENSIONS end |