Add experimental top notify service.

stable
Andrey Antukh 2014-06-25 23:06:15 +02:00
parent 8ab03ab530
commit 01af3f66e0
4 changed files with 31 additions and 12 deletions

View File

@ -20,6 +20,8 @@
### ###
taiga = @.taiga taiga = @.taiga
timeout = @.taiga.timeout
class ConfirmService extends taiga.Service class ConfirmService extends taiga.Service
@.$inject = ["$q"] @.$inject = ["$q"]
@ -71,6 +73,23 @@ class ConfirmService extends taiga.Service
@.el.removeClass("hidden") @.el.removeClass("hidden")
return defered.promise 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 = angular.module("taigaBase")
module.service("$tgConfirm", ["$q", ConfirmService]) module.service("$tgConfirm", ["$q", ConfirmService])

View File

@ -9,8 +9,10 @@ html(lang="en", ng-app="taiga")
meta(name="viewport", content="width=device-width, user-scalable=no") meta(name="viewport", content="width=device-width, user-scalable=no")
link(rel="stylesheet", href="/styles/main.css") link(rel="stylesheet", href="/styles/main.css")
body(tg-main) body(tg-main)
// TODO: move to inner of ng-view
include partials/views/modules/nav 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 div.hidden.lightbox.lightbox_confirm-delete
include partials/views/modules/lightbox_confirm-delete include partials/views/modules/lightbox_confirm-delete
div.hidden.lightbox.lightbox-generic-error div.hidden.lightbox.lightbox-generic-error

View File

@ -1,15 +1,13 @@
extends layout extends dummy-layout
block head block head
title Taiga Project management web application with scrum in mind! title Taiga Project management web application with scrum in mind!
block content block content
div.wrapper div.wrapper(tg-issues, ng-controller="IssuesController as ctrl")
include views/components/notification-message
sidebar.menu-secondary.sidebar sidebar.menu-secondary.sidebar
header header
h1 Filters h1 Filters
include views/modules/search-in include views/modules/search-in
include views/modules/filter-tags include views/modules/filter-tags
section.main.issues-page section.main.issues-page

View File

@ -1,11 +1,11 @@
//div.notification-message.notification-message-success div.hidden.notification-message.notification-message-success
// div.icon.icon-notification-success div.icon.icon-notification-success
// div.text div.text
// h4.warning Everything is ok h4.warning Everything is ok
// p Our oompa Loompas saved all your changes! p Our oompa Loompas saved all your changes!
// a.icon.icon-delete(href="", title="Close notification") 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.icon.icon-notification-error
div.text div.text
h4.warning Oops, something happened... h4.warning Oops, something happened...