image video à la place de iframe
This commit is contained in:
parent
500b32626e
commit
b045f507d2
92 changed files with 945 additions and 656 deletions
|
|
@ -0,0 +1,74 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {Advert} from "../../../interfaces/advert";
|
||||
import {FictitiousUtilsService} from "../fictitiousUtils/fictitious-utils.service";
|
||||
|
||||
|
||||
|
||||
const TAB_ADVERT: Advert[] = [
|
||||
{
|
||||
_id: "idNutella",
|
||||
userId: "userId",
|
||||
title: "pot de nutella XXL",
|
||||
advertiser: "nutella",
|
||||
images: [
|
||||
{ url: "nutella_v_1.jpeg", description: "image nutella 1" },
|
||||
{ url: "nutella_v_2.png", description: "image nutella 2" },
|
||||
{ url: "nutella_v_3.jpg", description: "image nutella 3" }
|
||||
],
|
||||
tags: [ "bon", "petit-déjeuner", "chocolat" ],
|
||||
comment: "pub pour vacances de noêl",
|
||||
views: 5,
|
||||
isVisible: true,
|
||||
isActive: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
_id: "idRolex",
|
||||
userId: "userId",
|
||||
title: "Rolex",
|
||||
advertiser: "rolex",
|
||||
images: [
|
||||
{ url: "rolex_v_1.jpg", description: "rolex 1" },
|
||||
{ url: "rolex_v_2.png", description: "rolex 2" },
|
||||
],
|
||||
tags: [ "montre", "luxe", "suisse" ],
|
||||
comment: "pub pour cette année",
|
||||
views: 2,
|
||||
isVisible: true,
|
||||
isActive: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousAdvertsService
|
||||
{
|
||||
|
||||
constructor(private fictitiousUtilsService: FictitiousUtilsService) {}
|
||||
|
||||
|
||||
getAdvert(): Advert
|
||||
{
|
||||
const idx = Math.floor(Math.random() * TAB_ADVERT.length);
|
||||
let advert = Object.assign({}, TAB_ADVERT[idx]);
|
||||
advert._id = advert._id + this.fictitiousUtilsService.makeid(5);
|
||||
advert.tags = advert.tags.slice();
|
||||
advert.isVisible = (Math.random() < 0.5);
|
||||
return advert;
|
||||
}
|
||||
|
||||
|
||||
getTabAdvert(n: number): Advert[]
|
||||
{
|
||||
let tabAdvert = [];
|
||||
for(let i=0 ; i<n ; i++) tabAdvert.push(this.getAdvert());
|
||||
return tabAdvert;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in a new issue