diff options
author | Leonardo Schäffer <leonardo.schaffer@gmail.com> | 2015-06-07 18:51:11 -0300 |
---|---|---|
committer | Leonardo Schäffer <leonardo.schaffer@gmail.com> | 2015-06-07 18:51:11 -0300 |
commit | 5487ddebc2c0fff66450b27b554af525f7ef2cc8 (patch) | |
tree | fd0d63572a75c44cae3d138b1bf6a755351151b9 /web-ui/app/js/mail_view | |
parent | 4981e7ad505cd1cea767e7d12fcf9c6521994f86 (diff) |
Implemented floatlabels for input fields when composing email
Diffstat (limited to 'web-ui/app/js/mail_view')
-rw-r--r-- | web-ui/app/js/mail_view/ui/compose_box.js | 20 | ||||
-rw-r--r-- | web-ui/app/js/mail_view/ui/draft_box.js | 20 |
2 files changed, 40 insertions, 0 deletions
diff --git a/web-ui/app/js/mail_view/ui/compose_box.js b/web-ui/app/js/mail_view/ui/compose_box.js index 1b209b23..1b17e5a3 100644 --- a/web-ui/app/js/mail_view/ui/compose_box.js +++ b/web-ui/app/js/mail_view/ui/compose_box.js @@ -57,6 +57,26 @@ define( this.select('recipientsFields').show(); this.on(this.select('closeButton'), 'click', this.showNoMessageSelected); this.enableAutoSave(); + + function floatlabelHandler(element) { + $(function() { + 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"); + }); + } + floatlabelHandler("input.floatlabel"); + floatlabelHandler("textarea.floatlabel"); }; this.mailDeleted = function(event, data) { diff --git a/web-ui/app/js/mail_view/ui/draft_box.js b/web-ui/app/js/mail_view/ui/draft_box.js index adad108f..09376b97 100644 --- a/web-ui/app/js/mail_view/ui/draft_box.js +++ b/web-ui/app/js/mail_view/ui/draft_box.js @@ -72,6 +72,26 @@ define( this.enableAutoSave(); this.on(this.select('cancelButton'), 'click', this.showNoMessageSelected); this.on(this.select('closeMailButton'), 'click', this.showNoMessageSelected); + + function floatlabelHandler(element) { + $(function() { + 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"); + }); + } + floatlabelHandler("input.floatlabel"); + floatlabelHandler("textarea.floatlabel"); }; this.mailDeleted = function(event, data) { |