From 01af3f66e06e26915db0d62164ea8b5186c90623 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 25 Jun 2014 23:06:15 +0200 Subject: [PATCH] Add experimental top notify service. --- app/coffee/modules/base/confirm.coffee | 19 +++++++++++++++++++ app/index.jade | 4 +++- app/partials/issues.jade | 6 ++---- .../components/notification-message.jade | 14 +++++++------- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/app/coffee/modules/base/confirm.coffee b/app/coffee/modules/base/confirm.coffee index 97118fe4..6fe30f49 100644 --- a/app/coffee/modules/base/confirm.coffee +++ b/app/coffee/modules/base/confirm.coffee @@ -20,6 +20,8 @@ ### taiga = @.taiga +timeout = @.taiga.timeout + class ConfirmService extends taiga.Service @.$inject = ["$q"] @@ -71,6 +73,23 @@ class ConfirmService extends taiga.Service @.el.removeClass("hidden") return defered.promise + notify: (type, message) -> + # TODO: at this momment the message is ignored + # because the notification message not permits + # custom messages. + + selector = ".notification-message-#{type}" + + body = angular.element("body") + body.find(".notification-message").addClass("hidden") + body.find(selector).removeClass("hidden") + + if @.tsem + cancelTimeout(@.tsem) + + @.tsem = timeout 4000, => + body.find(selector).addClass("hidden") + delete @.sem module = angular.module("taigaBase") module.service("$tgConfirm", ["$q", ConfirmService]) diff --git a/app/index.jade b/app/index.jade index 4f1be36e..08691627 100644 --- a/app/index.jade +++ b/app/index.jade @@ -9,8 +9,10 @@ html(lang="en", ng-app="taiga") meta(name="viewport", content="width=device-width, user-scalable=no") link(rel="stylesheet", href="/styles/main.css") body(tg-main) + // TODO: move to inner of ng-view include partials/views/modules/nav - div.master(ng-view="") + include partials/views/components/notification-message + div.master(ng-view) div.hidden.lightbox.lightbox_confirm-delete include partials/views/modules/lightbox_confirm-delete div.hidden.lightbox.lightbox-generic-error diff --git a/app/partials/issues.jade b/app/partials/issues.jade index 989f745a..86230f5f 100644 --- a/app/partials/issues.jade +++ b/app/partials/issues.jade @@ -1,15 +1,13 @@ -extends layout +extends dummy-layout block head title Taiga Project management web application with scrum in mind! block content - div.wrapper - include views/components/notification-message + div.wrapper(tg-issues, ng-controller="IssuesController as ctrl") sidebar.menu-secondary.sidebar header h1 Filters - include views/modules/search-in include views/modules/filter-tags section.main.issues-page diff --git a/app/partials/views/components/notification-message.jade b/app/partials/views/components/notification-message.jade index 04e0c1b3..2621b925 100644 --- a/app/partials/views/components/notification-message.jade +++ b/app/partials/views/components/notification-message.jade @@ -1,11 +1,11 @@ -//div.notification-message.notification-message-success -// div.icon.icon-notification-success -// div.text -// h4.warning Everything is ok -// p Our oompa Loompas saved all your changes! -// a.icon.icon-delete(href="", title="Close notification") +div.hidden.notification-message.notification-message-success + div.icon.icon-notification-success + div.text + h4.warning Everything is ok + p Our oompa Loompas saved all your changes! + a.icon.icon-delete(href="", title="Close notification") -div.notification-message.notification-message-error +div.hidden.notification-message.notification-message-error div.icon.icon-notification-error div.text h4.warning Oops, something happened...