Darkswarm flash loader works with :notice flash messages

This commit is contained in:
Rob Harrington
2017-05-31 12:05:00 +10:00
parent 73041e9263
commit 7beb6e624c
2 changed files with 12 additions and 1 deletions

View File

@@ -1,7 +1,18 @@
Darkswarm.factory 'RailsFlashLoader', (flash, railsFlash)->
new class RailsFlashLoader
# The 'flash' service requires type key to
# be one of: success, info, warn, error
typePairings:
success: 'success'
error: 'error'
notice: 'success'
info: 'info'
warn: 'warn'
initFlash: ->
@loadFlash railsFlash
loadFlash: (rails_flash)->
for type, message of rails_flash
type = @typePairings[type]
flash[type] = message

View File

@@ -1,2 +1,2 @@
object OpenStruct.new(flash.to_hash)
attributes :info, :success, :error
attributes :info, :success, :error, :notice