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

Commit 752d034

Browse files
author
Nick Litwin
committed
Add container directive for fonts
1 parent 84e89f8 commit 752d034

File tree

4 files changed

+44
-26
lines changed

4 files changed

+44
-26
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
(function() {
2+
'use strict';
3+
4+
angular.module('tcUIComponents').directive('fontSubmission', fontSubmission);
5+
6+
function fontSubmission() {
7+
return {
8+
restrict: 'E',
9+
templateUrl: 'directives/font-submission/font-submission.html',
10+
scope: true,
11+
controller: ['$scope', function($scope) {
12+
console.log('scope on font submission directive: ', $scope.submissionForm);
13+
}],
14+
controllerAs: 'fontSubmission'
15+
}
16+
}
17+
})();
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
label.tc-label Font Source
2+
3+
dropdown(
4+
name="'font-source{{$index + 1}}'",
5+
options="vm.fontList{{$index + 1}}",
6+
placeholder="'Select from the list'",
7+
searchable="false",
8+
clearable="false",
9+
on-change="vm.selectFont",
10+
value="vm.submissionForm.fonts[{{$index}}].source"
11+
)
12+
13+
tc-input.fieldset__input(
14+
label-text="Font Name",
15+
placeholder="Select font source to edit field"
16+
input-value="font.name",
17+
input-name="fontName{{$index}}"
18+
)
19+
20+
tc-input.fieldset__input(
21+
label-text="Font URL",
22+
placeholder="Select font source to edit field",
23+
input-value="font.sourceUrl",
24+
input-name="fontUrl{{$index}}"
25+
)

app/index.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ html
212212
script(src="directives/external-account/external-links-data.directive.js")
213213
script(src="directives/external-account/external-web-links.directive.js")
214214
script(src="directives/focus-on.directive.js")
215+
script(src="directives/font-submission/font-submission.directive.js")
215216
script(src="directives/header/header-menu-item.directive.js")
216217
script(src="directives/history-graph/history-graph.directive.js")
217218
script(src="directives/input-sticky-placeholder/input-sticky-placeholder.directive.js")

app/submissions/submit-file/submit-file.jade

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -111,32 +111,7 @@
111111

112112
.form-block__fields
113113
.fieldsets
114-
ng-form.fieldset(name="font{{$index + 1}}", ng-repeat="font in vm.submissionForm.fonts track by font.id")
115-
label.tc-label Font Source
116-
117-
dropdown(
118-
name="'font-source{{$index + 1}}'",
119-
options="vm.fontList{{$index + 1}}",
120-
placeholder="'Select from the list'",
121-
searchable="false",
122-
clearable="false",
123-
on-change="vm.selectFont",
124-
value="vm.submissionForm.fonts[{{$index}}].source"
125-
)
126-
127-
tc-input.fieldset__input(
128-
label-text="Font Name",
129-
placeholder="Select font source to edit field"
130-
input-value="font.name",
131-
input-name="fontName{{$index}}"
132-
)
133-
134-
tc-input.fieldset__input(
135-
label-text="Font URL",
136-
placeholder="Select font source to edit field",
137-
input-value="font.sourceUrl",
138-
input-name="fontUrl{{$index}}"
139-
)
114+
font-submission.fieldset(ng-repeat="font in vm.submissionForm.fonts track by font.id")
140115

141116
button.fieldset__button.tc-btn.tc-btn-s(type="button", ng-click="vm.createAnotherFontFieldset()") + Add Font
142117

0 commit comments

Comments
 (0)