add javascript translations, darken background and other confirm
This commit is contained in:
@@ -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
|
||||
'€ ' + parseFloat(num).toFixed(2)
|
||||
|
||||
jQuery.ajaxSetup
|
||||
'beforeSend': (xhr) ->
|
||||
xhr.setRequestHeader("Accept", "text/javascript")
|
||||
Reference in New Issue
Block a user