Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved minor issues in Add Company. #43

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
3 changes: 2 additions & 1 deletion src/app/config/app-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export class AppSettings {
public static HEADER_CONTENT_TYPE = 'application/json';
public static EMAIL_PATTERN = '[a-z|A-Z|0-9]+[@]+[a-z|A-Z|0-9]+[.]+([a-z|A-Z|0-9]){2}';
public static USERNAME_REGEX = '/^[a-zA-Z0-9_]{1,15}$/';
public static URL_PATTERN = '^((ht|f)tp(s?))\://([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(/\S*)?$';
public static COMPANY_NAME_REGEX = '^[a-zA-Z0-9- ]*$';
public static URL_PATTERN = '^((ht|f)tp(s?))\://([0-9a-zA-Z\-]+\.)+[0-9a-zA-Z]{2,6}(\:[0-9]+)?(/\S*)?$';
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<div [hidden]="!form.controls.companyName.errors.required" class="error">
Company name is required
</div>
<div [hidden]="!form.controls.companyName.errors.minlength" class="error">
Company name should be atleast 2 characters.
</div>
<div [hidden]="!form.controls.companyName.errors.maxlength" class="error">
Company name should not be exceed 60 characters
</div>
Expand Down Expand Up @@ -70,4 +73,4 @@

</div>
</div>
</ng-template>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { UrlValidator } from 'src/app/shared/validators/website-validator';
import { ClaContributorService } from 'src/app/core/services/cla-contributor.service';
import { StorageService } from 'src/app/shared/services/storage.service';
import { AppSettings } from 'src/app/config/app-settings';

@Component({
selector: 'app-add-company-modal',
Expand Down Expand Up @@ -36,7 +37,7 @@ export class AddCompanyModalComponent implements OnInit {
this.checkboxText1 = 'Create a complete CommunityBridge profile for your company.';
this.checkboxText2 = ' Leave unchecked if you do not want to create a full profile now.';
this.form = this.formBuilder.group({
companyName: ['', Validators.compose([Validators.required, Validators.pattern('^[a-zA-Z0-9- ]*$'), Validators.maxLength(60)])],
companyName: ['', Validators.compose([Validators.required, Validators.pattern(AppSettings.COMPANY_NAME_REGEX), Validators.minLength(2), Validators.maxLength(60)])],
companyWebsite: ['', Validators.compose([Validators.required, UrlValidator.isValid, Validators.maxLength(255)])],
});
}
Expand Down