Revision 51417
Added by Konstantina Galouni about 6 years ago
new-div-help-content.component.ts | ||
---|---|---|
15 | 15 |
@ViewChild(DivContentFormComponent) |
16 | 16 |
public formComponent : DivContentFormComponent; |
17 | 17 |
|
18 |
private errorMessage : string = null; |
|
18 |
//private errorMessage : string = null;
|
|
19 | 19 |
|
20 | 20 |
private communityPid: string; |
21 | 21 |
|
22 | 22 |
private pageId: string; |
23 | 23 |
public properties:EnvProperties = null; |
24 | 24 |
|
25 |
public showLoading: boolean = false; |
|
26 |
public errorMessage: string = ''; |
|
27 |
public updateErrorMessage: string = ''; |
|
28 |
|
|
25 | 29 |
constructor( |
26 | 30 |
private route: ActivatedRoute, |
27 | 31 |
private router: Router, |
... | ... | |
31 | 35 |
this.route.data |
32 | 36 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
33 | 37 |
this.properties = data.envSpecific; |
34 |
this.route.queryParams.subscribe(params => { |
|
35 |
this.communityPid = params['communityId']; |
|
36 |
this.pageId = params['pageId']; |
|
38 |
this.route.queryParams.subscribe(params => { |
|
39 |
this.communityPid = params['communityId']; |
|
40 |
this.pageId = params['pageId']; |
|
41 |
}); |
|
37 | 42 |
}); |
38 |
}); |
|
39 | 43 |
} |
40 | 44 |
|
41 | 45 |
private saveCustom() { |
46 |
if(this.formComponent.myForm.valid) { |
|
47 |
this.showLoading = true; |
|
48 |
this.updateErrorMessage = ""; |
|
42 | 49 |
|
43 |
this.errorMessage = null; |
|
44 |
|
|
45 |
if(this.formComponent.myForm.valid) { |
|
46 | 50 |
let divHelpContent : DivHelpContent = this.formComponent.myForm.value; |
47 | 51 |
console.info(divHelpContent); |
48 | 52 |
|
... | ... | |
53 | 57 |
} else { |
54 | 58 |
this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid } } ); |
55 | 59 |
} |
60 |
this.showLoading = false; |
|
56 | 61 |
}, |
57 |
err => this.handleError('System error saving page content', err) |
|
62 |
err => this.handleUpdateError('System error saving page content', err)
|
|
58 | 63 |
); |
59 | 64 |
} else { |
60 | 65 |
this.errorMessage = "Please fill all required fields"; |
... | ... | |
69 | 74 |
} |
70 | 75 |
} |
71 | 76 |
|
72 |
handleError(message: string, error) { |
|
73 |
this.errorMessage = message + ' (Server responded: ' + error + ')'; |
|
74 |
|
|
77 |
handleUpdateError(message: string, error) { |
|
78 |
this.errorMessage = message; |
|
79 |
console.log('Server responded: ' + error); |
|
80 |
this.showLoading = false; |
|
75 | 81 |
} |
76 | 82 |
} |
Also available in: Unified diff
1. Parameter url 'communityId' added (or adjusted) in every page and link to page.
2. loading.gif added in assets folder.
3. Loading and Error Messages added in pages for: Community (not community-edit-form folder), Entity, Page, DivId, PageHelpContent, DivHelpContent and their forms.