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

Commit d38911e

Browse files
author
Nick Litwin
committed
Multiple dropdowns yay
1 parent ecffea2 commit d38911e

File tree

3 files changed

+76
-11
lines changed

3 files changed

+76
-11
lines changed

app/services/submissions.service.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@
4747
var status = xhr.status;
4848
if (((status >= 200 && status < 300) || status === 304) && xhr.readyState === 4) {
4949
$log.info('Successfully uploaded file');
50-
console.log('xhr response: ', xhr.responseXML);
51-
var xhrResponse = xhr.responseXML;
52-
deferred.resolve(xhrResponse);
50+
console.log('xhr response: ', xhr.responseText);
51+
52+
// updateSubmissionStatus and then resolve?
53+
deferred.resolve();
5354

5455
} else if (status >= 400) {
5556
$log.error('Error uploading to S3 with status: ' + status);
@@ -72,6 +73,7 @@
7273
return $q.all(promises)
7374
.then(function(response) {
7475
console.log('response from S3: ', response);
76+
7577
})
7678
.catch(function(err) {
7779
console.log('error uploading to S3: ', err);

app/submissions/submit-file/submit-file.controller.js

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77

88
function SubmitFileController($stateParams, UserService, SubmissionsService) {
99
var vm = this;
10+
11+
vm.fontList1 = [
12+
{ label: 'Studio Standard Fonts List', value: 'STUDIO_STANDARDS_FONTS_LIST', id: 1 },
13+
{ label: 'Fonts.com', value: 'FONTS_DOT_COM', id: 1 },
14+
{ label: 'MyFonts', value: 'MYFONTS', id: 1 },
15+
{ label: 'Adobe Fonts', value: 'ADOBE_FONTS', id: 1 },
16+
{ label: 'Font Shop', value: 'FONT_SHOP', id: 1 },
17+
{ label: 'T.26 Digital Type Foundry', value: 'T26_DIGITAL_TYPE_FOUNDRY', id: 1 },
18+
{ label: 'Font Squirrel', value: 'FONT_SQUIRREL', id: 1 },
19+
{ label: 'Typography.com', value: 'TYPOGRAPHY_DOT_COM', id: 1 }
20+
];
21+
1022
var files = {};
1123
vm.comments = '';
1224
vm.submissionForm = {
@@ -17,9 +29,9 @@
1729
submitterComments: '',
1830
fonts: [{
1931
id: 1,
32+
source: '',
2033
name: '',
21-
sourceUrl: '',
22-
source: ''
34+
sourceUrl: ''
2335
}],
2436
stockArts: [{
2537
id: 1,
@@ -58,6 +70,8 @@
5870

5971
vm.setFileReference = setFileReference;
6072
vm.uploadSubmission = uploadSubmission;
73+
vm.selectFont = selectFont;
74+
vm.createAnotherFontFieldset = createAnotherFontFieldset;
6175
vm.createAnotherStockArtFieldset = createAnotherStockArtFieldset;
6276

6377
activate();
@@ -101,6 +115,28 @@
101115
}
102116
}
103117

118+
function selectFont(newFont) {
119+
console.log('new value: ', newFont);
120+
var id = newFont.id - 1;
121+
vm.submissionForm.fonts[id].source = newFont.value;
122+
}
123+
124+
function createAnotherFontFieldset() {
125+
var id = vm.submissionForm.fonts.length;
126+
var newFontList = vm['fontList' + (id + 1)] = angular.copy(vm['fontList' + id]);
127+
128+
newFontList.forEach(function(font) {
129+
font.id++;
130+
});
131+
132+
vm.submissionForm.fonts.push({
133+
id: vm.submissionForm.fonts.length + 1,
134+
source: '',
135+
name: '',
136+
sourceUrl: ''
137+
});
138+
}
139+
104140
function createAnotherStockArtFieldset() {
105141
vm.submissionForm.stockArts.push({
106142
id: vm.submissionForm.stockArts.length + 1,
@@ -115,8 +151,17 @@
115151
vm.submissionsBody.data.submitterRank = vm.submissionForm.submitterRank;
116152

117153
var stockArts = angular.copy(vm.submissionForm.stockArts);
118-
vm.submissionsBody.data.stockArts = stockArts.forEach(function(stockArt) {
154+
vm.submissionsBody.data.stockArts = stockArts.map(function(stockArt) {
119155
delete stockArt.id;
156+
return stockArt;
157+
});
158+
159+
var fonts = angular.copy(vm.submissionForm.fonts);
160+
vm.submissionsBody.data.fonts = fonts.map(function(font) {
161+
if (font.source) {
162+
delete font.id;
163+
return font;
164+
}
120165
});
121166

122167
SubmissionsService.getPresignedURL(vm.submissionsBody, files);

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,30 @@
8787

8888
.form-block__fields
8989
.fieldsets
90-
.fieldset
91-
tc-input.fieldset__input(label-text="Font Name", placeholder="Select font source to edit field")
90+
ng-form.fieldset(name="font_{{$index + 1}}", ng-repeat="font in vm.submissionForm.fonts track by font.id")
91+
dropdown(
92+
name="'font-source{{$index + 1}}'",
93+
options="vm.fontList{{$index + 1}}",
94+
placeholder="'Select from the list'",
95+
searchable="false",
96+
clearable="false",
97+
on-change="vm.selectFont",
98+
value="vm.submissionForm.fonts[{{$index}}].source"
99+
)
100+
101+
tc-input.fieldset__input(
102+
label-text="Font Name",
103+
placeholder="Select font source to edit field"
104+
input-value="font.name"
105+
)
92106

93-
tc-input.fieldset__input(label-text="Font URL", placeholder="Select font source to edit field")
107+
tc-input.fieldset__input(
108+
label-text="Font URL",
109+
placeholder="Select font source to edit field",
110+
input-value="font.sourceUrl"
111+
)
94112

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

97115
.form-block.flex.wrap
98116
.form-block__instructions
@@ -103,7 +121,7 @@
103121

104122
.form-block__fields
105123
.fieldsets
106-
ng-form.fieldset(name="stockArt_{{$index}}", ng-repeat="stockArt in vm.submissionForm.stockArts track by stockArt.id")
124+
ng-form.fieldset(name="stockArt_{{$index + 1}}", ng-repeat="stockArt in vm.submissionForm.stockArts track by stockArt.id")
107125
tc-input.fieldset__input(
108126
label-text="Photo Description",
109127
placeholder="A picture of a girl",

0 commit comments

Comments
 (0)