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

Version Path
platformx-0.0.9.7.2 lib/platformx/notify.rb
platformx-0.0.9.7.1 lib/platformx/notify.rb
platformx-0.0.9.6.6.7 lib/platformx/notify.rb
platformx-0.0.9.6.6.6 lib/platformx/notify.rb
platformx-0.0.9.6.6.5 lib/platformx/notify.rb
platformx-0.0.9.6.6.4 lib/platformx/notify.rb
platformx-0.0.9.6.6.3 lib/platformx/notify.rb
platformx-0.0.9.6.6.2 lib/platformx/notify.rb
platformx-0.0.9.6.6.1 lib/platformx/notify.rb
platformx-0.0.9.6.4 lib/platformx/notify.rb
platformx-0.0.9.6.3 lib/platformx/notify.rb
platformx-0.0.9.6.2 lib/platformx/notify.rb
platformx-0.0.9.6.1 lib/platformx/notify.rb
platformx-0.0.9.6 lib/platformx/notify.rb
platformx-0.0.9.5 lib/platformx/notify.rb
platformx-0.0.9.4 lib/platformx/notify.rb
platformx-0.0.9.3 lib/platformx/notify.rb
platformx-0.0.9.2 lib/platformx/notify.rb
platformx-0.0.9 lib/platformx/notify.rb
platformx-0.0.8.9.9.9 lib/platformx/notify.rb