[Frontend] Form validation styling

Fixes #1047
<mct-form> must now include class
'validates'  to display validation glyph icons;
removed 'no-validate' from markup; cleaned
up validation scss;
This commit is contained in:
Charles Hacskaylo 2016-07-28 18:32:34 -07:00
parent 69dc893b4b
commit af36b9996d
8 changed files with 57 additions and 66 deletions

View File

@ -20,12 +20,14 @@
at runtime from the About dialog for additional information.
-->
<div ng-controller="ExampleFormController">
<mct-toolbar structure="toolbar" ng-model="state" name="aToolbar">
</mct-toolbar>
<mct-form structure="form" ng-model="state" name="aForm">
</mct-form>
<mct-toolbar structure="toolbar"
ng-model="state"
name="aToolbar"></mct-toolbar>
<mct-form structure="form"
ng-model="state"
class="validates"
name="aForm"></mct-form>
<ul>
<li>Dirty: {{aForm.$dirty}}</li>
@ -33,11 +35,8 @@
</ul>
<pre>
<textarea>
{{state | json}}
</textarea>
<textarea>
{{state | json}}
</textarea>
</pre>
</div>

View File

@ -21,11 +21,12 @@
-->
<div class="abs top-bar">
<div class="title">{{ngModel.title}}</div>
<div class="hint">All fields marked <span class="ui-symbol req">*</span> are required.</div>
<div class="hint">All fields marked <span class="req icon-asterisk"></span> are required.</div>
</div>
<div class='abs editor'>
<mct-form ng-model="ngModel.value"
structure="ngModel.structure"
class="validates"
name="createForm">
</mct-form>
</div>

View File

@ -108,7 +108,7 @@ $bubbleMaxW: 300px;
/*************** Forms */
$reqSymbolW: 15px;
$reqSymbolM: $interiorMargin * 2;
$reqSymbolFontSize: 0.7em;
$reqSymbolFontSize: 0.75em;
/*************** Wait Spinner Defaults */
$waitSpinnerD: 32px;
$waitSpinnerTreeD: 20px;

View File

@ -107,7 +107,7 @@
background-color: $colorInspectorSectionHeaderBg;
color: $colorInspectorSectionHeaderFg;
margin-bottom: $interiorMargin;
padding: $formTBPad $formLRPad;
padding: floor($formTBPad * .75) $formLRPad;
text-transform: uppercase;
}

View File

@ -136,18 +136,13 @@
}
}
.no-validate {
.form .form-row >.label {
padding-right: 0;
&:after {
display: none;
}
}
}
.hint,
.s-hint {
font-size: 0.9em;
.req {
color: $colorFormRequired;
font-size: 0.7rem;
}
}
.l-result {

View File

@ -19,48 +19,44 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
.validates {
> .label {
padding-right: $reqSymbolM; // Keep room for validation element
&:before {
position: absolute;
right: $interiorMargin;
font-size: $reqSymbolFontSize;
height: 100%;
line-height: 200%;
mct-form.validates {
.form-row.validates {
> .label {
padding-right: $reqSymbolM; // Keep room for validation element
&:before {
position: absolute;
right: $interiorMargin;
font-size: $reqSymbolFontSize;
height: 100%;
line-height: 200%;
}
}
}
&.invalid,
&.invalid.req {
> .label {
@extend .icon-x;
&:before {
color: $colorFormInvalid;
&.invalid,
&.invalid.req {
> .label {
@extend .icon-x;
&:before {
color: $colorFormInvalid;
}
}
}
&.valid,
&.valid.req {
> .label {
@extend .icon-check;
&:before {
color: $colorFormValid;
}
}
}
&.req {
> .label {
@extend .icon-asterisk;
&:before {
color: $colorFormRequired;
}
}
}
}
&.valid,
&.valid.req {
> .label {
@extend .icon-check;
&:before {
color: $colorFormValid;
}
}
}
&.req {
> .label {
@extend .icon-asterisk;
&:before {
color: $colorFormRequired;
}
}
}
}
.req {
font-size: $reqSymbolFontSize;
}
span.req {
color: $colorFormRequired;
}

View File

@ -25,13 +25,13 @@
ng-model="configuration.plot.xAxis"
structure="xAxisForm"
name="xAxisFormState"
class="flex-elem l-flex-row no-validate no-margin">
class="flex-elem l-flex-row no-margin">
</mct-form>
<mct-form
ng-model="configuration.plot.yAxis"
structure="yAxisForm"
name="yAxisFormState"
class="flex-elem l-flex-row no-validate no-margin">
class="flex-elem l-flex-row no-margin">
</mct-form>
<div class="form">
<div class="section-header ng-binding ng-scope">
@ -60,7 +60,7 @@
ng-model="configuration.plot.series[$index]"
structure="plotSeriesForm"
name="plotOptionsState"
class="flex-elem l-flex-row no-validate">
class="flex-elem l-flex-row">
</mct-form>
</span>
</li>

View File

@ -25,6 +25,6 @@
ng-model="configuration.table.columns"
structure="columnsForm"
name="columnsFormState"
class="flex-elem l-flex-row no-validate no-margin">
class="flex-elem l-flex-row no-margin">
</mct-form>
</div>