Skip to content

Instantly share code, notes, and snippets.

@jakecraige
Created October 1, 2013 13:50
Show Gist options
  • Save jakecraige/6778726 to your computer and use it in GitHub Desktop.
Save jakecraige/6778726 to your computer and use it in GitHub Desktop.
( () ->
#Protects views where angular is not loaded from errors
if typeof angular == 'undefined'
return
'use strict'
module = angular.module('PrivateNoteModel', ['OrmModel'])
module.factory 'PrivateNotes', (Orm) ->
Orm.setKey 'privateNotes'
get = (id = false) ->
Orm.get(id)
create = (data) ->
Orm.create(data)
update = (data) ->
Orm.update(data)
getForEvent = (eventId) ->
Orm.getForEvent(eventId)
newBlank = ->
newPrivateNote = {
note: ''
}
destroy = (id) ->
Orm.destroy(id)
{ # Return Functions
get: get
create: create
update: update
destroy: destroy
getForEvent: getForEvent
newBlank: newBlank
}
)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment