Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General: Do not show certain buttons for tutors in lecture overview and course management #7423

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,28 @@
<fa-icon [icon]="faFilePdf"></fa-icon>
<span class="tab-link-text" jhiTranslate="artemisApp.courseOverview.menu.lectures">Lectures</span>
</a>
<a class="tab-link" *ngIf="course.isAtLeastTutor" [routerLink]="['/course-management', course.id, 'course-statistics']" routerLinkActive="active">
<a class="tab-link" [routerLink]="['/course-management', course.id, 'course-statistics']" routerLinkActive="active">
<fa-icon [icon]="faChartBar"></fa-icon>
<span class="tab-link-text" jhiTranslate="artemisApp.courseOverview.menu.statistics">Statistics</span>
</a>
<a class="tab-link" *ngIf="isCommunicationEnabled(course) && course.isAtLeastTutor" [routerLink]="['/courses', course.id, 'discussion']" routerLinkActive="active">
<a class="tab-link" *ngIf="isCommunicationEnabled(course)" [routerLink]="['/courses', course.id, 'discussion']" routerLinkActive="active">
<fa-icon [icon]="faComment"></fa-icon>
<span class="tab-link-text" jhiTranslate="artemisApp.metis.communication.label">Communication</span>
<fa-icon [icon]="faArrowUpRightFromSquare"></fa-icon>
</a>
<a class="tab-link" *ngIf="course?.isAtLeastInstructor && irisEnabled" (click)="showIrisSettings()" routerLinkActive="active">
<a class="tab-link" *ngIf="course.isAtLeastInstructor && irisEnabled" (click)="showIrisSettings()" routerLinkActive="active">
<fa-icon [icon]="faRobot"></fa-icon>
<span jhiTranslate="artemisApp.iris.settings.button.course.title">Iris</span>
<fa-icon [icon]="faArrowUpRightFromSquare"></fa-icon>
</a>
<a class="tab-link" *ngIf="isMessagingEnabled(course) && course.isAtLeastTutor" [routerLink]="['/courses', course.id, 'messages']" routerLinkActive="active">
<a class="tab-link" *ngIf="isMessagingEnabled(course)" [routerLink]="['/courses', course.id, 'messages']" routerLinkActive="active">
<fa-icon [icon]="faComments"></fa-icon>
<span class="tab-link-text" jhiTranslate="artemisApp.courseOverview.menu.messages">Messages</span>
<fa-icon [icon]="faArrowUpRightFromSquare"></fa-icon>
</a>
<a
class="tab-link"
[jhiFeatureToggleLink]="FeatureToggle.TutorialGroups"
*ngIf="course.isAtLeastInstructor"
[routerLink]="['/course-management', course.id, 'tutorial-groups']"
routerLinkActive="active"
[class.active]="shouldHighlightTutorialsLink()"
Expand All @@ -61,7 +60,7 @@
<fa-icon [icon]="faUserCheck"></fa-icon>
<span class="tab-link-text" jhiTranslate="entity.action.assessmentDashboard">Assessment</span>
</a>
<a class="tab-link" [routerLink]="['/course-management', course.id, 'scores']" routerLinkActive="active">
<a class="tab-link" *ngIf="course.isAtLeastInstructor" [routerLink]="['/course-management', course.id, 'scores']" routerLinkActive="active">
<fa-icon [icon]="faTable"></fa-icon>
<span class="tab-link-text" jhiTranslate="entity.action.scores">Scores</span>
</a>
Expand Down
26 changes: 14 additions & 12 deletions src/main/webapp/app/lecture/lecture-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ <h2><span jhiTranslate="artemisApp.lecture.detail.title">Lecture</span> {{ lectu
</dd>
</dl>

<a [routerLink]="['/course-management', lecture.course?.id, 'lectures', lecture.id, 'edit']" class="btn btn-primary">
<fa-icon [icon]="faPencilAlt"></fa-icon>
<span jhiTranslate="entity.action.edit"> Edit</span>
</a>
<a [routerLink]="['attachments']" class="btn btn-primary">
<fa-icon [icon]="faFile"></fa-icon>
<span jhiTranslate="entity.action.attachments">Attachment</span>
</a>
<a [routerLink]="['unit-management']" class="btn btn-primary">
<fa-icon [icon]="faPuzzlePiece"></fa-icon>
<span jhiTranslate="entity.action.units">Units</span>
</a>
<ng-container *ngIf="lecture.course?.isAtLeastEditor">
<a [routerLink]="['/course-management', lecture.course?.id, 'lectures', lecture.id, 'edit']" class="btn btn-primary">
<fa-icon [icon]="faPencilAlt"></fa-icon>
<span jhiTranslate="entity.action.edit"> Edit</span>
</a>
<a [routerLink]="['attachments']" class="btn btn-primary">
<fa-icon [icon]="faFile"></fa-icon>
<span jhiTranslate="entity.action.attachments">Attachment</span>
</a>
<a [routerLink]="['unit-management']" class="btn btn-primary">
<fa-icon [icon]="faPuzzlePiece"></fa-icon>
<span jhiTranslate="entity.action.units">Units</span>
</a>
</ng-container>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ <h3>
<span>{{ lecture!.title }}</span>
</h3>
<h4>
<span class="me-2" *ngIf="lecture!.startDate && lecture!.endDate">
<span class="me-2" *ngIf="lecture?.startDate && lecture?.endDate">
{{ 'artemisApp.courseOverview.lectureDetails.date' | artemisTranslate }} {{ lecture!.startDate | artemisDate }} -
{{ lecture!.endDate | artemisDate: 'time' }}
</span>
</h4>
</div>
<div class="col-auto d-flex align-items-center" *ngIf="!!lecture?.course?.isAtLeastTutor">
<div class="col-auto d-flex align-items-center" *ngIf="lecture?.course?.isAtLeastEditor">
<button id="manageLectureButton" class="btn btn-secondary" (click)="redirectToLectureManagement()">
{{ 'artemisApp.courseOverview.manage' | artemisTranslate }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,18 @@ describe('CourseLectureDetails', () => {
expect(courseLecturesDetailsComponent.hasPdfLectureUnit).toBeFalse();
}));

it('should display manage button when user is at least tutor', fakeAsync(() => {
it('should not display manage button when user is only tutor', fakeAsync(() => {
lecture.course!.isAtLeastTutor = true;
fixture.detectChanges();

const manageLectureButton = debugElement.query(By.css('#manageLectureButton'));
expect(manageLectureButton).toBeNull();
}));

it('should display manage button when user is at least editor', fakeAsync(() => {
lecture.course!.isAtLeastEditor = true;
fixture.detectChanges();

const manageLectureButton = debugElement.query(By.css('#manageLectureButton'));
expect(manageLectureButton).not.toBeNull();
}));
Expand Down