diff --git a/app/directives/tc-input/tc-input.directive.js b/app/directives/tc-input/tc-input.directive.js index 7bc1402ac..32a79d847 100644 --- a/app/directives/tc-input/tc-input.directive.js +++ b/app/directives/tc-input/tc-input.directive.js @@ -10,7 +10,15 @@ scope: { labelText: '@', placeholder: '@', - inputValue: '=' + inputValue: '=', + inputName: '@', + inputType: '@', + inputPattern: '=' + }, + link: function(scope, element, attrs) { + if (!scope.inputType) { + scope.inputType = 'text'; + } } } } diff --git a/app/directives/tc-input/tc-input.jade b/app/directives/tc-input/tc-input.jade index f78f19134..cd33a2efb 100644 --- a/app/directives/tc-input/tc-input.jade +++ b/app/directives/tc-input/tc-input.jade @@ -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") diff --git a/app/submissions/submit-file/submit-file.controller.js b/app/submissions/submit-file/submit-file.controller.js index bd446c3a1..ef03535ba 100644 --- a/app/submissions/submit-file/submit-file.controller.js +++ b/app/submissions/submit-file/submit-file.controller.js @@ -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 }, @@ -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: [{ diff --git a/app/submissions/submit-file/submit-file.jade b/app/submissions/submit-file/submit-file.jade index 22a563349..183f252ee 100644 --- a/app/submissions/submit-file/submit-file.jade +++ b/app/submissions/submit-file/submit-file.jade @@ -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}}", @@ -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