From 64a859a4a0b1d3992f7b200890f80351907fab43 Mon Sep 17 00:00:00 2001 From: Alex ORLUC <alex.orluc@maarch.org> Date: Mon, 28 Aug 2017 12:00:39 +0200 Subject: [PATCH] FEAT #5829 add notification service for actions --- .../js/angular/app/notification.service.js | 30 +++++++++++++++++++ .../js/angular/app/notification.service.ts | 15 ++++++++++ 2 files changed, 45 insertions(+) create mode 100644 apps/maarch_entreprise/js/angular/app/notification.service.js create mode 100644 apps/maarch_entreprise/js/angular/app/notification.service.ts diff --git a/apps/maarch_entreprise/js/angular/app/notification.service.js b/apps/maarch_entreprise/js/angular/app/notification.service.js new file mode 100644 index 00000000000..60748d8cf7f --- /dev/null +++ b/apps/maarch_entreprise/js/angular/app/notification.service.js @@ -0,0 +1,30 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var md2_1 = require("md2"); +var core_1 = require("@angular/core"); +var NotificationService = (function () { + function NotificationService(toast) { + this.toast = toast; + } + NotificationService.prototype.success = function (message) { + this.toast.show('<i class="fa fa-info-circle fa-2x"></i><span>' + message + '</span>', 2000); + }; + NotificationService.prototype.error = function (message) { + this.toast.show('<i class="fa fa-exclamation-triangle fa-2x"></i><span>' + message + '</span>', 2000); + }; + return NotificationService; +}()); +NotificationService = __decorate([ + core_1.Injectable(), + __metadata("design:paramtypes", [md2_1.Md2Toast]) +], NotificationService); +exports.NotificationService = NotificationService; diff --git a/apps/maarch_entreprise/js/angular/app/notification.service.ts b/apps/maarch_entreprise/js/angular/app/notification.service.ts new file mode 100644 index 00000000000..7eb2de712d4 --- /dev/null +++ b/apps/maarch_entreprise/js/angular/app/notification.service.ts @@ -0,0 +1,15 @@ +import {Md2Toast} from 'md2'; +import {Injectable} from '@angular/core'; + +@Injectable() +export class NotificationService { + constructor(private toast: Md2Toast) { + } + success(message:string) { + this.toast.show('<i class="fa fa-info-circle fa-2x"></i><span>'+message+'</span>', 2000); + } + + error(message:string) { + this.toast.show('<i class="fa fa-exclamation-triangle fa-2x"></i><span>'+message+'</span>', 2000); + } +} \ No newline at end of file -- GitLab