Skip to content

Instantly share code, notes, and snippets.

@coopermaruyama
Last active August 29, 2015 14:20
Show Gist options
  • Save coopermaruyama/c1780134b15014a4ed28 to your computer and use it in GitHub Desktop.
Save coopermaruyama/c1780134b15014a4ed28 to your computer and use it in GitHub Desktop.
Atom snippets for Meteor ViewModel
'.source.coffee':
'ViewModel - Collection':
'prefix': 'vmc'
'body': """
Template.${1:Items}.viewmodel "$1", ${2:${3:viewmodelToExtend},} {
$1: -> $1.find()
${4:active$1: null
}$5
}, "$1"
"""
'ViewModel - Item':
'prefix': 'vmi'
'body': """
Template.${1:item}.viewmodel ((data) ->
"$1\_\#\{data._id\}" # use as `n`: ViewModel.byId(n)
), ${2:${3:viewmodelToExtend},} ((data) ->
id: data._id
$1: -> $1.findOne @id()
${4:activate: -> @parent().active @id()
}${5:isActive: -> @parent().active() is @id()
}$9
), ["${6:helper1}"${7:, "${8:helper2}"}]
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment