mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-11 23:17:48 +00:00
Darkswarm flash loader works with :notice flash messages
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
object OpenStruct.new(flash.to_hash)
|
||||
attributes :info, :success, :error
|
||||
attributes :info, :success, :error, :notice
|
||||
|
||||
Reference in New Issue
Block a user