Commit 990b448f authored by Cédric Moreau's avatar Cédric Moreau

[fix] Description affichée correctement

parent a080d699
<ion-content padding>
<ion-row>
<ion-col col-12 col-sm-12 col-lg-6>
<ion-col col-12>
<h2>{{ announceService.ann.title }}</h2>
<p *ngIf="announceService.ann.images.length == 0">Pas d'images pour cette annnonce.</p>
<p>
<img *ngFor="let src of announceService.ann.images" src="{{ src }}"/>
</p>
<h3>Description</h3>
<pre>{{ announceService.ann.descParagraphe }}</pre>
<p [innerHTML]="announceService.ann.descParagrapheHTML"></p>
<h3>Prix</h3>
<p class="price">
{{ announceService.ann.price }} Ğ1
......
......@@ -83,7 +83,7 @@
<ion-textarea required
minlength="10"
maxlength="10000"
[(ngModel)]="announceService.ann.desc"
[(ngModel)]="announceService.ann.descParagraphe"
name="desc"
#desc="ngModel"
placeholder="Tapez votre texte ici."></ion-textarea>
......
......@@ -11,7 +11,7 @@
</div>
</ion-avatar>
<h2>{{ a.title }} • <span class="author">{{ a.account.title }}</span></h2>
<p>{{ a.desc }}</p>
<p>{{ a.descLigne }}</p>
<h3 clear item-right>{{ a.price }} Ğ1</h3>
</button>
</ion-list>
......
......@@ -14,6 +14,7 @@ export class HomePage {
this.announces = []
this.announceService.listAllAnnounces().then(announces => this.announces = announces.map(a => {
a.thumbnail = a.images[0]
a.descLigne = a.desc.replace(/\\n/g, ' ')
return a
}))
}
......
......@@ -68,7 +68,10 @@ export class AnnounceService {
.toPromise().then((res) => {
this.ann = res.json().announce
this.ann.descLigne = this.ann.desc.replace(/\\n+/g, ' ')
this.ann.descParagraphe = this.ann.desc.replace(/\\n/g, '\n')
this.ann.descParagraphe = this.ann.desc.replace(/\\n/g, '\n').replace(/\\\n/g, '\\n')
this.ann.descParagrapheHTML = this.ann.desc
.replace(/\\n/g, '<br>')
.replace(/\\<br>/g, '\\n')
this.ann.feesFloat = parseFloat(this.ann.fees)
this.ann.images = this.ann.images || []
this.stockInitial = this.ann.stock
......@@ -112,7 +115,7 @@ export class AnnounceService {
raw += `Pub: ${a.pub}\n`
raw += `Uuid: ${a.uuid}\n`
raw += `Title: ${a.title}\n`
raw += `Desc: ${a.desc.replace(/\n/g, '\\n')}\n`
raw += `Desc: ${a.descParagraphe.replace(/\\n/g, '\\\\n').replace(/\n/g, '\\n')}\n`
raw += `Price: ${a.price}\n`
raw += `Fees: ${a.fees}\n`
raw += `Type: ${a.type}\n`
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment