Module: NotificationCis::ViewHelpers

Defined in:
lib/notification_cis/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#flash_helper(flash_message) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/notification_cis/view_helpers.rb', line 3

def flash_helper(flash_message)
	messages = "<script type=\"text/javascript\">"
   if flash_message[:notice]
     messages += "$.n.success(\"#{ flash_message[:notice] }\");"
   end
   if flash_message[:error]
     messages += "$.n.error(\"#{ flash_message[:error] }\");"
   end
   if flash_message[:success]
     messages += "$.n.success(\"#{ flash_message[:success]}\");"
   end
   if flash_message[:alert]
     messages += "$.n.warning(\"#{ flash_message[:alert]}\");"
   end
   messages += "</script>"
   messages.html_safe
end