vendor/assets/javascripts/quick_script/classes.js.coffee in quick_script-0.9.10 vs vendor/assets/javascripts/quick_script/classes.js.coffee in quick_script-0.10.0

- old
+ new

@@ -141,26 +141,29 @@ $(document).click -> Overlay.removePopovers() Overlay.instance = new Overlay() Overlay.closeDialog = -> @remove('dialog') -Overlay.add = (vm, tmp, options, cls) -> +Overlay.add = (vm, tmp, opts) -> + opts ||= {} + css_opts = opts.style || {} + cls = opts.class || '' id = vm.name template = tmp - cls = cls || '' - options = {} if !options? #options['z-index'] = Overlay.instance.zindex + 10 $('body').append("<div id='overlay-" + id + "' class='modal hide fade'><button class='close' data-bind='click : hideOverlay'>x</button><div class='content' data-bind=\"template: '" + template + "'\"></div></div>") - #$('#overlay-' + id).css(options) - #$('#overlay-' + id).addClass(cls) - #$('#overlay-' + id).css({'margin-left' : -1 * $('#overlay-' + id).width() / 2}) - #$('.overlay .content').css({'max-height' : ($(window).height() - 100)}) + $('#overlay-' + id).css(css_opts) + $('#overlay-' + id).addClass(cls) + $('#overlay-' + id).css({'margin-left' : -1 * $('#overlay-' + id).width() / 2}) #$('#backdrop-' + id).click => #console.log('backdrop clicked.') #Overlay.remove(id) setTimeout -> $('#overlay-' + id).koBind(vm) + if opts.stretch == true + $("#overlay-#{id} .modal-body").css({'max-height' : ($(window).height() - 200)}) + $('#overlay-' + id).css({'margin-top' : ($(window).height() - 100)/ -2}) $('#overlay-' + id).modal('show') $('#overlay-' + id).on 'hidden', -> $('#overlay-' + id).koClean() $('#overlay-' + id).remove() , 100 @@ -180,11 +183,11 @@ tm = tm || 3000 Overlay.clearNotifications() $('body').prepend("<div id='notify' class='notify' style='display: none;'>" + msg + "</div>") if (cls) $('#notify').addClass(cls) - $('#notify').slideDown 'slow', -> + $('#notify').fadeIn 'slow', -> Overlay.instance.notifyTimeout = setTimeout -> $('#notify').fadeOut('slow') , tm Overlay.clearNotifications = -> @@ -197,16 +200,18 @@ opts.yes() if opts.yes? Overlay.remove('confirm') no : -> opts.no() if opts.no? Overlay.remove('confirm') - $('body').prepend("<div class='backdrop' id='backdrop-confirm' style='z-index:500'></div><div id='overlay-confirm' class='confirm' style='display: none;'><div class='msg'>" + msg + "</div><div class='opts'><button class='button green' data-bind='click : yes'>yes</button><button class='button red' data-bind='click : no'>no</button></div></div>") + $('body').prepend("<div class='backdrop' id='backdrop-confirm' style='z-index:500'></div><div id='overlay-confirm' class='confirm' style='display: none;'><div class='msg'>" + msg + "</div><div class='opts'><button class='btn btn-success' data-bind='click : yes'>yes</button> <button class='btn btn-danger' data-bind='click : no'>no</button></div></div>") $('#overlay-confirm').koBind(vm) $('#overlay-confirm').slideDown 'fast' Overlay.remove = (id) -> $('#overlay-' + id).modal('hide') $('#popover-' + id).koClean().remove() + $('#backdrop-' + id).remove() + $('#overlay-' + id).remove() if (id == 'confirm') Overlay.removePopovers = -> $('.popover').remove() Overlay.isVisible = (id) ->