       iconClass   : "edit"
       tooltip     :
         title     : "Change Password"
-        placement : "top"
+        placement : "left"
       loader      :
         color     : "#666"
         diameter  : 16
       callback    : =>
         @changePassword.hideLoader()
+        hasWidget = @editWidget?
+        listView.emit "HideAllWidgets"
+        unless hasWidget
+          @addSubView @editWidget = new InlineEditWidget @
 
     @deleteDatabase = new KDButtonView
       style       : "clean-gray"

    @loadItems()

    list.on "DeleteDatabaseSubmitted", (listItem)=> @deleteDatabase listItem
    list.on "UpdateDatabaseSubmitted", (listItem, formdata)=> @updateDatabase listItem, formdata

    @on "DatabaseDeleted", (listItem)=>
      list.removeItem listItem
      @emit "ListUpdated"
    # @on "DatabaseUpdated", (listItem)=>

  loadItems:(callback)->
    @removeAllItems()

      {{> @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>
