Project

General

Profile

« Previous | Next » 

Revision 59468

[Trunk | Admin]: Merging branch 'use-UoaAdminToolsLibrary' into trunk for revisions 58405:59467

View differences:

new-div-help-content.component.ts
10 10
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
11 11
import {Page} from "../../domain/page";
12 12
import {Title} from '@angular/platform-browser';
13
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
13 14

  
14 15
@Component({
15 16
    selector: 'new-div-help-content',
......
39 40
        private route: ActivatedRoute,
40 41
        private router: Router,
41 42
        private title: Title,
42
        private _helpContentService: HelpContentService) {}
43
        private _helpContentService: HelpContentService,
44
        private _clearCacheService: ClearCacheService) {}
43 45

  
44 46
    ngOnInit() {
45 47
      this.route.data
......
62 64
    }
63 65

  
64 66
    private getPage(pageId: string) {
65
      this._helpContentService.getPage(pageId,this.properties.adminToolsAPIURL).subscribe(
67
      this._helpContentService.getPageByPortal(pageId,this.properties.adminToolsAPIURL, this.communityPid).subscribe(
66 68
        page => {
67
          if( (this.communityPid == 'openaire' && !page.openaire)
68
            || (this.communityPid == 'connect' && !page.connect)
69
            || (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
69
          // if( (this.communityPid == 'openaire' && !page.openaire)
70
          //   || (this.communityPid == 'connect' && !page.connect)
71
          //   || (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
72
          if(this.properties.adminToolsPortalType != page.portalType) {
70 73
            this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid} });
71 74
          } else {
72 75
            this.page = page;
......
88 91

  
89 92
            let divHelpContent : DivHelpContent = this.formComponent.myForm.value;
90 93

  
91
            this._helpContentService.insertOrUpdateDivHelpContent(divHelpContent, this.properties.adminToolsAPIURL).subscribe(
94
            this._helpContentService.saveDivHelpContent(divHelpContent, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
92 95
                _ => {
93 96
                  if(this.pageId) {
94 97
                    this.router.navigate( ['/classContents/'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId  } } );
......
96 99
                    this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid } } );
97 100
                  }
98 101
                  this.showLoading = false;
102
                  this._clearCacheService.clearCache("class help content saved");
99 103
                },
100 104
                err => this.handleUpdateError('System error saving page content', err)
101 105
            );

Also available in: Unified diff