         destroy: =>
             namespaces.off 'all', @render
 
+    # The modal to remove a database, it extends UIComponents.AbstractModal
     class @RemoveDatabaseModal extends UIComponents.AbstractModal
         template: Handlebars.compile $('#remove_database-modal-template').html()
         class: 'remove_database-dialog'

        render: (_database_to_delete) ->
            @database_to_delete = _database_to_delete

            super
                modal_title: 'Remove database'
                btn_primary_text: 'Remove'
                id: _database_to_delete.get('id')
                name: _database_to_delete.get('name')

            @.$('.btn-primary').focus()

        on_submit: =>
            super

            post_data = {}
            post_data.databases = {}
            post_data.databases[@database_to_delete.get('id')] = null
            for namespace in namespaces.models
                if namespace.get('database') is @database_to_delete.get('id')
                    if not post_data[namespace.get('protocol')+'_namespaces']?

                error: @on_error

        on_success: (response) =>
            # If the user was on a database view, we have to redirect him
            # If he was on #tables, we are just refreshing
            window.router.navigate '#tables'
            window.app.index_namespaces
                alert_message: "The database #{@database_to_delete.get('name')} was successfully deleted."

            # Update the data
            namespace_id_to_remove = []
            for namespace in namespaces.models
                if namespace.get('database') is @database_to_delete.get('id')
