Skip to content

Commit

Permalink
make the enter button submit the form (re getredash#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
alison985 authored and Allen Short committed Jan 8, 2018
1 parent 587f2da commit 9d9bbe6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h4 class="modal-title">Dashboard name: {{$ctrl.dashboard.name}}</h4>
</div>
<div class="modal-body">
<p>
<input type="text" class="form-control" placeholder="Dashboard Name" ng-model="$ctrl.dashboard.name" autofocus required>
<input type="text" class="form-control" placeholder="Dashboard Name" ng-model="$ctrl.dashboard.name" ng-keyup="$ctrl.saveDashboardOnEnter($event)" autofocus required>
</p>

<p ng-if="$ctrl.dashboard.id">
Expand Down
10 changes: 10 additions & 0 deletions client/app/components/dashboards/edit-dashboard-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ const EditDashboardDialog = {
Events.record('create', 'dashboard');
}
};
this.saveDashboardOnEnter = ($event) => {
// keyCode 13 is the Enter key
if ($event.keyCode === 13) {
this.saveDashboard();
}
};
this.closeWithoutSave = () => {
this.dashboard.name = this.dashboard.existing_name;
this.dismiss();
};
},
};

Expand Down

0 comments on commit 9d9bbe6

Please sign in to comment.