 
     @dialog = $(Template.item_edit_dialog_modal())
     @dialog.on('shown.bs.modal', => do @onShown)
-    @dialog.on('hidden.bs.modal', => do @dialog.remove)
+    @dialog.on('hidden.bs.modal', => do @onHidden)
     @setItem(item)
 
   setItem: (item) =>

      tag.find('.barcode_container > img').attr('src', codes[0])
    )

  show: => do @dialog.modal

  hide: => @dialog.modal('hide')

  onShown: =>
    doc = window.frames['item-edit-print-frame'].document

    )
    console.log(ItemEditDialog.priceTagCss)
    $(doc.body).find('#items').empty().append(@priceTag)

    # A bit excessive, as any form events will also go here, but looks like the dialog cannot be focused and
    # thus not handle ESC keyboard event.
    $(document).on("keydown", @_keyHandle)

  onHidden: =>
    @dialog.remove()
    $(document).off("keydown", @_keyHandle)

  displayError: (msg) =>
    if msg?
