mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
19 lines
489 B
CoffeeScript
19 lines
489 B
CoffeeScript
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
|