RowOptions.ts 787 B

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