From 1da608290605e6420cda57c899cfb7c76e561812 Mon Sep 17 00:00:00 2001 From: Ezequiel Bergamaschi Date: Sat, 15 Mar 2014 02:48:28 -0300 Subject: [PATCH] ModalDialogNotifier reimplemented --- .../src/main/javascript/DesignerKeyboard.js | 1 - .../javascript/widget/ModalDialogNotifier.js | 94 +++++-------------- 2 files changed, 21 insertions(+), 74 deletions(-) diff --git a/mindplot/src/main/javascript/DesignerKeyboard.js b/mindplot/src/main/javascript/DesignerKeyboard.js index c56f13fd..2a76dd9f 100644 --- a/mindplot/src/main/javascript/DesignerKeyboard.js +++ b/mindplot/src/main/javascript/DesignerKeyboard.js @@ -30,7 +30,6 @@ mindplot.DesignerKeyboard = new Class({ }, initialize:function (designer) { - //console.error("Re-impl required ...."); $assert(designer, "designer can not be null"); this._registerEvents(designer); }, diff --git a/mindplot/src/main/javascript/widget/ModalDialogNotifier.js b/mindplot/src/main/javascript/widget/ModalDialogNotifier.js index c7940f76..1d43d3ef 100644 --- a/mindplot/src/main/javascript/widget/ModalDialogNotifier.js +++ b/mindplot/src/main/javascript/widget/ModalDialogNotifier.js @@ -17,85 +17,33 @@ */ mindplot.widget.ModalDialogNotifier = new Class({ -// Extends:MooDialog, - initialize: function () { - console.error("Re-impl required ...."); -// this.parent( -// { -// closeButton:false, -// destroyOnClose:false, -// autoOpen:true, -// useEscKey:false, -// closeOnOverlayClick:false, -// title:"", -// onInitialize:function (wrapper) { -// wrapper.setStyle('opacity', 0); -// this.wrapper.setStyle('display', 'none'); -// this.fx = new Fx.Morph(wrapper, { -// duration:100, -// transition:Fx.Transitions.Bounce.easeOut -// }); -// }, -// -// onBeforeOpen:function () { -// var panel = this._buildPanel(); -// this.setContent(panel); -// -// this.overlay = new Overlay(this.options.inject, { -// duration:this.options.duration -// }); -// if (this.options.closeOnOverlayClick) -// this.overlay.addEvent('click', this.close.bind(this)); -// this.overlay.open(); -// this.fx.start({ -// 'margin-top':[-200, -100], -// opacity:[0, 1] -// }).chain(function () { -// this.fireEvent('show'); -// this.wrapper.setStyle('display', 'block'); -// }.bind(this)); -// }, -// -// onBeforeClose:function () { -// this.fx.start({ -// 'margin-top':[-100, 0], -// opacity:0, -// duration:200 -// }).chain(function () { -// this.wrapper.setStyle('display', 'none'); -// this.fireEvent('hide'); -// -// }.bind(this)); -// }} -// ); -// this.message = null; - }, + initialize: function () {}, + + //FIXME: replace by alert() show: function (message, title) { $assert(message, "message can not be null"); - this._messsage = message; - this.options.title = $defined(title) ? title : "Outch!!. An unexpected error has occurred"; - this.open(); - }, - destroy: function () { - this.parent(); - this.overlay.destroy(); - }, + var modalDialog = $(''); - _buildPanel: function () { - var result = new Element('div'); - result.setStyles({ - 'text-align': 'center', - width: '400px' - }); - var p = new Element('p', {'text': this._messsage}); - p.inject(result); + var p = '

' + message + '

' + var h4 = title ? '

' + title + '

' : ""; - var img = new Element('img', {'src': 'images/alert-sign.png'}); - img.inject(result); - - return result; + modalDialog.find('.alert-content').append(h4 + p); + modalDialog.modal(); } });