   templates.change ->
     $this = $ this
     opt   = $this.find 'option:selected'
+    templates.data 'quiet', 'true'
     if opt.length is 0
       # Disable all the controls as no option is selected.
       lastSelectedTemplate = {}

    opt = templates.find 'option:selected'
    opt.insertAfter opt.next()
    templates.change().focus()
  # Move the selected option up once when the *Up* control is clicked.
  $('#moveUp_btn').click ->
    opt = templates.find 'option:selected'
    opt.insertBefore opt.prev()
    templates.change().focus()

# Bind the event handlers required for exporting templates.
loadTemplateExportEvents = ->

# element via `assign`.
bindTemplateSaveEvent = (selector, type, assign, callback) ->
  $(selector).on type, ->
    $this     = $ this
    key       = ''
    templates = $ '#templates'
    option    = templates.find 'option:selected'
    if option.length and templates.data('quiet') isnt 'true'
      key = $this.attr('id').match(/^template_(\S*)/)[1]
      key = key[0].toLowerCase() + key.substr 1
      assign.call $this, option, key
