Module: ForumHelper

Defined in:
app/helpers/forum_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_name_for_moderator(user) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/forum_helper.rb', line 12

def display_name_for_moderator(user)
  color = 'black'
  color = 'orange' if user.forum_status > 2
  color = 'red' if user.forum_status > 5
  color = 'green' if user.forum_status == -1
  
  ( "[" +
    link_to(user.email, "/admin/user/#{user.id}") +
  "] <span class='#{color}'>" +
    user.display_name + 
    "</span> " +
    ('*' * user.spam_points.to_i)).html_safe
end

#extra_profile(post) ⇒ Object



26
27
28
29
30
31
32
# File 'app/helpers/forum_helper.rb', line 26

def extra_profile(post)
  b = Block.cache_get(_sid, "Forum: extra profile")

  return nil unless b

  render :inline=>b.body, :locals=>{:post=>post}
end

#forum_search(search_for, page, per, topic_ids = nil) ⇒ Object



7
8
9
10
# File 'app/helpers/forum_helper.rb', line 7

def forum_search(search_for, page, per, topic_ids = nil)
  # need to get list of topic_ids visible to this user (unless a topic_id is provided)
  # then do search, similar to forum_controller search
end

#forums_nameObject



38
39
40
# File 'app/helpers/forum_helper.rb', line 38

def forums_name
  Preference.getCached(_sid, "forums_name", "Forums")
end

#level_okay(minimum_level) ⇒ Object



42
43
44
45
46
47
# File 'app/helpers/forum_helper.rb', line 42

def level_okay(minimum_level)
  return true if minimum_level == 0
  return false unless current_user
  return true if current_user.forum_level >= minimum_level
  return false
end

#order_arrow(o) ⇒ Object



49
50
51
# File 'app/helpers/forum_helper.rb', line 49

def order_arrow(o) 
  return (o == 'desc' ? "&darr;" : "&uarr;").html_safe
end

#search(options = {}) ⇒ Object



34
35
36
# File 'app/helpers/forum_helper.rb', line 34

def search(options = {})
  render :partial=>"forum/search_form"
end

#use_markdown_editorObject



3
4
5
# File 'app/helpers/forum_helper.rb', line 3

def use_markdown_editor
 (sys_pref('use_markdown_editor')=='true' && !is_mobile?) ? 'true' : 'false'
end