diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2017-05-30 09:54:10 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2017-05-30 09:54:10 +0200 |
commit | 593f6281dc0843868699629461285e549512656a (patch) | |
tree | 85da80a1b1ee7b328034f5397ecd189d254a7dda /settings/js | |
parent | b9b7f8bede0562b4e0eb067c62ecbe93a298793f (diff) | |
download | nextcloud-server-593f6281dc0843868699629461285e549512656a.tar.gz nextcloud-server-593f6281dc0843868699629461285e549512656a.zip |
Combine sessions and app passwords view into one single view
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/authtoken_view.js | 57 |
1 files changed, 19 insertions, 38 deletions
diff --git a/settings/js/authtoken_view.js b/settings/js/authtoken_view.js index 9931be2ae1f..fd967b7fedb 100644 --- a/settings/js/authtoken_view.js +++ b/settings/js/authtoken_view.js @@ -48,15 +48,6 @@ var SubView = OC.Backbone.View.extend({ collection: null, - /** - * token type - * - 0: browser - * - 1: device - * - * @see OC\Authentication\Token\IToken - */ - type: 0, - _template: undefined, template: function (data) { @@ -68,7 +59,6 @@ }, initialize: function (options) { - this.type = options.type; this.collection = options.collection; this.on(this.collection, 'change', this.render); @@ -79,7 +69,7 @@ var list = this.$('.token-list'); var tokens = this.collection.filter(function (token) { - return token.get('type') === _this.type; + return true; }); list.html(''); @@ -183,7 +173,7 @@ var AuthTokenView = OC.Backbone.View.extend({ collection: null, - _views: [], + _view: [], _form: undefined, @@ -206,26 +196,21 @@ initialize: function (options) { this.collection = options.collection; - var tokenTypes = [0, 1]; - var _this = this; - _.each(tokenTypes, function (type) { - var el = type === 0 ? '#sessions' : '#apppasswords'; - _this._views.push(new SubView({ - el: el, - type: type, - collection: _this.collection - })); - - var $el = $(el); - $('body').on('click', _.bind(_this._hideConfigureToken, _this)); - $el.on('click', '.popovermenu', function(event) { - event.stopPropagation(); - }); - $el.on('click', 'a.icon-delete', _.bind(_this._onDeleteToken, _this)); - $el.on('click', '.icon-more', _.bind(_this._onConfigureToken, _this)); - $el.on('change', 'input.filesystem', _.bind(_this._onSetTokenScope, _this)); + var el = '#sessions'; + this._view = new SubView({ + el: el, + collection: this.collection }); + var $el = $(el); + $('body').on('click', _.bind(this._hideConfigureToken, this)); + $el.on('click', '.popovermenu', function(event) { + event.stopPropagation(); + }); + $el.on('click', 'a.icon-delete', _.bind(this._onDeleteToken, this)); + $el.on('click', '.icon-more', _.bind(this._onConfigureToken, this)); + $el.on('change', 'input.filesystem', _.bind(this._onSetTokenScope, this)); + this._form = $('#app-password-form'); this._tokenName = $('#app-password-name'); this._addAppPasswordBtn = $('#add-app-password'); @@ -233,7 +218,7 @@ this._appPasswordName = $('#app-password-name'); this._appPasswordName.on('keypress', function(event) { if (event.which === 13) { - _this._addAppPassword(); + this._addAppPassword(); } }); @@ -287,18 +272,14 @@ }, render: function () { - _.each(this._views, function (view) { - view.render(); - view.toggleLoading(false); - }); + this._view.render(); + this._view.toggleLoading(false); }, reload: function () { var _this = this; - _.each(this._views, function (view) { - view.toggleLoading(true); - }); + this._view.toggleLoading(true); var loadingTokens = this.collection.fetch(); |