szurubooru/client/js/views/user_delete_view.js

31 lines
674 B
JavaScript
Raw Normal View History

2016-04-09 09:52:00 +02:00
'use strict';
const views = require('../util/views.js');
2016-04-09 09:52:00 +02:00
2016-05-11 12:17:40 +02:00
class UserDeleteView {
2016-04-09 09:52:00 +02:00
constructor() {
2016-05-11 12:17:40 +02:00
this.template = views.getTemplate('user-delete');
2016-04-09 09:52:00 +02:00
}
render(ctx) {
const target = ctx.target;
const source = this.template(ctx);
const form = source.querySelector('form');
views.decorateValidator(form);
2016-04-09 09:52:00 +02:00
form.addEventListener('submit', e => {
e.preventDefault();
views.clearMessages(target);
views.disableForm(form);
2016-04-09 09:52:00 +02:00
ctx.delete();
});
views.listenToMessages(target);
views.showView(target, source);
2016-04-09 09:52:00 +02:00
}
}
2016-05-11 12:17:40 +02:00
module.exports = UserDeleteView;