 # -'TODO's indicate case-specific changes
 ###
 _.extend( Template.tagbox,
-  add_tag: (tags, tag_text, event, id) =>
-    console.log(tags, tag_text, event, id)
-    if tag_text != "" #TODO: && not @my_tags[tag_text]?
-      #TODO: add to @my_tags not @tags
-      tags[tag_text] ?= { users: [], weight: 0}
-      tags[tag_text].users.push(Session.get('user_id'))
-      Posts.update(id, {$set: {tags: tags}})
-      #clear textbox and update suggestion filter
-      event.target.value = ''
-      Session.set("filter_text_#{ id }", '')
-      Session.get("context_#{ id }").invalidate()
-    
   visible_tags: ->
     visible = (tag for tag of @tags)  #graduated tags
     @my_tags ?= {}                    #TODO: REMOVE on schema change

        Session.set("tagging_#{ @_id }", false)
        event.stopImmediatePropagation()
  }
)

Handlebars.registerHelper('vis_tags', (context, object) ->
  @my_tags = {test: 0}          #TODO: REMOVE
  ret = ""
  for tag in context
    ret += "<div class='tag"

        
        switch event.keyCode
          when 13 #Enter
            Template.tagbox.add_tag(@_id, @tags, [], entered_text, event.target)
          when 37 #Left-arrow: ADD
            if suggested_tag?
              @tags[suggested_tag] ?= { users: [], weight: 0}
