 
 Template.FlyCircuitPanel.helpers
   adding_flycircuit_idid: ->
-    Session.equals "editing_flycircuit_idid", @_id
+    editing_flycircuit_idid.get() == @_id
 
   idid_dicts: ->
     result = []

Session.setDefault "editing_flycircuit_idid", null

Template.FlyCircuitPanel.events window.okCancelEvents("#edit-flycircuit-input",
  ok: (value) ->

      $addToSet:
        flycircuit_idids: +value # plus sign converts to integer

    editing_flycircuit_idid.set(null)
    return

  cancel: ->
    editing_flycircuit_idid.set(null)
    return
)

Template.FlyCircuitPanel.events
  "click .add-flycircuit-idid": (e, tmpl) ->
    editing_flycircuit_idid.set(@_id)
    Deps.flush() # update DOM before focus
    window.activateInput tmpl.find("#edit-flycircuit-input")
    return
