Always show delete icon for new tokens

* Always show delete icon
* Hide form if the new icon is deleted
This commit is contained in:
Roeland Jago Douma 2016-08-10 08:58:57 +02:00
parent 7d5578dd06
commit 806f9b80f1
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
1 changed files with 9 additions and 0 deletions

View File

@ -183,6 +183,8 @@
_newAppPassword: undefined, _newAppPassword: undefined,
_newAppId: undefined,
_hideAppPasswordBtn: undefined, _hideAppPasswordBtn: undefined,
_addingToken: false, _addingToken: false,
@ -255,10 +257,13 @@
}); });
$.when(creatingToken).done(function (resp) { $.when(creatingToken).done(function (resp) {
// We can delete token we add
resp.deviceToken.canDelete = true;
_this.collection.add(resp.deviceToken); _this.collection.add(resp.deviceToken);
_this.render(); _this.render();
_this._newAppLoginName.val(resp.loginName); _this._newAppLoginName.val(resp.loginName);
_this._newAppPassword.val(resp.token); _this._newAppPassword.val(resp.token);
_this._newAppId = resp.deviceToken.id;
_this._toggleFormResult(false); _this._toggleFormResult(false);
_this._newAppPassword.select(); _this._newAppPassword.select();
_this._tokenName.val(''); _this._tokenName.val('');
@ -293,6 +298,10 @@
var $row = $target.closest('tr'); var $row = $target.closest('tr');
var id = $row.data('id'); var id = $row.data('id');
if (id === this._newAppId) {
this._toggleFormResult(true);
}
var token = this.collection.get(id); var token = this.collection.get(id);
if (_.isUndefined(token)) { if (_.isUndefined(token)) {
// Ignore event // Ignore event