Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5512b35

Browse files
committedJan 5, 2016
Merge pull request #636 from appirio-tech/SUP-2918-stockart-validation
Sup 2918 stockart validation
2 parents 6075bca + 05de045 commit 5512b35

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed
 

‎app/directives/tc-input/tc-input.directive.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@
1010
scope: {
1111
labelText: '@',
1212
placeholder: '@',
13-
inputValue: '='
13+
inputValue: '=',
14+
inputName: '@',
15+
inputType: '@',
16+
inputPattern: '='
17+
},
18+
link: function(scope, element, attrs) {
19+
if (!scope.inputType) {
20+
scope.inputType = 'text';
21+
}
1422
}
1523
}
1624
}

‎app/directives/tc-input/tc-input.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
label.tc-label {{labelText}}
22

3-
input(type="text", placeholder="{{placeholder}}", ng-model="inputValue")
3+
input(name="{{inputName}}", type="{{inputType}}", placeholder="{{placeholder}}", ng-model="inputValue", ng-pattern="inputPattern")

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// the onChange callback does not indicate which dropdown called the callback.
1313
// There are pull requets pending for react-select which will clean this code up
1414
vm.fontList1 = [
15-
{ label: 'Studio Standard Fonts List', value: 'STUDIO_STANDARDS_FONTS_LIST', id: 1 },
15+
{ label: 'Studio Standard Fonts List', value: 'STUDIO_STANDARD_FONTS_LIST', id: 1 },
1616
{ label: 'Fonts.com', value: 'FONTS_DOT_COM', id: 1 },
1717
{ label: 'MyFonts', value: 'MYFONTS', id: 1 },
1818
{ label: 'Adobe Fonts', value: 'ADOBE_FONTS', id: 1 },
@@ -23,15 +23,10 @@
2323
];
2424

2525
var files = {};
26+
vm.urlRegEx = new RegExp(/^(http(s?):\/\/)?(www\.)?[a-zA-Z0-9\.\-\_]+(\.[a-zA-Z]{2,3})+(\/[a-zA-Z0-9\_\-\s\.\/\?\%\#\&\=]*)?$/);
2627
vm.comments = '';
2728
vm.submissionForm = {
2829
files: [],
29-
submissionZip: null,
30-
sourceZip: null,
31-
designCover: null,
32-
33-
34-
// Should the rank input field be set to 1 automatically?
3530
submitterRank: 1,
3631
submitterComments: '',
3732
fonts: [{

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090

9191
.form-block__fields
9292
.fieldsets
93-
ng-form.fieldset(name="font_{{$index + 1}}", ng-repeat="font in vm.submissionForm.fonts track by font.id")
93+
ng-form.fieldset(name="font{{$index + 1}}", ng-repeat="font in vm.submissionForm.fonts track by font.id")
9494
dropdown(
9595
name="'font-source{{$index + 1}}'",
9696
options="vm.fontList{{$index + 1}}",
@@ -124,23 +124,30 @@
124124

125125
.form-block__fields
126126
.fieldsets
127-
ng-form.fieldset(name="stockArt_{{$index + 1}}", ng-repeat="stockArt in vm.submissionForm.stockArts track by stockArt.id")
127+
.fieldset(ng-repeat="stockArt in vm.submissionForm.stockArts track by stockArt.id")
128128
tc-input.fieldset__input(
129129
label-text="Photo Description",
130130
placeholder="A picture of a girl",
131-
input-value="stockArt.description"
131+
input-value="stockArt.description",
132+
input-name="photoDescription{{$index}}"
132133
)
133134

134135
tc-input.fieldset__input(
135136
label-text="Photo URL",
136137
placeholder="www.istockphoto.com",
137-
input-value="stockArt.sourceUrl"
138+
input-value="stockArt.sourceUrl",
139+
input-name="photoURL{{$index}}",
140+
input-pattern="vm.urlRegEx"
138141
)
139142

143+
.tc-error-messages(ng-show="submissionForm['photoURL' + $index].$dirty && submissionForm['photoURL' + $index].$invalid")
144+
p(ng-show="submissionForm['photoURL' + $index].$error.pattern") Not a valid url.
145+
140146
tc-input.fieldset__input(
141147
label-text="File Number",
142148
placeholder="u2434312",
143-
input-value="stockArt.fileNumber"
149+
input-value="stockArt.fileNumber",
150+
input-name="fileNumber{{$index}}"
144151
)
145152

146153
button.fieldset__button.tc-btn.tc-btn-s(type="button", ng-click="vm.createAnotherStockArtFieldset()") + Add Stock Photo

0 commit comments

Comments
 (0)
This repository has been archived.