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

[#13144] Implement 'Copy' button in course enroll page #13193

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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 @@ -108,6 +108,16 @@ <h1 id="enroll-header" class="text-break">Enroll Students for {{ courseId }}</h1
<tm-ajax-loading *ngIf="isEnrolling"></tm-ajax-loading>
Enroll students
</button>

<button
type="button"
title="Copy"
id="btn-copy"
name="button-copy"
class="btn btn-secondary float-end me-2"
(click)="copyToClipboard()">
Copy
</button>
</div>
</div>
<div class="row mt-3" style="align-items: center;">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,4 +656,29 @@
scrollOffset: 70,
});
}

/**
* Implement the copy method
*/
copyToClipboard(): void {
const existingStudentsHOTInstance: Handsontable = this.hotRegisterer.getInstance(this.existingStudentsHOT);
const newStudentsHOTInstance: Handsontable = this.hotRegisterer.getInstance(this.newStudentsHOT);

const existingStudentsData = existingStudentsHOTInstance.getData();

newStudentsHOTInstance.loadData(existingStudentsData);

if(!this.isExistingStudentsPresent) {

Check failure on line 671 in src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Expected space(s) after "if"

Check failure on line 671 in src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Expected space(s) after "if"
this.statusMessageService.showErrorToast('No valid existing students to copy.');
return;
}

if(this.isExistingStudentsPanelCollapsed) {

Check failure on line 676 in src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Expected space(s) after "if"

Check failure on line 676 in src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Expected space(s) after "if"
this.statusMessageService.showWarningToast('Please expand existing students.');
return;

Check failure on line 678 in src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Unnecessary return statement

Check failure on line 678 in src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Unnecessary return statement
} else {

Check failure on line 679 in src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Unnecessary 'else' after 'return'

Check failure on line 679 in src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Unnecessary 'else' after 'return'
this.statusMessageService.showSuccessToast('Existing students copied successfully.');
}

}
}
Loading