fix(institution-card): removed project button for institutions other than one's own
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
@@ -65,18 +65,20 @@
|
||||
<mat-icon>menu_book</mat-icon>
|
||||
Publikationen
|
||||
</a>
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="[
|
||||
'/institution',
|
||||
stripOpenAlexId(institution().id),
|
||||
'projects',
|
||||
]"
|
||||
matButton="outlined"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>work</mat-icon>
|
||||
Projekte
|
||||
</a>
|
||||
@if (isOwnInstitution()) {
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="[
|
||||
'/institution',
|
||||
stripOpenAlexId(institution().id),
|
||||
'projects',
|
||||
]"
|
||||
matButton="outlined"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>work</mat-icon>
|
||||
Projekte
|
||||
</a>
|
||||
}
|
||||
@if (hasPatents()) {
|
||||
<a
|
||||
class="card-action"
|
||||
|
||||
@@ -14,6 +14,7 @@ import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { CredentialService } from '../../services/credential.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-institution-card',
|
||||
@@ -29,6 +30,7 @@ import { DecimalPipe } from '@angular/common';
|
||||
styleUrl: './app-institution-card.component.scss',
|
||||
})
|
||||
export class AppInstitutionCardComponent {
|
||||
private readonly credentialService = inject(CredentialService);
|
||||
private readonly patentsApi = inject(PatentsService);
|
||||
|
||||
institution = input.required<Institution>();
|
||||
@@ -43,6 +45,17 @@ export class AppInstitutionCardComponent {
|
||||
return 'Unbekannte Institution';
|
||||
});
|
||||
|
||||
isOwnInstitution = computed(() => {
|
||||
const id = this.stripOpenAlexId(this.institution().id);
|
||||
if (!id) return false;
|
||||
|
||||
console.log(
|
||||
`Comparing institution ID ${id} with effective institution ID ${this.credentialService.effectiveInstitutionId()}`,
|
||||
);
|
||||
|
||||
return id === this.credentialService.effectiveInstitutionId();
|
||||
});
|
||||
|
||||
// The "Patente" action only makes sense once org_patents has been indexed
|
||||
// for this institution (currently a manual, per-institution process), so
|
||||
// it's hidden by default and only shown once a cheap count check confirms
|
||||
|
||||
Reference in New Issue
Block a user