From 238e1bf6ff9d4745067011ff8ed31cc8ee94e7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Wed, 9 Jul 2014 13:09:29 +0200 Subject: [PATCH] Add confirm light error --- app/coffee/modules/auth.coffee | 11 ++++------- app/coffee/modules/base/confirm.coffee | 4 ++-- .../views/components/notification-message.jade | 7 +++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index 47ea26bf..2a7772d7 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -165,7 +165,7 @@ LoginDirective = ($auth, $confirm, $location) -> # promise.then null, (response) -> if response.data._error_message - $confirm.error(response.data._error_message) + $confirm.notify("light-error", response.data._error_message) $el.on "submit", (event) -> event.preventDefault() @@ -201,7 +201,7 @@ RegisterDirective = ($auth, $confirm) -> promise.then null, (response) -> if response.data._error_message - $confirm.error(response.data._error_message) + $confirm.notify("light-error", response.data._error_message) $el.on "submit", (event) -> event.preventDefault() @@ -230,15 +230,12 @@ ForgotPasswordDirective = ($auth, $confirm, $location) -> promise = $auth.forgotPassword($scope.data) promise.then (response) -> if response.data.detail - # TODO: Show a success message (reset-pass.jade?) and move to /login - #$confirm.notify("success", response.data.detail) $location.path("/login") # TODO: Use the future 'urls' service - console.log response.data.detail - # + $confirm.success(response.data.detail) promise.then null, (response) -> if response.data._error_message - $confirm.error(response.data._error_message) + $confirm.notify("light-error", response.data._error_message) $el.on "submit", (event) -> event.preventDefault() diff --git a/app/coffee/modules/base/confirm.coffee b/app/coffee/modules/base/confirm.coffee index e7d3dcf3..ebe0cc00 100644 --- a/app/coffee/modules/base/confirm.coffee +++ b/app/coffee/modules/base/confirm.coffee @@ -105,12 +105,12 @@ class ConfirmService extends taiga.Service # because the notification message not permits # custom messages. # - # Types: error, success + # Types: error, success, light-error selector = ".notification-message-#{type}" @.el = angular.element(selector) body = angular.element("body") - body.find(".notification-message").addClass("hidden") + body.find(".notification-message, notification-light").addClass("hidden") body.find(selector).removeClass("hidden") if @.tsem diff --git a/app/partials/views/components/notification-message.jade b/app/partials/views/components/notification-message.jade index 2621b925..ff03c307 100644 --- a/app/partials/views/components/notification-message.jade +++ b/app/partials/views/components/notification-message.jade @@ -11,3 +11,10 @@ div.hidden.notification-message.notification-message-error h4.warning Oops, something happened... p Our oompa Loompas are sad, your changes were not saved! a.icon.icon-delete(href="", title="Close notification") + +div.hidden.notification-light.notification-message-light-error + div.icon.icon-notification-error + div.text + h4.warning Oops, something happened... + p Our oompa Loompas are sad, your changes were not saved! + a.icon.icon-delete(href="", title="Close notification")