From 7c1fa02a2b45765eb68397a3de687f1345e1e9a8 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 5 Apr 2012 19:30:40 +0200 Subject: [PATCH] Fixed inline editor and system notifications --- wcfsetup/install/files/js/WCF.js | 46 +++++++++++++++++------- wcfsetup/install/files/style/dialog.less | 23 ++++++++++++ 2 files changed, 57 insertions(+), 12 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index c552b106a4..2d58a5e4aa 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -528,7 +528,7 @@ WCF.Dropdown = { // calculate top offset for menu $dropdown.next('.dropdownMenu').css({ - top: $dropdown.outerHeight() + 10 + top: $dropdown.outerHeight() + 14 }); } }); @@ -4127,10 +4127,13 @@ WCF.System.Notification = Class.extend({ * @param string cssClassNames */ init: function(message, cssClassNames) { - this._overlay = $('

' + message + '

').appendTo(document.body); + this._overlay = $('#systemNotification'); + if (!this._overlay.length) { + this._overlay = $('

' + message + '

').appendTo(document.body); + } if (cssClassNames) { - this._overlay.children('p').addClass(cssClassNames); + this._overlay.children('p').removeClass().addClass(cssClassNames); } }, @@ -4139,8 +4142,10 @@ WCF.System.Notification = Class.extend({ * * @param object callback * @param integer duration + * @param string message + * @param string cssClassName */ - show: function(callback, duration) { + show: function(callback, duration, message, cssClassNames) { duration = parseInt(duration); if (!duration) duration = 2000; @@ -4148,6 +4153,9 @@ WCF.System.Notification = Class.extend({ this._callback = callback; } + if (message) this._overlay.children('p').html(message); + if (cssClassNames) this._overlay.children('p').removeClass().addClass(cssClassNames); + // hide overlay after specified duration new WCF.PeriodicalExecuter($.proxy(this._hide, this), duration); @@ -4293,6 +4301,12 @@ WCF.InlineEditor = Class.extend({ */ _callbacks: [ ], + /** + * list of dropdown selections + * @var object + */ + _dropdowns: { }, + /** * list of container elements * @var object @@ -4300,10 +4314,10 @@ WCF.InlineEditor = Class.extend({ _elements: { }, /** - * list of dropdown selections - * @var object + * notification object + * @var WCF.System.Notification */ - _dropdowns: { }, + _notification: null, /** * list of known options @@ -4356,6 +4370,8 @@ WCF.InlineEditor = Class.extend({ this._setOptions(); WCF.CloseOverlayHandler.addCallback('WCF.InlineEditor', $.proxy(this._closeAll, this)); + + this._notification = new WCF.System.Notification(WCF.Language.get('wcf.global.success'), 'success'); }, /** @@ -4401,12 +4417,15 @@ WCF.InlineEditor = Class.extend({ * @param object event */ _show: function(event) { + console.debug(event.currentTarget); var $elementID = $(event.currentTarget).data('elementID'); // build drop down if (!this._dropdowns[$elementID]) { - var $trigger = this._getTriggerElement(this._elements[$elementID]).wrap(''); - this._dropdowns[$elementID] = $('