 
   @picker = thisColorPicker.data('colorpicker').picker
 
-Template.bootstrap_magic_input_color.destroyed = ->
+Template.bootstrap_magic_input_color.onDestroyed ->
   @picker.remove()
   $(@firstNode).colorpicker('destroy')
 

# EZ-Modal
###

Template.bootstrap_magic_preview_popovers.rendered = ->
  $('[data-toggle="popover"]').popover()

Template.bootstrap_magic_preview_tooltips.rendered = ->
  this.$('[data-toggle="tooltip"]').tooltip()

  subCatId = BootstrapMagic.dictionary.currentSubCategory.get()
  return _.find bootstrap_magic_variables, (group) -> group._id is subCatId

Template._bootstrap_magic.onCreated ->
  BootstrapMagic.start() if BootstrapMagic.start

Template._bootstrap_magic.onRendered ->
  BootstrapMagic.dictionary.currentCategory.set bootstrap_magic_variables[0].category
  BootstrapMagic.dictionary.currentSubCategory.set bootstrap_magic_variables[0]._id

# default starting script: load hard-coded defaults
# this function can be overriden by other packages for integrations
