Refactors most controllers and directives into classes for more organized and maintainable code

This commit is contained in:
Mo Bitar
2020-01-30 13:37:16 -06:00
parent badadba8f8
commit 3c8c43ac7e
144 changed files with 87972 additions and 5613 deletions

View File

@@ -0,0 +1,48 @@
import template from '%/directives/menu-row.pug';
class MenuRowCtrl {
onClick($event) {
if(this.disabled) {
return;
}
$event.stopPropagation();
this.action();
}
clickAccessoryButton($event) {
if(this.disabled) {
return;
}
$event.stopPropagation();
this.buttonAction();
}
}
export class MenuRow {
constructor() {
this.restrict = 'E';
this.transclude = true;
this.template = template;
this.controller = MenuRowCtrl;
this.controllerAs = 'ctrl';
this.bindToController = true;
this.scope = {
action: '&',
buttonAction: '&',
buttonClass: '=',
buttonText: '=',
desc: '=',
disabled: '=',
circle: '=',
circleAlign: '=',
faded: '=',
hasButton: '=',
label: '=',
spinnerClass: '=',
stylekitClass: '=',
subRows: '=',
subtitle: '=',
};
}
}