better phone alert and optimization

This commit is contained in:
2012-11-29 21:59:19 +01:00
parent 68f3437f8d
commit 8e2ff5ebad
5 changed files with 55 additions and 38 deletions
+12 -3
View File
@@ -1,7 +1,9 @@
window.Qwaiter=
alert: (msg) ->
alert(msg)
confirm: (options) ->
alert: (msg) ->
template = @mustache('#alert-template', {title: 'Alert', message: msg, close: 'OK'})
$(template).modal()
false
confirm: (options) ->
options ||= {}
content = options.content || 'Are you sure?'
title = options.title || 'Confirm'
@@ -24,6 +26,13 @@ window.Qwaiter=
currency: (num) ->
num = 0.0 if isNaN(num) || num == '' || num == null
'€ ' + parseFloat(num).toFixed(2)
mustache: (selector, locals)->
locs = $.extend(locals,
currency: ->
(val)->
currency(Mustache.render(val, this))
)
Mustache.to_html($(selector).html(), locs)
jQuery.ajaxSetup
'beforeSend': (xhr) ->