Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 7d5bc96

Browse files
committed
Merge pull request #307 from appirio-tech/persistent-placeholder
Persistent placeholder
2 parents c372c5f + 2db9cf5 commit 7d5bc96

File tree

12 files changed

+87
-76
lines changed

12 files changed

+87
-76
lines changed

app/account/register/register.jade

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
p.form-error(ng-show="vm.errMsg") {{vm.errMsg}}
1414

1515
.first-last-names
16-
input(right-placeholder, focused-placeholder="First", ng-model="vm.firstname", maxlength="64", name="firstname", placeholder="First Name", type="text", required)
16+
input-sticky-placeholder(sticky-placeholder="First", ng-model="vm.firstname")
17+
input(ng-model="vm.firstname", maxlength="64", name="firstname", placeholder="First Name", type="text", required)
1718

18-
input(right-placeholder, focused-placeholder="Last", ng-model="vm.lastname", maxlength="64", name="lastname", placeholder="Last Name", type="text", required)
19+
input-sticky-placeholder(sticky-placeholder="Last", ng-model="vm.lastname")
20+
input(ng-model="vm.lastname", maxlength="64", name="lastname", placeholder="Last Name", type="text", required)
1921

2022
.country-dropdown
2123
angucomplete-alt(
@@ -36,7 +38,8 @@
3638
p.form-error(ng-show="vm.registerForm.country.$error.required") Please choose a country from the list.
3739

3840
.validation-bar(ng-class="{ 'error-bar': (vm.registerForm.username.$error.usernameIsFree || vm.registerForm.username.$error.minlength || vm.registerForm.username.$error.maxlength), 'success-bar': (vm.registerForm.username.$valid && !vm.registerForm.username.$error.usernameIsFree) }")
39-
input(right-placeholder, focused-placeholder="Username", ng-model="vm.username", ng-model-options="{ debounce: {'default': 500} }", ng-focus="vm.usernameTips = true", ng-blur="vm.usernameTips = false", ng-minlength="2", ng-maxlength="15", name="username", placeholder="Username", type="text", username-is-free, required)
41+
input-sticky-placeholder(sticky-placeholder="Username", ng-model="vm.username")
42+
input(ng-model="vm.username", ng-model-options="{ debounce: {'default': 500} }", ng-focus="vm.usernameTips = true", ng-blur="vm.usernameTips = false", ng-minlength="2", ng-maxlength="15", name="username", placeholder="Username", type="text", username-is-free, required)
4043

4144
.tips.username-tips(ng-show="vm.usernameTips")
4245
h3 Username Tips:
@@ -53,7 +56,8 @@
5356
p.form-error(ng-show="vm.registerForm.username.$dirty && (vm.registerForm.username.$error.minlength || vm.registerForm.username.$error.maxlength)") That username is not the correct length or format.
5457

5558
.validation-bar(ng-class="{ 'error-bar': (vm.registerForm.email.$dirty && vm.registerForm.email.$invalid), 'success-bar': (vm.registerForm.email.$valid) }")
56-
input(right-placeholder, focused-placeholder="Email", ng-model="vm.email", ng-model-options="{ debounce: {'default': 500} }", ng-focus="vm.emailTips = true", ng-blur="vm.emailTips = false", name="email", placeholder="Enter Your Email", type="email", valid-email, email-is-available, required)
59+
input-sticky-placeholder(sticky-placeholder="Email", ng-model="vm.email")
60+
input(ng-model="vm.email", ng-model-options="{ debounce: {'default': 500} }", ng-focus="vm.emailTips = true", ng-blur="vm.emailTips = false", name="email", placeholder="Enter Your Email", type="email", valid-email, email-is-available, required)
5761

5862
.tips.email-tips(ng-show="vm.emailTips")
5963
h3 Email Tips:

app/account/reset-password/reset-password.jade

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
p.email-label Please enter your email address, and we'll send you a link to reset your password
1212

1313
.validation-bar(ng-class="{ 'error-bar': (vm.generateTokenForm.email.$dirty && vm.generateTokenForm.email.$invalid), 'success-bar': (vm.generateTokenForm.email.$valid) }")
14-
input(right-placeholder, focused-placeholder="Email", ng-model="vm.email", ng-focus="vm.emailTips = true", ng-blur="vm.emailTips = false", name="email", placeholder="EMAIL ADDRESS", type="email", valid-email, required)
14+
input-sticky-placeholder(sticky-placeholder="Email", ng-model="vm.email")
15+
input(ng-model="vm.email", ng-focus="vm.emailTips = true", ng-blur="vm.emailTips = false", name="email", placeholder="EMAIL ADDRESS", type="email", valid-email, required)
1516

1617
.tips.email-tips(ng-show="vm.emailTips")
1718
h3 Email Tips:

app/directives/history-graph/history-graph.directive.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
function historyGraph() {
77
return {
88
restrict: 'E',
9-
templateUrl: function(elem, attrs) {
10-
return 'directives/history-graph/history-graph.directive.html';
11-
},
9+
templateUrl: 'directives/history-graph/history-graph.directive.html',
1210
scope: {
1311
promise: '=',
1412
rating: '=',
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
(function() {
2+
'use strict';
3+
4+
angular.module('tcUIComponents').directive('inputStickyPlaceholder', inputStickyPlaceholder);
5+
6+
/*
7+
* ******
8+
* Make sure to add padding-right to the input element
9+
* so that the text entered does not overlap with the
10+
* sticky-placeholder
11+
* ******
12+
*
13+
* Example:
14+
* input-sticky-placeholder(sticky-placeholder="First", ng-model="vm.firstname")
15+
* input(ng-model="vm.firstname", ...)
16+
*
17+
*/
18+
19+
function inputStickyPlaceholder() {
20+
return {
21+
restrict: 'E',
22+
transclude: true,
23+
replace: true,
24+
templateUrl: 'directives/input-sticky-placeholder/input-sticky-placeholder.html',
25+
link: function(scope, element, attrs) {
26+
var span = angular.element(element[0].children[1]);
27+
var input = angular.element(element[0].children[0].children[0]);
28+
span.text('');
29+
30+
scope.$watch(function() {
31+
return input.val();
32+
}, function(newValue, oldValue) {
33+
span.text('');
34+
35+
if (newValue && newValue.length) {
36+
span.text(attrs.stickyPlaceholder);
37+
}
38+
});
39+
}
40+
};
41+
}
42+
})();
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.input-sticky-placeholder-container
2+
div(ng-transclude)
3+
4+
span.placeholder-text

app/directives/right-placeholder.directive.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

app/index.jade

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ html
6363
link(rel="stylesheet", href="assets/css/directives/skill-tile.css")
6464
link(rel="stylesheet", href="assets/css/directives/profile-widget.css")
6565
link(rel="stylesheet", href="assets/css/directives/ios-card.css")
66+
link(rel="stylesheet", href="assets/css/directives/input-sticky-placeholder.css")
6667
link(rel="stylesheet", href="assets/css/directives/history-graph.css")
6768
link(rel="stylesheet", href="assets/css/directives/external-link-data.css")
6869
link(rel="stylesheet", href="assets/css/directives/external-account.css")
@@ -153,10 +154,10 @@ html
153154
script(src="directives/focus-on.directive.js")
154155
script(src="directives/header/header-menu-item.directive.js")
155156
script(src="directives/history-graph/history-graph.directive.js")
157+
script(src="directives/input-sticky-placeholder/input-sticky-placeholder.directive.js")
156158
script(src="directives/ios-card/ios-card.directive.js")
157159
script(src="directives/on-file-change.directive.js")
158160
script(src="directives/profile-widget/profile-widget.directive.js")
159-
script(src="directives/right-placeholder.directive.js")
160161
script(src="directives/skill-tile/skill-tile.directive.js")
161162
script(src="directives/slideable.directive.js")
162163
script(src="directives/srm-tile/srm-tile.directive.js")

assets/css/account/register.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333

3434
input[name="firstname"], input[name="lastname"] {
3535
width: 185px;
36+
padding-right: 45px;
37+
}
38+
39+
input[name="username"], input[name="email"] {
40+
padding-right: 85px;
3641
}
3742
}
3843

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@import '../partials/combined';
2+
3+
.input-sticky-placeholder-container {
4+
position: relative;
5+
6+
span.placeholder-text {
7+
position: absolute;
8+
top: 3px;
9+
right: 10px;
10+
@include sofia-pro-regular;
11+
font-size: 10px;
12+
line-height: 40px;
13+
text-transform: uppercase;
14+
color: $system-gray;
15+
}
16+
}

assets/css/my-dashboard/srms.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
margin-bottom: 15px;
8181
padding: 0 21px;
8282
border: 1px solid #DCDCDC;
83+
background-color: $white;
8384
border-radius: 4px;
8485
@media only screen and (max-width: 767px) {
8586
display: inline-block;
@@ -106,7 +107,6 @@
106107
a {
107108
margin-bottom: 21px;
108109
@include button-m-wide;
109-
@include button-ghost;
110110
text-decoration: none;
111111
}
112112
}

assets/css/partials/_mixins.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@
8282
font-weight: 400;
8383
}
8484

85+
@mixin sofia-pro-italic {
86+
@include sofia-pro-regular;
87+
font-style: italic;
88+
}
89+
8590
@mixin sofia-pro-medium {
8691
font-family: 'Sofia Pro', Arial;
8792
font-weight: 500;

assets/css/topcoder.scss

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -98,46 +98,6 @@ a {
9898
color: #ed5d5d;
9999
}
100100

101-
.focused-placeholder[placeholder]:focus::-webkit-input-placeholder {
102-
padding-right: 10px;
103-
padding-top: 7px;
104-
line-height: normal;
105-
text-align: right;
106-
text-transform: uppercase;
107-
font-size: 12px;
108-
color: #808285;
109-
}
110-
111-
.focused-placeholder[placeholder]:focus:-moz-placeholder {
112-
padding-right: 10px;
113-
padding-top: 7px;
114-
line-height: normal;
115-
text-align: right;
116-
text-transform: uppercase;
117-
font-size: 12px;
118-
color: #808285;
119-
}
120-
121-
.focused-placeholder[placeholder]:focus::-moz-placeholder {
122-
padding-right: 10px;
123-
padding-top: 7px;
124-
line-height: normal;
125-
text-align: right;
126-
text-transform: uppercase;
127-
font-size: 12px;
128-
color: #808285;
129-
}
130-
131-
.focused-placeholder[placeholder]:focus:-ms-input-placeholder {
132-
padding-right: 10px;
133-
padding-top: 7px;
134-
line-height: normal;
135-
text-align: right;
136-
text-transform: uppercase;
137-
font-size: 12px;
138-
color: #808285;
139-
}
140-
141101
.validation-bar {
142102
position: relative;
143103

@@ -167,8 +127,7 @@ a {
167127
background-color: #FFCCE1;
168128
border: 1px solid #FF99C2;
169129
color: #FF0066;
170-
// TODO change to italic
171-
@include sofia-pro-regular;
130+
@include sofia-pro-italic;
172131
}
173132

174133
// Sidebar form field tips (e.g. username, email, password)

0 commit comments

Comments
 (0)