module Platformx::NotifyHelpers
Notification helpers @author Tim Mushen
Public Instance Methods
x_notify(flash: "", timer: 4000, align: "right", from:"top")
click to toggle source
Notify view helper @param flash [Object] flash object @param timer [Integer] the length the notify should show @param align [String] the alignment of the notify (left or right) @param from [String] the location of the notify @return [String] rendered notify message (js script)
# File lib/platformx/notify.rb, line 13 def x_notify(flash: "", timer: 4000, align: "right", from:"top") color = "success" message = "" if !flash[:success].nil? message = flash[:success] color = "success" end if !flash[:notice].nil? message = flash[:notice] color = "warning" end if !flash[:error].nil? message = flash[:error] color = "danger" end unless message == "" cb = <<EOS <script> $().ready(function(){$.notify({message: "#{message}"},{type: "#{color}",timer: #{timer}, placement: {from: "#{from}",align: "#{align}"}});}); </script> EOS return cb end end