* wip: component viewer * feat: get component status from component viewer * fix: remove unused property * chore(deps): snjs 2.29.0 * fix: import location
47 lines
906 B
TypeScript
47 lines
906 B
TypeScript
import { WebDirective } from './../../types';
|
|
import template from '%/directives/permissions-modal.pug';
|
|
|
|
class PermissionsModalCtrl {
|
|
$element: JQLite;
|
|
callback!: (success: boolean) => void;
|
|
|
|
/* @ngInject */
|
|
constructor($element: JQLite) {
|
|
this.$element = $element;
|
|
}
|
|
|
|
dismiss() {
|
|
const elem = this.$element;
|
|
const scope = elem.scope();
|
|
scope.$destroy();
|
|
elem.remove();
|
|
}
|
|
|
|
accept() {
|
|
this.callback(true);
|
|
this.dismiss();
|
|
}
|
|
|
|
deny() {
|
|
this.callback(false);
|
|
this.dismiss();
|
|
}
|
|
}
|
|
|
|
export class PermissionsModal extends WebDirective {
|
|
constructor() {
|
|
super();
|
|
this.restrict = 'E';
|
|
this.template = template;
|
|
this.controller = PermissionsModalCtrl;
|
|
this.controllerAs = 'ctrl';
|
|
this.bindToController = true;
|
|
this.scope = {
|
|
show: '=',
|
|
component: '=',
|
|
permissionsString: '=',
|
|
callback: '=',
|
|
};
|
|
}
|
|
}
|