From e07a76471291256094028f0a29e4f278baa83cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Sch=C3=A4ffer?= Date: Sun, 5 Jul 2015 18:39:17 -0300 Subject: Moved floatlabel function to a mixin --- web-ui/app/js/mixins/with_mail_edit_base.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'web-ui/app/js/mixins/with_mail_edit_base.js') diff --git a/web-ui/app/js/mixins/with_mail_edit_base.js b/web-ui/app/js/mixins/with_mail_edit_base.js index 848fe026..3a7b14b5 100644 --- a/web-ui/app/js/mixins/with_mail_edit_base.js +++ b/web-ui/app/js/mixins/with_mail_edit_base.js @@ -203,6 +203,22 @@ define( this.trigger(document, events.ui.userAlerts.displayMessage, { message: 'Your message was sent!' }); }; + this.enableFloatlabel = function(element) { + var showClass = 'showfloatlabel'; + $(element).bind('checkval', function() { + var label = $(this).prev('label'); + if (this.value !== '') { + label.addClass(showClass); + $(this).addClass(showClass); + } else { + label.removeClass(showClass); + $(this).removeClass(showClass); + } + }).on('keyup', function() { + $(this).trigger('checkval'); + }).trigger('checkval'); + }; + this.after('initialize', function () { this.on(document, events.dispatchers.rightPane.clear, this.teardown); this.on(document, events.ui.recipients.updated, this.recipientsUpdated); -- cgit v1.2.3