Module: MyForum::ApplicationHelper

Defined in:
app/helpers/my_forum/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#draw_navigationObject



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 draw_navigation
  html_li  =  :li, link_to('Forums', root_path)

  if @forum
    html_li +=  :li, '→'.html_safe
    html_li +=  :li, link_to(@forum.name, forum_path(@forum))
  end

  if @forum && @topic && !@topic.new_record?
    html_li +=  :li, '→'.html_safe
    html_li +=  :li, link_to(@topic.name.html_safe, forum_topic_path(@forum, @topic))
  end

  html =  :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?

   :div, obj.errors.full_messages.to_sentence, class: 'errors_for'
end

#online_usersObject



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_usersObject



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_extensionsObject



43
44
45
# File 'app/helpers/my_forum/application_helper.rb', line 43

def upload_allowed_extensions
  Attachment::ALLOWED_FILE_EXTENSIONS
end