Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
204c864
Refactored template with @if and @for
Aaron-Detre May 9, 2025
9dcd0eb
Changes to library project details
Aaron-Detre May 11, 2025
2d443c4
Changes to contact form
Aaron-Detre May 11, 2025
9dddade
Changes to project info authoring
Aaron-Detre May 12, 2025
9443354
Remove required validator for summry if sharing unit
Aaron-Detre May 13, 2025
35c837f
Fixed tests and check for author instead of owner in library project …
Aaron-Detre May 13, 2025
c95f23f
Changed button/text colors
Aaron-Detre May 13, 2025
0347d18
Changed button/text colors
Aaron-Detre May 13, 2025
11426a9
Merge branch 'issue-2175-share-units' of https://github.com/WISE-Comm…
Aaron-Detre May 13, 2025
daff2f1
Updated messages
github-actions[bot] May 13, 2025
84d71df
Merge branch 'develop' into issue-2175-share-units
Aaron-Detre May 13, 2025
e693646
Shared units have project name as summary in email subject line
Aaron-Detre May 20, 2025
bcb14f5
Merge branch 'develop' into issue-2175-share-units
Aaron-Detre May 20, 2025
8a78307
Change share to publish
Aaron-Detre May 20, 2025
90cb779
Code improvement
Aaron-Detre May 20, 2025
a94bc6e
Updated messages
github-actions[bot] May 20, 2025
40aa28b
Remove fdescribe
Aaron-Detre May 20, 2025
57f905e
Fixed unit info publish link
Aaron-Detre May 21, 2025
dae77c0
Updated community library info text
Aaron-Detre May 21, 2025
d27c7e6
Fixed undefined projectId when publishing from unit info
Aaron-Detre May 21, 2025
efe1ec5
Merge branch 'issue-2175-share-units' of https://github.com/WISE-Comm…
Aaron-Detre May 21, 2025
c961d21
Updated messages
github-actions[bot] May 21, 2025
28ae398
Refactor contact form
Aaron-Detre May 21, 2025
0d30b7a
Merge branch 'issue-2175-share-units' of https://github.com/WISE-Comm…
Aaron-Detre May 21, 2025
567c06f
Updated messages
github-actions[bot] May 21, 2025
40502e0
Update some text and minor styling
breity May 22, 2025
7ebf655
Updated messages
github-actions[bot] May 22, 2025
87d9941
Code improvement
Aaron-Detre May 23, 2025
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
278 changes: 151 additions & 127 deletions src/app/contact/contact-form/contact-form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,136 +6,160 @@
</div>
<mat-card appearance="outlined" class="standalone__content mat-elevation-z4">
<mat-card-content>
<div *ngIf="complete" class="center">
<p class="mat-subtitle-2" i18n>Thank you for contacting WISE!</p>
<p i18n>Your message has been sent. We will get back to you as soon as possible.</p>
<br />
<div>
<a mat-flat-button color="accent" routerLink="/" i18n>Return to WISE Home</a>
@if (complete) {
<div class="center">
<p class="mat-subtitle-2" i18n>Thank you for contacting WISE!</p>
<p i18n>Your message has been sent. We will get back to you as soon as possible.</p>
<br />
<div>
<a mat-flat-button color="accent" routerLink="/" i18n>Return to WISE Home</a>
</div>
</div>
</div>
<form
*ngIf="!complete"
role="form"
(submit)="submit()"
[formGroup]="contactFormGroup"
class="flex flex-col"
>
<h2 class="accent center" i18n>Contact WISE</h2>
<p>
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Name</mat-label>
<input matInput id="name" name="name" formControlName="name" />
<mat-error *ngIf="contactFormGroup.controls['name'].hasError('required')" i18n
>Name required</mat-error
>
</mat-form-field>
</p>
<p *ngIf="!isStudent">
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Email</mat-label>
<input matInput id="email" name="email" formControlName="email" />
<mat-error *ngIf="contactFormGroup.controls['email'].hasError('required')" i18n
>Email required</mat-error
>
<mat-error *ngIf="contactFormGroup.controls['email'].hasError('email')" i18n
>Invalid Email</mat-error
>
</mat-form-field>
</p>
<p *ngIf="isStudent && teachers.length > 0">
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Teacher</mat-label>
<mat-select formControlName="teacher">
<mat-option *ngFor="let teacher of teachers" [value]="teacher.username">
{{ teacher.displayName }}
</mat-option>
</mat-select>
<mat-error *ngIf="contactFormGroup.controls['teacher'].hasError('required')" i18n
>Teacher required</mat-error
>
</mat-form-field>
</p>
<p>
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Issue Type</mat-label>
<mat-select formControlName="issueType">
<mat-option *ngFor="let issueType of issueTypes" [value]="issueType.key">
{{ issueType.value }}
</mat-option>
</mat-select>
<mat-error *ngIf="contactFormGroup.controls['issueType'].hasError('required')" i18n
>Issue Type required</mat-error
>
</mat-form-field>
</p>
<p *ngIf="projectName">
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Project Name</mat-label>
<input matInput name="projectName" [value]="projectName" disabled />
</mat-form-field>
</p>
<p>
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Summary</mat-label>
<input matInput id="summary" name="summary" formControlName="summary" />
<mat-error *ngIf="contactFormGroup.controls['summary'].hasError('required')" i18n
>Summary required</mat-error
>
</mat-form-field>
</p>
<p>
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Description</mat-label>
<textarea
matInput
id="description"
name="description"
formControlName="description"
rows="10"
cols="10"
>
</textarea>
<mat-error *ngIf="contactFormGroup.controls['description'].hasError('required')" i18n
>Description required</mat-error
>
</mat-form-field>
</p>
<p *ngIf="isRecaptchaEnabled" i18n>
This site is protected by reCAPTCHA and the Google
<a href="https://policies.google.com/privacy">Privacy Policy</a> and
<a href="https://policies.google.com/terms">Terms of Service</a> apply.
</p>
<ng-container *ngIf="!isError; else error">
<div>&nbsp;</div>
</ng-container>
<ng-template #error>
<p
*ngIf="isRecaptchaEnabled && isRecaptchaError; else genericError"
class="center warn"
i18n
>
Recaptcha failed. Please reload the page and try again!
} @else {
<form role="form" (submit)="submit()" [formGroup]="contactFormGroup" class="flex flex-col">
<h2 class="accent center" i18n>Contact WISE</h2>
<p>
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Name</mat-label>
<input matInput id="name" name="name" formControlName="name" />
@if (contactFormGroup.controls['name'].hasError('required')) {
<mat-error i18n>Name required</mat-error>
}
</mat-form-field>
</p>
@if (!isStudent) {
<p>
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Email</mat-label>
<input matInput id="email" name="email" formControlName="email" />
@if (contactFormGroup.controls['email'].hasError('required')) {
<mat-error i18n>Email required</mat-error>
}
@if (contactFormGroup.controls['email'].hasError('email')) {
<mat-error i18n>Invalid Email</mat-error>
}
</mat-form-field>
</p>
} @else {
@if (teachers.length > 0) {
<p>
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Teacher</mat-label>
<mat-select formControlName="teacher">
@for (teacher of teachers; track teacher.username) {
<mat-option [value]="teacher.username">
{{ teacher.displayName }}
</mat-option>
}
</mat-select>
@if (contactFormGroup.controls['teacher'].hasError('required')) {
<mat-error i18n>Teacher required</mat-error>
}
</mat-form-field>
</p>
}
}
<p>
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Issue Type</mat-label>
<mat-select formControlName="issueType">
@for (issueType of issueTypes; track issueType.key) {
<mat-option [value]="issueType.key">
{{ issueType.value }}
</mat-option>
}
</mat-select>
@if (contactFormGroup.controls['issueType'].hasError('required')) {
<mat-error i18n>Issue Type required</mat-error>
}
</mat-form-field>
</p>
</ng-template>
<ng-template #genericError>
<p class="center warn" i18n>
Sorry, there was a problem submitting the form. Please try again.
@if (projectName) {
<p>
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Project Name</mat-label>
<input matInput name="projectName" [value]="projectName" disabled />
</mat-form-field>
</p>
}
<p>
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Summary</mat-label>
<input matInput id="summary" name="summary" formControlName="summary" value="test" />
@if (contactFormGroup.controls['summary'].hasError('required')) {
<mat-error i18n>Summary required</mat-error>
}
</mat-form-field>
</p>
<p>
<mat-form-field appearance="fill" class="w-full">
<mat-label i18n>Description</mat-label>
<textarea
matInput
id="description"
name="description"
formControlName="description"
rows="10"
cols="10"
[placeholder]="
isPublishIssueType()
? 'Why do you want to share this unit with the WISE community?'
: ''
"
>
</textarea>
@if (contactFormGroup.controls['description'].hasError('required')) {
<mat-error i18n>Description required</mat-error>
}
</mat-form-field>
</p>
@if (isRecaptchaEnabled) {
<p i18n>
This site is protected by reCAPTCHA and the Google
<a href="https://policies.google.com/privacy">Privacy Policy</a> and
<a href="https://policies.google.com/terms">Terms of Service</a> apply.
</p>
}
@if (isError) {
@if (isRecaptchaEnabled && isRecaptchaError) {
<p class="center warn" i18n>
Recaptcha failed. Please reload the page and try again!
</p>
} @else {
<p class="center warn" i18n>
Sorry, there was a problem submitting the form. Please try again.
</p>
}
}
@if (isPublishIssueType()) {
<p class="center mat-caption" i18n>
By submitting, you will be sending your unit to be reviewed. If approved, it will be
added to the Community Built library. Make sure you have filled out all appropriate
fields in the Unit Info page in the authoring tool. We will be in touch if we require
any more information.
</p>
<p class="center mat-caption" i18n>Thank you!</p>
}
<p>
<button
mat-flat-button
color="primary"
type="submit"
[disabled]="!contactFormGroup.valid || isSendingRequest"
class="button--progress w-full"
>
@if (isSendingRequest) {
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
}
@if (isPublishIssueType()) {
<ng-container i18n>Submit for Review</ng-container>
} @else {
<ng-container i18n>Submit</ng-container>
}
</button>
</p>
</ng-template>
<p>
<button
mat-flat-button
color="primary"
type="submit"
[disabled]="!contactFormGroup.valid || isSendingRequest"
class="button--progress w-full"
>
<mat-progress-bar *ngIf="isSendingRequest" mode="indeterminate"></mat-progress-bar>
<ng-container i18n>Submit</ng-container>
</button>
</p>
</form>
</form>
}
</mat-card-content>
</mat-card>
</div>
Loading
Loading