Skip to content

Commit

Permalink
autosave fixed, now working on generic project types
Browse files Browse the repository at this point in the history
  • Loading branch information
vktrrdk committed Nov 8, 2024
1 parent 7c8f0ec commit 93a6e54
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
11 changes: 5 additions & 6 deletions src/app/api-connector/news.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ export class NewsService {
contributor: string,
institution: string,
workgroup: string,
simple_vm: boolean,
image_url: string,
project_application_id: string,
soc_consents: SocialConsent[],
soc_photo_consents: SocialConsent[],
Expand All @@ -135,7 +133,6 @@ export class NewsService {
formData.append('contributor', contributor)
formData.append('institution', institution)
formData.append('workgroup', workgroup)
formData.append('simple_vm', JSON.stringify(simple_vm))
formData.append('project_application_id', project_application_id)
formData.append('consents', consents)
formData.append('photo_consents', photo_consents)
Expand All @@ -153,13 +150,14 @@ export class NewsService {
contributor: string,
institution: string,
workgroup: string,
simple_vm: boolean,
project_application_id: string,
soc_consents: SocialConsent[],
photo_consents: SocialConsent[]
pho_consents: SocialConsent[]
): Observable<any> {
const consents_list = soc_consents.map(soc => soc.id)
const consents = JSON.stringify(consents_list)
const photo_consents_list = pho_consents.map(soc => soc.id)
const photo_consents = JSON.stringify(photo_consents_list)

const testimonialData: any = {
title,
Expand All @@ -168,12 +166,13 @@ export class NewsService {
contributor,
institution,
workgroup,
simple_vm,
project_application_id,
consents,
photo_consents
}

console.log(testimonialData)

return this.http.post<any>(
`${ApiSettings.getApiBaseURL()}wagtail-management/testimonial/autosave/`,
testimonialData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ <h5 class="card-title">Add testimonial draft</h5>
type="checkbox"
[value]="socialPhotoConsent.id"
[checked]="selectedSocialPhotoConsents | socialConsentGiven: socialPhotoConsent"
[id]="'checkbox_' + socialPhotoConsent.id"
(change)="updateSelectedPhotoOptions(socialConsent)"
[id]="'photo_checkbox_' + socialPhotoConsent.id"
(change)="updateSelectedPhotoOptions(socialPhotoConsent)"
/>
<label class="form-check-label" for="checkbox_{{ socialPhotoConsent.id }}"
>{{ socialPhotoConsent.name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class TestimonialFormComponent implements OnInit, OnDestroy {
selectedSocialPhotoConsents: SocialConsent[] = []
submissionSuccessful: boolean = false
autosaveTimer: ReturnType<typeof setTimeout>
autosaveTimeout: number = 60000
autosaveTimeout: number = 10000
userInteractedWithForm: boolean = false
autoSaveInProgress: boolean = false
showAutosaveSucess: boolean = false
Expand Down Expand Up @@ -202,7 +202,7 @@ export class TestimonialFormComponent implements OnInit, OnDestroy {
this.workgroup = result['workgroup']
this.contributor = result['contributor']
this.selectedSocialConsents = result['publication_channels']
this.selectedSocialPhotoConsents = result['photography_publication_channels']
this.selectedSocialPhotoConsents = result['photo_publication_channels']
}

stopAutosaveTimer(): void {
Expand Down Expand Up @@ -240,7 +240,6 @@ export class TestimonialFormComponent implements OnInit, OnDestroy {
this.contributor,
this.institution,
this.workgroup,
this.simple_vm,
this.project_application.project_application_id.toString(),
this.selectedSocialConsents,
this.selectedSocialPhotoConsents
Expand Down Expand Up @@ -290,8 +289,6 @@ export class TestimonialFormComponent implements OnInit, OnDestroy {
this.contributor,
this.institution,
this.workgroup,
this.simple_vm,
this.image_url,
this.project_application.project_application_id.toString(),
this.selectedSocialConsents,
this.selectedSocialPhotoConsents,
Expand Down

0 comments on commit 93a6e54

Please sign in to comment.