Improved notifications.

This commit is contained in:
Martin Edenhofer 2012-04-24 08:38:47 +02:00
parent 3a6a3e94d4
commit c9a7108af2
2 changed files with 23 additions and 28 deletions

View file

@ -59,10 +59,6 @@ class Index extends App.Controller
form: @formGen( model: { configure_attributes: configure_attributes, className: 'create' } ),
)
# @modalShow(
# navigateBack: true
# )
user_new: (e) =>
e.preventDefault()
new UserNew()
@ -124,13 +120,14 @@ class Index extends App.Controller
# notify UI
@notify
type: 'success',
msg: 'Ticket ' + r.number + ' created!'
msg: "Ticket <a href=\"#ticket/zoom/#{r.id}\">#{r.number}</a> created!",
timeout: 12000,
# create new create screen
@render()
# scroll to top
window.scrollTo(0,0)
@scrollTo()
error: =>
@log 'save failed!'

View file

@ -10,38 +10,36 @@ class App.Notify extends Spine.Controller
super
Spine.bind 'notify', (data) =>
@[data.type] data.msg
@render(data)
Spine.bind 'notify:removeall', =>
@log 'notify:removeall', @
@destroyAll()
info: (data) ->
@render( text: arguments[0], type: 'information' )
warning: (data) ->
@render( text: arguments[0], type: 'alert' )
error: (data) ->
@render( text: arguments[0], type: 'error' )
success: (data) ->
@render( text: arguments[0], type: 'success' )
render: (data) ->
# notify = App.view('notify')(data: data)
# @append( notify )
# match noty naming
if data['type'] is 'info'
data['type'] = 'information'
$.noty.closeAll()
$('#notify').noty(
{
text: data.text,
text: data.msg,
layout: 'top',
type: data.type,
theme: 'noty_theme_twitter',
animateOpen: { height: 'toggle' },
animateClose: { height: 'toggle' },
animateOpen: {
height: 'toggle'
opacity: 0.85,
},
animateClose: {
opacity: 0.25,
},
speed: 450,
timeout: 3600,
timeout: data.timeout || 3800,
closeButton: false,
closeOnSelfClick: true,
closeOnSelfOver: false,