Skip to content

Commit

Permalink
style(rxForm): add valid/invalid border colors; closes #359
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Lamping committed Jun 24, 2014
1 parent 5c163d9 commit 06343ea
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
22 changes: 18 additions & 4 deletions src/rxForm/docs/rxForm.html
@@ -1,9 +1,23 @@
<div class="forms" ng-controller="rxFormDemoCtrl">
<h3>Example of simple text input</h3>
<rx-form-item label="Display Name" description="<a href='#'>Here</a> is my <b>HTML</b>" prefix="$" suffix="GB">
<input type="text" ng-model="volume.name" ng-required="true" />
<h3>Example of required text input w/ validation pattern</h3>
<rx-form-item label="Volume Name" description="Must be 2-5 letter palindrome (e.g. 'dewed')">
<input type="text" ng-model="volume.name" ng-required="volume.isNameRequired" ng-pattern="/^\b(\w)?(\w)\w?\2\1$/" />
</rx-form-item>
<p>Bound Value: {{volume.name}}</p>

<rx-form-item label="Name Field Required?" class="clear">
<input type="checkbox" ng-model="volume.isNameRequired" />
</rx-form-item>

<p class="clear">Bound Value: {{volume.name}}</p>

<hr >

<h3>Example with prefix/suffix</h3>
<rx-form-item label="Monthly Cost" prefix="$" suffix="million">
<input type="number" ng-model="volume.cost" />
</rx-form-item>

<hr >

<h3>Select Box</h3>
<rx-form-item label="Type" prefix="$" description="Bound Value: {{volume.type}}">
Expand Down
2 changes: 1 addition & 1 deletion src/rxForm/docs/rxForm.js
Expand Up @@ -11,7 +11,7 @@ function rxFormDemoCtrl ($scope) {
];

$scope.volume = {
name: 'Volume-1',
isNameRequired: true,
type: _.first($scope.types).value, // select the first type by default
checked: [true, 'unchecked'] //example with first checkbox automatically checked
};
Expand Down
8 changes: 8 additions & 0 deletions src/rxForm/rxForm.less
Expand Up @@ -107,6 +107,14 @@ field-prefix, field-suffix and field-description are optional.
color: @inputColor;
font-size: 1.2em;
border-radius: 0;

&.ng-valid.ng-dirty {
border-color: @inputBorderValid;
}

&.ng-invalid.ng-dirty {
border-color: @inputBorderInvalid;
}
}

input,
Expand Down
2 changes: 2 additions & 0 deletions src/styles/vars.less
Expand Up @@ -18,6 +18,8 @@
// Borders
@pageDivider: #e6e6e5;
@inputBorder: #ccc;
@inputBorderValid: #00afec;
@inputBorderInvalid: #ff2400;
@tableBorder: @pageDivider;
@tableHeaderBorder: #6e6e6e;
@appHelpBorder: #424242;
Expand Down

0 comments on commit 06343ea

Please sign in to comment.