From 04aee4062eb439f1912d1992d37da276e973546a Mon Sep 17 00:00:00 2001 From: Kevin Ross Date: Tue, 10 Nov 2015 14:45:08 -0600 Subject: [PATCH] standardized on form-group-sm/lg instead of it AND input-sm/lg. Any input-sm/lg is now converted to form-group-* equivalent. Much simpler css and less variants to maintain. --- index.html | 15 --------------- less/_inputs.less | 18 ------------------ scripts/material.js | 12 ++++++++++++ 3 files changed, 12 insertions(+), 33 deletions(-) diff --git a/index.html b/index.html index 3ab56c68..34781e58 100644 --- a/index.html +++ b/index.html @@ -415,21 +415,6 @@

This is a hint as a p.help-block.hint

- - - - - - - - - - - - - - -

Input - Legacy

diff --git a/less/_inputs.less b/less/_inputs.less index 451c309a..cd6e846e 100644 --- a/less/_inputs.less +++ b/less/_inputs.less @@ -165,21 +165,6 @@ select.form-control { // Reference http://www.google.com/design/spec/components/text-fields.html // MDL implementation: http://www.getmdl.io/components/index.html#textfields-section -// this is for input-sm and input-lg directly on input. Recommended way is form-group-sm and form-group-lg instead. -//.input-size-floating-label(@name, @size) { -// .form-control.@{name} ~ & { -// font-size: @size; -// top: 7px; -// } -// -// .form-group.is-focused .form-control.@{name} ~ .form-group.is-focused &, -// .form-group.is-empty .form-control.@{name} ~ .form-group.is-empty & { -// top: @floating-label-size-ratio * -@size; -// font-size: @floating-label-size-ratio * @size; -// } -//} - -// Do not nest label.floating-label inside .form-group - it messes with ~ selector label.control-label.floating-label { @label-as-placeholder-top: -1 * @md-input-padding-base-vertical; @@ -202,9 +187,6 @@ label.control-label.floating-label { top: @label-as-placeholder-top - (@md-input-label-font-size-base + @md-input-padding-base-vertical); // FIXME this needs to be calculated and moved up to .is-focused !!! font-size: @md-input-label-font-size-base; } - - //.input-size-floating-label(input-sm, @md-input-font-size-small); - //.input-size-floating-label(input-lg, @md-input-font-size-large); } .input-group { diff --git a/scripts/material.js b/scripts/material.js index 74ed63a6..5186489e 100644 --- a/scripts/material.js +++ b/scripts/material.js @@ -86,6 +86,18 @@ $input.removeAttr("data-hint"); } + // Legacy - Change input-sm/lg to form-group-sm/lg instead (preferred standard and simpler css/less variants) + var legacySizes = { + "input-lg": "form-group-lg", + "input-sm": "form-group-sm" + }; + $.each( legacySizes, function( legacySize, standardSize ) { + if ($input.hasClass(legacySize)) { + $input.removeClass(legacySize); + $formGroup.addClass(standardSize); + } + }); + // Legacy - Add floating label if using old shorthand if ($input.hasClass("floating-label")) { var placeholder = $input.attr("placeholder");