From 7260a963eae4c4196cf4e7a5aeb62dfe7bb3c251 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Tue, 4 Mar 2014 22:29:20 -0600 Subject: [PATCH] Hide signature box when empty Also, default size should not decrease if different signatures are selected --- js/redactor-osticket.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/redactor-osticket.js b/js/redactor-osticket.js index 210c21114..d41c87ba6 100644 --- a/js/redactor-osticket.js +++ b/js/redactor-osticket.js @@ -121,13 +121,16 @@ RedactorPlugins.draft = { RedactorPlugins.signature = { init: function() { - var $el = $(this.$element.get(0)); + var $el = $(this.$element.get(0)), + inner = $('<div class="inner"></div>'); if ($el.data('signatureField')) { this.$signatureBox = $('<div class="selected-signature"></div>') - .append($('<div class="inner"></div>') - .html($el.data('signature')) - ) + .append(inner) .appendTo(this.$box); + if ($el.data('signature')) + inner.html($el.data('signature')); + else + this.$signatureBox.hide(); $('input[name='+$el.data('signatureField')+']', $el.closest('form')) .on('change', false, false, $.proxy(this.updateSignature, this)) if ($el.data('deptField')) @@ -141,7 +144,7 @@ RedactorPlugins.signature = { originalShadow = this.$signatureBox.css('box-shadow'); this.$signatureBox.hover(function() { hoverTimeout = setTimeout($.proxy(function() { - originalHeight = outer.height() + originalHeight = Math.max(originalHeight, outer.height()); $(this).animate({ 'height': inner.offsetHeight }, 'fast'); -- GitLab