RowOptions.ts 860 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. /** @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. delete() {
  20. this.onDelete();
  21. this.dismiss();
  22. }
  23. }
  24. export function rowOptionsDirective() {
  25. return {
  26. restrict: 'E',
  27. templateUrl: 'public/app/features/dashboard/partials/row_options.html',
  28. controller: RowOptionsCtrl,
  29. bindToController: true,
  30. controllerAs: 'ctrl',
  31. scope: {
  32. row: "=",
  33. dismiss: "&",
  34. onUpdated: "&",
  35. onDelete: "&"
  36. },
  37. };
  38. }
  39. coreModule.directive('rowOptions', rowOptionsDirective);