   $(".categories-chooser").chosen()
 
 Template.category.helpers
-  'events': -> getEvents(categories: Session.get "category")
+  'events': -> get_events(categories: Session.get "category")
 
 Template.search.helpers
   'found_events': ->
     q = Session.get("q")
     re = new RegExp("#{q}.*", 'i')
-    getEvents($or: [{name: re}, {description: re}, {categories: re}, {location: re}])
+    get_events($or: [{name: re}, {description: re}, {categories: re}, {location: re}])

      event_ids = []
      not_flat = Meteor.users.find("profile.admin": true).map (admin) -> admin?.profile?.events or []
      event_ids = event_ids.concat.apply(event_ids, not_flat)
    getEvents({_id: {$in: event_ids}})

# user template
Template.user.helpers
  'info': ->
    Meteor.users.findOne(Session.get("user_id")) or {}
  'user_events': ->
    getEvents(creator: Session.get("user_id")) or []
  'following': ->
    Meteor.user()?.profile?.following.indexOf(Session.get("user_id")) > -1


Template.edit_event.events
  'submit .create-event': (e) ->
    e.preventDefault()
    event = parse_event_from_form $('.create-event')
    Events.update(event.id, $set: event)
    Session.set('editing', null)

