Sha256: a712273cac88a80aa2bd9e0e4413b4ea539d610caf1e6b3360c860e6293cb009
Contents?: true
Size: 934 Bytes
Versions: 41
Compression:
Stored size: 934 Bytes
Contents
module Platformx # Notification helpers # @author Tim Mushen module NotifyHelpers # 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) 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 end end
Version data entries
41 entries across 41 versions & 1 rubygems