Skip to content

Commit

Permalink
feat: suggest media changes
Browse files Browse the repository at this point in the history
  • Loading branch information
edelclaux committed Oct 31, 2024
1 parent 94dbc1b commit 768dd18
Show file tree
Hide file tree
Showing 29 changed files with 511 additions and 363 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,12 @@ <h5 class="counting-title">{{ 'Counting.Counting' | translate }} #{{ i + 1 }}</h
<i>({{ ms.typeMedia(media) }}, {{ media.author }})</i>
<span *ngIf="media.description_fr">{{ media.description_fr }}</span>
</div>
<div>
<pnx-display-medias
[medias]="counting.medias"
[index]="i"
<div class="MediaItems">
<pnx-media-item
[diaporamaMedia]="counting.medias"
[inputMedia]="counting.medias[i]"
display="medium"
diaporama="true"
></pnx-display-medias>
></pnx-media-item>
</div>
</ng-container>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,11 @@
</div>
</div>
<div>
<pnx-display-medias
[medias]="counting.medias"
[index]="i"
display="medium"
diaporama="true"
></pnx-display-medias>
<pnx-media-item
[inputMedia]="counting.medias[i]"
[diaporamaMedia]="counting.medias"
display="icon"
/>
</div>
</ng-container>
<mat-divider></mat-divider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,14 @@
<div *ngFor="let taxon of displayTaxonsTooltip(row)">
{{ taxon.taxName }}
<br />
<span [innerHTML]="taxon.icons | safeHTML"></span>
<!-- <pnx-display-medias [medias]="taxon.medias" diaporama="true" display='mini'></pnx-display-medias> -->
<div class="OcctaxMapList__medias">
<pnx-media-item
*ngFor="let media of taxon.medias"
[inputMedia]="media"
[diaporamaMedia]="taxon.medias"
display="icon"
></pnx-media-item>
</div>
</div>
</div>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,12 @@ ngx-datatable {
height: auto !important;
font-size: 0.8em;
}

.OcctaxMapList__medias {
margin: 0;
padding: 0;
display: flex;
flex-flow: row;
justify-content: flex-start;
gap: 0.2rem;
}
17 changes: 9 additions & 8 deletions frontend/src/app/GN2CommonModule/GN2Common.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import { DatalistComponent } from '@geonature_common/form/datalist/datalist.comp
import { BreadcrumbsComponent } from '@geonature_common/others/breadcrumbs/breadcrumbs.component';
import { DatasetsComponent } from './form/datasets/datasets.component';
import { DateComponent } from './form/date/date.component';
import { DisplayMediasComponent } from '@geonature_common/form/media/display-medias.component';
import { DumbSelectComponent } from '@geonature_common/form/dumb-select/dumb-select.component';
import { DynamicFormComponent } from './form/dynamic-form/dynamic-form.component';
import { DynamicFormService } from '@geonature_common/form/dynamic-form-generator/dynamic-form.service';
Expand All @@ -61,7 +60,9 @@ import { MapListGenericFiltersComponent } from './map-list/generic-filters/gener
import { MapOverLaysComponent } from './map/overlays/overlays.component';
import { MarkerComponent } from './map/marker/marker.component';
import { MediaComponent } from '@geonature_common/form/media/media.component';
import { MediaDialog } from '@geonature_common/form/media/media-dialog.component';
import { MediaCard } from '@geonature_common/form/media/media-card.component';
import { MediaDiaporamaDialog } from '@geonature_common/form/media/media-diaporama-dialog.component';
import { MediaItem } from '@geonature_common/form/media/media-item.component';
import { MediasComponent } from '@geonature_common/form/media/medias.component';
import { MediasTestComponent } from '@geonature_common/form/media/medias-test.component';
import { ModalDownloadComponent } from '@geonature_common/others/modal-download/modal-download.component';
Expand Down Expand Up @@ -151,7 +152,6 @@ import { TaxonTreeComponent } from './form/taxon-tree/taxon-tree.component';
DatasetsComponent,
DateComponent,
DisableControlDirective,
DisplayMediasComponent,
DisplayMouseOverDirective,
DumbSelectComponent,
DynamicFormComponent,
Expand All @@ -169,7 +169,9 @@ import { TaxonTreeComponent } from './form/taxon-tree/taxon-tree.component';
MapOverLaysComponent,
MarkerComponent,
MediaComponent,
MediaDialog,
MediaCard,
MediaDiaporamaDialog,
MediaItem,
MediasComponent,
MediasTestComponent,
ModalDownloadComponent,
Expand Down Expand Up @@ -221,7 +223,6 @@ import { TaxonTreeComponent } from './form/taxon-tree/taxon-tree.component';
DatasetsComponent,
DateComponent,
DisableControlDirective,
DisplayMediasComponent,
DisplayMouseOverDirective,
DumbSelectComponent,
FormsModule,
Expand Down Expand Up @@ -261,7 +262,9 @@ import { TaxonTreeComponent } from './form/taxon-tree/taxon-tree.component';
MatTabsModule,
MatToolbarModule,
MatTooltipModule,
MediaDialog,
MediaCard,
MediaDiaporamaDialog,
MediaItem,
MediasComponent,
ModalDownloadComponent,
MultiSelectComponent,
Expand All @@ -280,8 +283,6 @@ import { TaxonTreeComponent } from './form/taxon-tree/taxon-tree.component';
GeometryFormComponent,
ConfirmationDialog,
MediasComponent,
MediaDialog,
DisplayMediasComponent,
DatalistComponent,
PlacesComponent,
PlacesListComponent,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<mat-card class="MediaCard">
<mat-card-title class="MediaCard__title">
{{ media.title_fr }}
</mat-card-title>
<mat-card-content class="MediaCard__content">
<pnx-media-item
[inputMedia]="media"
[diaporamaMedia]="diaporamaMedia"
></pnx-media-item>
</mat-card-content>
<mat-card-footer class="MediaCard__footer">
<div>
<a
*ngIf="href"
target="_blank"
class="link-media float-right"
[href]="href"
>
<mat-icon matTooltip="{{ 'Media.link' | translate }}">link</mat-icon>
</a>
{{ media.description_fr }}
</div>
<div>({{ type }}, {{ media.author }})</div>
</mat-card-footer>
</mat-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.MediaCard {
display: flex;
flex-flow: column;
justify-content: flex-start;
height: inherit;
max-height: inherit;
max-width: 100%;
border: none;
box-shadow: none;

&__content {
display: block;
max-height: 100%;
height: 100%;

overflow: auto;
padding: 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Component, Input } from '@angular/core';
import { Media } from './media';
import { MediaService } from '@geonature_common/service/media.service';
import { ConfigService } from '@geonature/services/config.service';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
import { MediaType } from './media-type';

@Component({
selector: 'pnx-media-card',
templateUrl: './media-card.component.html',
styleUrls: ['./media-card.component.scss'],
})
export class MediaCard {
media: Media;
href: string | false;
type: MediaType;

@Input()
set inputMedia(media: any) {
if (!(media instanceof Media)) {
this.media = new Media(media);
} else {
this.media = media;
}
this.href = this.media.href(this.config.API_ENDPOINT, this.config.MEDIA_URL);
this.type = this.ms.typeMedia(this.media);
}

@Input()
diaporamaMedia: Array<any> | null = null;

constructor(
public ms: MediaService,
public config: ConfigService,
public _sanitizer: DomSanitizer
) {}
}
Loading

0 comments on commit 768dd18

Please sign in to comment.