Skip to content

Commit

Permalink
Merge pull request #765 from atnos/fix-preview-data-displaying
Browse files Browse the repository at this point in the history
Fix preview data displaying
  • Loading branch information
kevin-atnos authored Sep 6, 2024
2 parents e39840d + 1d996c0 commit 46e682e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/app/modules/pia/content/measures/measures.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ export class MeasuresComponent implements OnInit, OnDestroy {
tinymce.init({
branding: false,
menubar: false,
entity_encoding: 'raw',
statusbar: false,
plugins: 'autoresize lists',
forced_root_block: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ export class QuestionsComponent implements OnInit, OnDestroy {
tinymce.init({
branding: false,
menubar: false,
entity_encoding: 'raw',
statusbar: false,
plugins: 'autoresize lists',
forced_root_block: false,
Expand Down
2 changes: 2 additions & 0 deletions src/app/modules/pia/export/export.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,8 @@ export class ExportComponent implements OnInit {
const htmlRegexStrong2 = /<\/strong>/g;
string = string.replace(htmlRegexStrong, ' **');
string = string.replace(htmlRegexStrong2, '**');
const htmlRegexAnd = /&amp;/g;
string = string.replace(htmlRegexAnd, '&');
const htmlRegexLi = /<li>/g;
string = string.replace(htmlRegexLi, '- ');
const htmlRegexBr = /<br \/>/g;
Expand Down
37 changes: 22 additions & 15 deletions src/app/modules/pia/preview/preview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Output,
EventEmitter
} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { PiaService } from 'src/app/services/pia.service';
import { AppDataService } from 'src/app/services/app-data.service';
import { TranslateService } from '@ngx-translate/core';
Expand Down Expand Up @@ -43,6 +44,7 @@ export class PreviewComponent implements OnInit, AfterViewChecked {
public download = false;

constructor(
private route: ActivatedRoute,
public authService: AuthService,
public actionPlanService: ActionPlanService,
private translateService: TranslateService,
Expand All @@ -59,22 +61,29 @@ export class PreviewComponent implements OnInit, AfterViewChecked {
this.content = [];
this.dataNav = this.appDataService.dataNav;

this.showPia();
this.piaService
.find(parseInt(this.route.snapshot.params.id))
.then(async (pia: Pia) => {
this.pia = pia;
this.actionPlanService.data = this.dataNav;
this.actionPlanService.pia = this.pia;
this.showPia();

if (this.pia.is_archive === 1) {
this.fromArchives = true;
}
if (this.pia.is_archive === 1) {
this.fromArchives = true;
}

// Load PIA's revisions
const revision = new Revision();
this.revisionService.findAllByPia(this.pia.id).then(resp => {
this.revisions = resp;
});
// Load PIA's revisions
const revision = new Revision();
this.revisionService.findAllByPia(this.pia.id).then(resp => {
this.revisions = resp;
});

if (this.pia.structure_data) {
this.appDataService.dataNav = this.pia.structure_data;
}
this.data = this.appDataService.dataNav;
if (this.pia.structure_data) {
this.appDataService.dataNav = this.pia.structure_data;
}
this.data = this.appDataService.dataNav;
});
}

ngAfterViewChecked(): void {
Expand Down Expand Up @@ -121,8 +130,6 @@ export class PreviewComponent implements OnInit, AfterViewChecked {
*/
async showPia(): Promise<void> {
this.prepareDpoData();
this.actionPlanService.data = this.dataNav;
this.actionPlanService.pia = this.pia;
this.actionPlanService.listActionPlan();
this.getJsonInfo();
}
Expand Down

0 comments on commit 46e682e

Please sign in to comment.