add javascript translations, darken background and other confirm

This commit is contained in:
2012-09-07 11:35:33 +02:00
parent 19232be356
commit 3adf392e54
7 changed files with 60 additions and 20 deletions
+31
View File
@@ -0,0 +1,31 @@
root = exports ? this
root.Qwaiter=
alert: (msg) ->
alert(msg)
confirm: (options) ->
options ||= {}
content = options.content || 'Are you sure?'
title = options.title || 'Confirm'
wrapper = $('<div class="modal"></div>')
callback_wrapper = ->
wrapper.modal('hide')
options.ok()
callback_cancel_wrapper = ->
wrapper.modal('hide')
options.cancel() if options.cancel
header = $('<div class="modal-header"></div>')
.append('<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>')
.append('<h3>'+title+'</h3>').appendTo(wrapper)
body = $('<div class="modal-body"></div>').append('<p>'+content+'</p>').appendTo(wrapper)
footer = $('<div class="modal-footer"></div>')
.append($('<a href="#" class="btn">Close</a>').click(callback_cancel_wrapper))
.append($('<a href="#" class="btn btn-primary">Yes</a>').click(callback_wrapper))
.appendTo(wrapper)
wrapper.modal()
currency: (num) ->
num = 0.0 if isNaN(num) || num == '' || num == null
'&euro;&nbsp;' + parseFloat(num).toFixed(2)
jQuery.ajaxSetup
'beforeSend': (xhr) ->
xhr.setRequestHeader("Accept", "text/javascript")