Skip to content

Commit

Permalink
made link to button
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonEntholzer committed Nov 28, 2024
1 parent c857506 commit b3110c1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,31 +98,25 @@
</ng-template>
<ng-template #editorToolbar>
<ng-container *jhiExtensionPoint="overrideExportGoToRepository">
@if (isAtLeastEditor && localVCEnabled && !isTestRun) {
<a class="btn btn-secondary btn-sm me-2 open-repository-button" [routerLink]="localRepositoryLink" target="_blank" rel="noopener noreferrer">
<fa-icon [icon]="faExternalLink" />
<span jhiTranslate="artemisApp.exerciseAssessmentDashboard.programmingExercise.goToRepo"></span>
</a>
}
<jhi-programming-assessment-repo-export
[programmingExercises]="[exercise]"
[singleParticipantMode]="true"
[participationIdList]="participation ? [participation!.id!] : []"
/>
@if (isAtLeastEditor) {
@if (!localVCEnabled) {
<a
class="ms-2 me-5"
href="{{ participation?.userIndependentRepositoryUri }}"
target="_blank"
rel="noopener noreferrer"
jhiTranslate="artemisApp.exerciseAssessmentDashboard.programmingExercise.goToRepo"
></a>
} @else {
<a
class="ms-2 me-5"
[routerLink]="localRepositoryLink"
target="_blank"
rel="noopener noreferrer"
jhiTranslate="artemisApp.exerciseAssessmentDashboard.programmingExercise.goToRepo"
>
<fa-icon [icon]="faExternalLink" />
</a>
}
@if (isAtLeastEditor && !localVCEnabled) {
<a
class="ms-2 me-5"
href="{{ participation?.userIndependentRepositoryUri }}"
target="_blank"
rel="noopener noreferrer"
jhiTranslate="artemisApp.exerciseAssessmentDashboard.programmingExercise.goToRepo"
></a>
}
</ng-container>
@if (participation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,7 @@ export class CodeEditorTutorAssessmentContainerComponent implements OnInit, OnDe
const observable = this.repositoryFileService.getFilesWithContent();
// Set back to student participation
this.domainService.setDomain([DomainType.PARTICIPATION, this.participation]);
this.localRepositoryLink = getLocalRepositoryLink(
this.courseId,
this.exerciseId,
this.participation.id!,
this.exerciseGroupId,
this.examId,
this.isTestRun,
);
this.localRepositoryLink = getLocalRepositoryLink(this.courseId, this.exerciseId, this.participation.id!, this.exerciseGroupId, this.examId);
return observable;
}),
tap((templateFilesObj) => {
Expand Down
7 changes: 2 additions & 5 deletions src/main/webapp/app/utils/navigation.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,10 @@ export const getExerciseDashboardLink = (courseId: number, exerciseId: number, e
: ['/course-management', courseId.toString(), 'assessment-dashboard', exerciseId.toString()];
};

export const getLocalRepositoryLink = (courseId: number, exerciseId: number, participationId: number, exerciseGroupId: number = 0, examId = 0, isTestRun = false): string[] => {
if (isTestRun) {
return ['/course-management', courseId.toString(), 'exams', examId.toString(), 'test-runs', 'assess'];
}
export const getLocalRepositoryLink = (courseId: number, exerciseId: number, participationId: number, exerciseGroupId: number = 0, examId = 0): string[] => {
const suffix = ['programming-exercises', exerciseId.toString(), 'participations', participationId.toString(), 'repository'];

return examId > 0
return examId < 0
? ['/course-management', courseId.toString(), 'exams', examId.toString(), 'exercise-groups', exerciseGroupId.toString(), ...suffix]
: ['/course-management', courseId.toString(), ...suffix];
};
Expand Down

0 comments on commit b3110c1

Please sign in to comment.