     @loadItems()
 
     list.on "DeleteDatabaseSubmitted", (listItem)=> @deleteDatabase listItem
-    list.on "UpdateDatabaseSubmitted", (listItem, formdata)=> @updateDatabase listItem, formdata
+    list.on "UpdateDatabaseSubmitted", (listItem, password)=>
+      @updateDatabase listItem, password
+
+    list.on "HideAllWidgets", =>
+      for item in @itemsOrdered
+        item.deleteWidget?.destroy?()
+        item.editWidget?.destroy?()
+        delete item.deleteWidget
+        delete item.editWidget
+
+    @on "DatabaseUpdated", (listItem)=>
+      listItem.changePassword.hideLoader()
+      @emit "ListUpdated"
+      list.emit "HideAllWidgets"
 
     @on "DatabaseDeleted", (listItem)=>
       list.removeItem listItem
       @emit "ListUpdated"
-    # @on "DatabaseUpdated", (listItem)=>
 
   loadItems:(callback)->
     @removeAllItems()

    @cancelButton = new KDButtonView
      title    : "Cancel"
      cssClass : "modal-clean-gray"
      callback : => item.getDelegate().emit "hideAllWidgets"

    KD.utils.wait => @setClass 'ready'


      {{> @cancelButton}} {{> @deleteButton}}
    """

class InlineEditWidget extends JView

  constructor:(item)->
    options =
      cssClass : 'inline-edit-widget'
    data = item.getData()

    super options, data

    @newPassword = new KDInputView
      type        : "password"
      placeholder : "Type your new password here..."

    @updateButton = new KDButtonView
      title    : "Update"
      cssClass : "modal-clean-green"
      callback : =>
        @updateButton.disable()
        @cancelButton.disable()
        item.changePassword.showLoader()
        item.getDelegate().emit \
          "UpdateDatabaseSubmitted", item, @newPassword.getValue()

    @cancelButton = new KDButtonView
      title    : "Cancel"
      cssClass : "modal-clean-gray"
      callback : => item.getDelegate().emit "HideAllWidgets"

    KD.utils.wait => @setClass 'ready'

  pistachio:->
    """
      {{> @newPassword}} {{> @cancelButton}} {{> @updateButton}}
    """

class NewDBCreatedWidget extends KDView

  constructor:(options = {}, data)->

    # We can provide a connection string for mongo dbs
    # But I couldn't find a proper solution to put it in view
    #
    # connectionString = ''
    # if data.dbType is 'mongo'
    #   connectionString = \
    #     "mongodb://#{data.dbUser}:#{data.dbPass}@#{data.dbHost}/#{data.dbName}"
    #   connectionString = \
    #     "<p><label>Connection String:</label> <b>#{connectionString}</b></p>"

    options.cssClass = "modal-hint"
    options.partial  = """
      <p>Your new <cite>#{data.dbType}</cite> database has just been created!</p>
      <p><label>Host:</label> <i>#{data.dbHost}</i></p>
      <p><label>Name:</label> <i>#{data.dbName}</i></p>
      <p><label>User:</label> <i>#{data.dbUser}</i></p>
