Add confirm light error

stable
David Barragán Merino 2014-07-09 13:09:29 +02:00
parent b98e49386c
commit 238e1bf6ff
3 changed files with 13 additions and 9 deletions

View File

@ -165,7 +165,7 @@ LoginDirective = ($auth, $confirm, $location) ->
# #
promise.then null, (response) -> promise.then null, (response) ->
if response.data._error_message if response.data._error_message
$confirm.error(response.data._error_message) $confirm.notify("light-error", response.data._error_message)
$el.on "submit", (event) -> $el.on "submit", (event) ->
event.preventDefault() event.preventDefault()
@ -201,7 +201,7 @@ RegisterDirective = ($auth, $confirm) ->
promise.then null, (response) -> promise.then null, (response) ->
if response.data._error_message if response.data._error_message
$confirm.error(response.data._error_message) $confirm.notify("light-error", response.data._error_message)
$el.on "submit", (event) -> $el.on "submit", (event) ->
event.preventDefault() event.preventDefault()
@ -230,15 +230,12 @@ ForgotPasswordDirective = ($auth, $confirm, $location) ->
promise = $auth.forgotPassword($scope.data) promise = $auth.forgotPassword($scope.data)
promise.then (response) -> promise.then (response) ->
if response.data.detail 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 $location.path("/login") # TODO: Use the future 'urls' service
console.log response.data.detail $confirm.success(response.data.detail)
#
promise.then null, (response) -> promise.then null, (response) ->
if response.data._error_message if response.data._error_message
$confirm.error(response.data._error_message) $confirm.notify("light-error", response.data._error_message)
$el.on "submit", (event) -> $el.on "submit", (event) ->
event.preventDefault() event.preventDefault()

View File

@ -105,12 +105,12 @@ class ConfirmService extends taiga.Service
# because the notification message not permits # because the notification message not permits
# custom messages. # custom messages.
# #
# Types: error, success # Types: error, success, light-error
selector = ".notification-message-#{type}" selector = ".notification-message-#{type}"
@.el = angular.element(selector) @.el = angular.element(selector)
body = angular.element("body") body = angular.element("body")
body.find(".notification-message").addClass("hidden") body.find(".notification-message, notification-light").addClass("hidden")
body.find(selector).removeClass("hidden") body.find(selector).removeClass("hidden")
if @.tsem if @.tsem

View File

@ -11,3 +11,10 @@ div.hidden.notification-message.notification-message-error
h4.warning Oops, something happened... h4.warning Oops, something happened...
p Our oompa Loompas are sad, your changes were not saved! p Our oompa Loompas are sad, your changes were not saved!
a.icon.icon-delete(href="", title="Close notification") 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")