Module: HelpPopups::ApplicationHelper

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

Instance Method Summary collapse

Instance Method Details

#help_popup(topic_code) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/help_popups/application_helper.rb', line 3

def help_popup(topic_code)
  @topic = Topic.where(:code => topic_code).first
  if (@topic.nil?)
    return_html = image_tag("help_popup.gif", :title => "Topic Missing", :style => "cursor:pointer", :onclick => "alert('Unrecognized Help Code. Please contact Administrator');")
  else
    return_html =               "<div id='help_popup_" + topic_code + "' class='help_popup' style='display:none'>"
    return_html = return_html + "  <div style='border-bottom:1px solid #333333'>"
    return_html = return_html + "    <div style='float:left' class='help_popup_title'>" + @topic.title + "</div>"
    return_html = return_html + "    <div style='float:right'>"
    return_html = return_html + "      <a href='#' style='color:#FF0000;font-weight:bold;text-decoration:none' onclick='document.getElementById(\"help_popup_" + topic_code + "\").style.display=\"none\";'>" + image_tag("close-button.png", :title => "Close Button Missing", :style => "cursor:pointer") + "</a>"
    return_html = return_html + "    </div>"
    return_html = return_html + "    <div style='clear:both'></div>"
    return_html = return_html + "  </div>"
    return_html = return_html + "  <div class='help_popup_body'>" + @topic.body.html_safe + "</div>"
    return_html = return_html + "</div>"
    return_html = return_html + image_tag("help_popup.gif", :title => @topic.title, :style => "cursor:pointer", :onclick => "document.getElementById(\"help_popup_" + topic_code + "\").style.display=\"inline\";")
    return_html.html_safe
  end
end