Sha256: fd50b17809958d69bba53c8dd44b75abb64365a3827741744847e2ee1d3f4c26
Contents?: true
Size: 739 Bytes
Versions: 20
Compression:
Stored size: 739 Bytes
Contents
require 'volt/models/persistors/base' module Persistors class Flash < Base def initialize(model) @model = model end def added(model, index) if Volt.client? # Setup a new timer for clearing the flash. %x{ setTimeout(function() { self.$clear_model(model); }, 5000); } end end def clear_model(model) @model.delete(model) # Clear out the parent collection (usually the main flash) # Makes it so flash.empty? reflects if there is any outstanding # flashes. if @model.size == 0 collection_name = @model.path[-1] @model.parent.delete(collection_name) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems