RowOptions.ts 884 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { coreModule } from "app/core/core";
  2. export class RowOptionsCtrl {
  3. row: any;
  4. source: any;
  5. dismiss: any;
  6. onUpdated: any;
  7. onDelete: any;
  8. showDelete: boolean;
  9. /** @ngInject */
  10. constructor() {
  11. this.source = this.row;
  12. this.row = this.row.getSaveModel();
  13. }
  14. update() {
  15. this.source.title = this.row.title;
  16. this.source.repeat = this.row.repeat;
  17. this.onUpdated();
  18. this.dismiss();
  19. }
  20. delete() {
  21. this.onDelete();
  22. this.dismiss();
  23. }
  24. }
  25. export function rowOptionsDirective() {
  26. return {
  27. restrict: "E",
  28. templateUrl: "public/app/features/dashboard/partials/row_options.html",
  29. controller: RowOptionsCtrl,
  30. bindToController: true,
  31. controllerAs: "ctrl",
  32. scope: {
  33. row: "=",
  34. dismiss: "&",
  35. onUpdated: "&",
  36. onDelete: "&"
  37. }
  38. };
  39. }
  40. coreModule.directive("rowOptions", rowOptionsDirective);