nl_tokens: a Rollcall 2 . 0 client
pl_tokens: function ( url , db ) { this . server = new Drowsy . Server ( url ) ; this . db = this . server . database ( db ) ; // User model this . User = this . db . Document ( 'users' ) . extend ( { addTag : function ( tag ) { var tags = _ . clone ( this . get ( 'tags' ) ) ; // if no classes array exists add it if ( ! tags ) { tags = [ ] ; } tags . push ( tag ) ; this . set ( 'tags' , _ . uniq ( <mask> ) ) ; } , removeTag : function ( tag ) { var tags = this . get ( 'tags' ) ; this . set ( 'tags' , _ . without ( tags , tag ) ) ; } , addCohort : function ( c ) { var classes = _ . clone ( this . get ( 'cohorts' ) ) ; // if no cohorts array exists add it if ( ! cohorts ) { cohorts = [ ] ; } cohorts . push ( c ) ; this . set ( 'cohorts' , _ . uniq ( cohorts ) ) ; } , removeCohort : function ( c ) { var cohorts = this . get ( 'cohorts' ) ; this . set ( 'cohorts' , _ . without ( cohorts , c ) ) ; } , isTeacher : function ( ) { if ( this . get ( 'user_role' ) === 'teacher' ) { return true ; } else { return false ; } } } ) ; this . Users = this . db . Collection ( 'users' ) . extend ( { model : this . User } ) ; /*
       *   Group model
       */ this . Group = this . db . Document ( 'groups' ) . extend ( { addGroup : function ( group ) { var groups = _ . clone ( this . get ( 'groups' ) ) ; groups . push ( group ) ; this . set ( 'groups' , _ . uniq ( group ) ) ; } } ) ; this . Groups = this . db . Collection ( 'groups' ) . extend ( { model : this . Group } ) ; // Run model this . Run = this . db . Document ( 'runs' ) . extend ( { } ) ; this . Runs = this . db . Collection ( 'runs' ) . extend ( { model : this . Run } ) ; /*
       *   Model for Cohorts
       */ this . Cohort = this . db . Document ( 'cohorts' ) . extend ( { addDiscussion : function ( discussionId ) { var discussions = _ . clone ( this . get ( 'discussions' ) ) ; // if no discussions array exists add it if ( ! discussions ) { discussions = [ ] ; } discussions . push ( discussionId ) ; this . set ( 'discussions' , _ . uniq ( discussions ) ) ; } , removeDiscussion : function ( discussionId ) { var discussions = this . get ( 'discussions' ) ; this . set ( 'discussions' , _ . without ( discussions , discussionId ) ) ; } } ) ; this . Cohorts = this . db . Collection ( 'cohorts' ) . extend ( { model : this . Cohort } ) ; /*
       *   Model for Discussions
       */ this . Discussion = this . db . Document ( 'discussions' ) . extend ( { } ) ; this . Discussions = this . db . Collection ( 'discussions' ) . extend ( { model : this . Discussion } ) ; }