Improved notifications.
This commit is contained in:
parent
3a6a3e94d4
commit
c9a7108af2
2 changed files with 23 additions and 28 deletions
|
@ -59,10 +59,6 @@ class Index extends App.Controller
|
||||||
form: @formGen( model: { configure_attributes: configure_attributes, className: 'create' } ),
|
form: @formGen( model: { configure_attributes: configure_attributes, className: 'create' } ),
|
||||||
)
|
)
|
||||||
|
|
||||||
# @modalShow(
|
|
||||||
# navigateBack: true
|
|
||||||
# )
|
|
||||||
|
|
||||||
user_new: (e) =>
|
user_new: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
new UserNew()
|
new UserNew()
|
||||||
|
@ -124,13 +120,14 @@ class Index extends App.Controller
|
||||||
# notify UI
|
# notify UI
|
||||||
@notify
|
@notify
|
||||||
type: 'success',
|
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
|
# create new create screen
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
# scroll to top
|
# scroll to top
|
||||||
window.scrollTo(0,0)
|
@scrollTo()
|
||||||
|
|
||||||
error: =>
|
error: =>
|
||||||
@log 'save failed!'
|
@log 'save failed!'
|
||||||
|
|
|
@ -10,38 +10,36 @@ class App.Notify extends Spine.Controller
|
||||||
super
|
super
|
||||||
|
|
||||||
Spine.bind 'notify', (data) =>
|
Spine.bind 'notify', (data) =>
|
||||||
@[data.type] data.msg
|
@render(data)
|
||||||
|
|
||||||
Spine.bind 'notify:removeall', =>
|
Spine.bind 'notify:removeall', =>
|
||||||
@log 'notify:removeall', @
|
@log 'notify:removeall', @
|
||||||
@destroyAll()
|
@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) ->
|
render: (data) ->
|
||||||
# notify = App.view('notify')(data: data)
|
# notify = App.view('notify')(data: data)
|
||||||
# @append( notify )
|
# @append( notify )
|
||||||
|
|
||||||
|
# match noty naming
|
||||||
|
if data['type'] is 'info'
|
||||||
|
data['type'] = 'information'
|
||||||
|
|
||||||
$.noty.closeAll()
|
$.noty.closeAll()
|
||||||
$('#notify').noty(
|
$('#notify').noty(
|
||||||
{
|
{
|
||||||
text: data.text,
|
text: data.msg,
|
||||||
layout: 'top',
|
layout: 'top',
|
||||||
type: data.type,
|
type: data.type,
|
||||||
theme: 'noty_theme_twitter',
|
theme: 'noty_theme_twitter',
|
||||||
animateOpen: { height: 'toggle' },
|
animateOpen: {
|
||||||
animateClose: { height: 'toggle' },
|
height: 'toggle'
|
||||||
|
opacity: 0.85,
|
||||||
|
},
|
||||||
|
animateClose: {
|
||||||
|
opacity: 0.25,
|
||||||
|
},
|
||||||
speed: 450,
|
speed: 450,
|
||||||
timeout: 3600,
|
timeout: data.timeout || 3800,
|
||||||
closeButton: false,
|
closeButton: false,
|
||||||
closeOnSelfClick: true,
|
closeOnSelfClick: true,
|
||||||
closeOnSelfOver: false,
|
closeOnSelfOver: false,
|
||||||
|
|
Loading…
Reference in a new issue