Skip to content

Commit

Permalink
🐛 when connection removed, reset connect form
Browse files Browse the repository at this point in the history
  • Loading branch information
imlucas committed Sep 26, 2015
1 parent 3b177b0 commit 4798db9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/connect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ var ConnectView = View.extend({
this.authMethod = null;
this.authOpen = false;
},
onConnectionDestroyed: function() {
this.reset();
this.form.connection_id = '';
this.form.reset();
this.authMethod = null;
this.authOpen = false;
},

/**
* Triggers when the auth methods has changed (or set back to null)
Expand Down
11 changes: 9 additions & 2 deletions src/connect/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var SidebarItemView = View.extend({
dblclick: 'onDoubleClick',
mouseover: 'onMouseOver',
mouseout: 'onMouseOut',
'click [data-hook=close]': 'onCloseClick'
'click [data-hook=close]': 'onRemoveClick'
},
bindings: {
'model.name': {
Expand Down Expand Up @@ -51,10 +51,11 @@ var SidebarItemView = View.extend({
onDoubleClick: function(event) {
this.parent.onItemDoubleClick(event, this);
},
onCloseClick: function(event) {
onRemoveClick: function(event) {
event.stopPropagation();
event.preventDefault();
this.model.destroy();
this.parent.onRemoveClick(event, this);
},
onMouseOver: function() {
this.hover = true;
Expand Down Expand Up @@ -93,6 +94,12 @@ var SidebarView = View.extend({
}
this.parent.createNewConnection();
},
onRemoveClick: function(event, view) {
event.stopPropagation();
event.preventDefault();
view.model.destroy();
this.parent.onConnectionDestroyed();
},
onItemClick: function(event, view) {
event.stopPropagation();
event.preventDefault();
Expand Down

0 comments on commit 4798db9

Please sign in to comment.