Refactors most controllers and directives into classes for more organized and maintainable code
This commit is contained in:
38
app/assets/javascripts/directives/views/permissionsModal.js
Normal file
38
app/assets/javascripts/directives/views/permissionsModal.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import template from '%/directives/permissions-modal.pug';
|
||||
|
||||
class PermissionsModalCtrl {
|
||||
/* @ngInject */
|
||||
constructor($element) {
|
||||
this.$element = $element;
|
||||
}
|
||||
|
||||
dismiss() {
|
||||
this.$element.remove();
|
||||
}
|
||||
|
||||
accept() {
|
||||
this.callback(true);
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
deny() {
|
||||
this.callback(false);
|
||||
this.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
export class PermissionsModal {
|
||||
constructor() {
|
||||
this.restrict = 'E';
|
||||
this.template = template;
|
||||
this.controller = PermissionsModalCtrl;
|
||||
this.controllerAs = 'ctrl';
|
||||
this.bindToController = true;
|
||||
this.scope = {
|
||||
show: '=',
|
||||
component: '=',
|
||||
permissionsString: '=',
|
||||
callback: '='
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user