FEATURE: unified UI for pinning/banner topics

REFACTOR: ES6ified all the modals
This commit is contained in:
Régis Hanol
2015-03-14 01:18:05 +01:00
parent 7c1540e5ab
commit 424a3b042a
64 changed files with 410 additions and 230 deletions

View File

@ -0,0 +1,27 @@
import ModalFunctionality from 'discourse/mixins/modal-functionality';
import ObjectController from 'discourse/controllers/object';
export default ObjectController.extend(ModalFunctionality, {
submitDisabled: function() {
return (!this.get('reason') || this.get('reason').length < 1);
}.property('reason'),
actions: {
suspend: function() {
if (this.get('submitDisabled')) return;
var duration = parseInt(this.get('duration'), 10);
if (duration > 0) {
var self = this;
this.send('hideModal');
this.get('model').suspend(duration, this.get('reason')).then(function() {
window.location.reload();
}, function(e) {
var error = I18n.t('admin.user.suspend_failed', { error: "http: " + e.status + " - " + e.body });
bootbox.alert(error, function() { self.send('reopenModal'); });
});
}
}
}
});