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

Commit 63863fa

Browse files
author
Nick Litwin
committed
Add new directive files for sticky placeholder
1 parent 30f0571 commit 63863fa

File tree

6 files changed

+40
-4
lines changed

6 files changed

+40
-4
lines changed

app/account/register/register.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
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(input-sticky-placeholder, sticky-placeholder="First" ng-model="vm.firstname", maxlength="64", name="firstname", placeholder="First Name", type="text", required)
1717

1818
input(right-placeholder, focused-placeholder="Last", ng-model="vm.lastname", maxlength="64", name="lastname", placeholder="Last Name", type="text", required)
1919

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: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
(function() {
2+
'use strict';
3+
4+
angular.module('tcUIComponents').directive('inputStickyPlaceholder', inputStickyPlaceholder);
5+
6+
/*
7+
* ****** Make sure to style the input tag so that the text entered does
8+
* not overlap with the sticky-placeholder ******
9+
*
10+
* Example:
11+
* input(input-sticky-placeholder, sticky-placeholder="First",
12+
* placeholder="First Name")
13+
*
14+
*/
15+
16+
function inputStickyPlaceholder() {
17+
return {
18+
restrict: 'A',
19+
transclude: true,
20+
replace: true,
21+
templateUrl: 'directives/input-sticky-placeholder/input-sticky-placeholder.html',
22+
link: function(scope, element, attrs) {
23+
scope.stickyPlaceholder = attrs.stickyPlaceholder;
24+
}
25+
};
26+
}
27+
})();
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.input-container
2+
div(ng-transclude)
3+
4+
span(ng-bind="stickyPlaceholder")

app/index.jade

Lines changed: 2 additions & 0 deletions
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,6 +154,7 @@ 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")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@import '../partials/combined';
2+
3+
input-sticky-placeholder {
4+
5+
}

0 commit comments

Comments
 (0)