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

Sup 2918 stockart validation #636

Merged
merged 3 commits into from
Jan 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app/directives/tc-input/tc-input.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
scope: {
labelText: '@',
placeholder: '@',
inputValue: '='
inputValue: '=',
inputName: '@',
inputType: '@',
inputPattern: '='
},
link: function(scope, element, attrs) {
if (!scope.inputType) {
scope.inputType = 'text';
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/directives/tc-input/tc-input.jade
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
label.tc-label {{labelText}}

input(type="text", placeholder="{{placeholder}}", ng-model="inputValue")
input(name="{{inputName}}", type="{{inputType}}", placeholder="{{placeholder}}", ng-model="inputValue", ng-pattern="inputPattern")
9 changes: 2 additions & 7 deletions app/submissions/submit-file/submit-file.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// the onChange callback does not indicate which dropdown called the callback.
// There are pull requets pending for react-select which will clean this code up
vm.fontList1 = [
{ label: 'Studio Standard Fonts List', value: 'STUDIO_STANDARDS_FONTS_LIST', id: 1 },
{ label: 'Studio Standard Fonts List', value: 'STUDIO_STANDARD_FONTS_LIST', id: 1 },
{ label: 'Fonts.com', value: 'FONTS_DOT_COM', id: 1 },
{ label: 'MyFonts', value: 'MYFONTS', id: 1 },
{ label: 'Adobe Fonts', value: 'ADOBE_FONTS', id: 1 },
Expand All @@ -23,15 +23,10 @@
];

var files = {};
vm.urlRegEx = new RegExp(/^(http(s?):\/\/)?(www\.)?[a-zA-Z0-9\.\-\_]+(\.[a-zA-Z]{2,3})+(\/[a-zA-Z0-9\_\-\s\.\/\?\%\#\&\=]*)?$/);
vm.comments = '';
vm.submissionForm = {
files: [],
submissionZip: null,
sourceZip: null,
designCover: null,


// Should the rank input field be set to 1 automatically?
submitterRank: 1,
submitterComments: '',
fonts: [{
Expand Down
17 changes: 12 additions & 5 deletions app/submissions/submit-file/submit-file.jade
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

.form-block__fields
.fieldsets
ng-form.fieldset(name="font_{{$index + 1}}", ng-repeat="font in vm.submissionForm.fonts track by font.id")
ng-form.fieldset(name="font{{$index + 1}}", ng-repeat="font in vm.submissionForm.fonts track by font.id")
dropdown(
name="'font-source{{$index + 1}}'",
options="vm.fontList{{$index + 1}}",
Expand Down Expand Up @@ -124,23 +124,30 @@

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

tc-input.fieldset__input(
label-text="Photo URL",
placeholder="www.istockphoto.com",
input-value="stockArt.sourceUrl"
input-value="stockArt.sourceUrl",
input-name="photoURL{{$index}}",
input-pattern="vm.urlRegEx"
)

.tc-error-messages(ng-show="submissionForm['photoURL' + $index].$dirty && submissionForm['photoURL' + $index].$invalid")
p(ng-show="submissionForm['photoURL' + $index].$error.pattern") Not a valid url.

tc-input.fieldset__input(
label-text="File Number",
placeholder="u2434312",
input-value="stockArt.fileNumber"
input-value="stockArt.fileNumber",
input-name="fileNumber{{$index}}"
)

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