SettingsAppsView
define('home/views/SettingsAppsView',[
'jquery',
'backbone-marionette',
'core/strings',
'home/mixins/withFetchingView',
'home/templates/settingsApps',
], function (
$,
Marionette,
strings,
withFetchingView,
settingsAppsTemplate
) {
'use strict';
var gettext = strings.get;
var SettingsAppsView = Marionette.ItemView.extend({
events: {
'click [data-action=revoke-app]': 'revokeAppHandler',
},
template: settingsAppsTemplate,
initialize: function () {
this.listenToOnce(this.collection, 'reset', this.doneFetching);
this.listenTo(this.collection, 'reset remove', this.render);
},
doneFetching: function () {
this.collection.fetched = true;
},
isDoneFetching: function () {
return this.collection.fetched;
},
revokeAppHandler: function (ev) {
var appId = $(ev.originalEvent.target).attr('data-app-id');
var app = this.collection.get(appId);
if (!app)
return;
var confirmationMsg = strings.interpolate(
gettext('Revoke access for %(appName)s?'),
{ appName: app.get('name') }
);
if (!window.confirm(confirmationMsg))
return;
app.destroy({
wait: true,
});
},
});
withFetchingView.call(SettingsAppsView.prototype);
return SettingsAppsView;
});
Submit your DMCA takedown request here to
report copyright infringement.