Skip to content

Instantly share code, notes, and snippets.

@ionox0
Last active August 29, 2015 14:04
Show Gist options
  • Save ionox0/bf34dd0319029dc7823f to your computer and use it in GitHub Desktop.
Save ionox0/bf34dd0319029dc7823f to your computer and use it in GitHub Desktop.
MM:
App.request('get:photos:recent').fetch().done ->
App.vent.trigger 'recentphotos:fetch:success'
effects Show.Controller
App.vent.on 'recentphotos:fetch:success', ->
effectContainer.collection.addEffect('MosaicPhotos')
_.each view.effects, (effectClassName, effectEvent) =>
view.on effectEvent, (mediaType) =>
App.execute("update:header", mediaType: mediaType) # store the media type for url proper building
effectContainer.showEffect effectClassName
view.on "#{effectEvent}:mouseout", =>
effectContainer.triggerMouseout effectClassName
effects EffectsContainer
showEffect: (effectClassName) ->
#if effects besides 'MosaicPhotos' fall victim to async errors, add them on fetch:success events as well
@collection.addEffect effectClassName unless effectClassName is 'MosaicPhotos'
@children.each (view) =>
if view.model instanceof Show[effectClassName]
@fadeIn view
view.trigger("mouseover")
else
@fadeOut view
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment