From ce7e69f2aa43b409bbf91eec29273e9cd19cd973 Mon Sep 17 00:00:00 2001 From: ShounakB <65479699+Shounaks@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:29:57 +1100 Subject: [PATCH 1/3] rebase migration:grade-icon onto origin/8.0.x --- src/app/common/common.coffee | 1 - src/app/common/grade-icon/grade-icon.coffee | 16 - .../grade-icon/grade-icon.component.html | 16 + .../grade-icon/grade-icon.component.scss | 20 + .../common/grade-icon/grade-icon.component.ts | 35 ++ src/app/common/grade-icon/grade-icon.scss | 48 --- src/app/common/grade-icon/grade-icon.tpl.html | 8 - src/app/doubtfire-angular.module.ts | 2 + src/app/doubtfire-angularjs.module.ts | 3 +- ...roup-member-contribution-assigner.tpl.html | 82 ++-- .../project-progress-dashboard.tpl.html | 2 +- .../grade-task-modal.tpl.html | 54 +-- .../states/portfolios/portfolios.tpl.html | 6 +- .../students-list/students-list.tpl.html | 364 +++++++++--------- 14 files changed, 329 insertions(+), 328 deletions(-) delete mode 100644 src/app/common/grade-icon/grade-icon.coffee create mode 100644 src/app/common/grade-icon/grade-icon.component.html create mode 100644 src/app/common/grade-icon/grade-icon.component.scss create mode 100644 src/app/common/grade-icon/grade-icon.component.ts delete mode 100644 src/app/common/grade-icon/grade-icon.scss delete mode 100644 src/app/common/grade-icon/grade-icon.tpl.html diff --git a/src/app/common/common.coffee b/src/app/common/common.coffee index e5bbea48a..f330d8f6a 100644 --- a/src/app/common/common.coffee +++ b/src/app/common/common.coffee @@ -3,6 +3,5 @@ angular.module("doubtfire.common", [ 'doubtfire.common.filters' 'doubtfire.common.modals' 'doubtfire.common.file-uploader' - 'doubtfire.common.grade-icon' 'doubtfire.common.content-editable' ]) diff --git a/src/app/common/grade-icon/grade-icon.coffee b/src/app/common/grade-icon/grade-icon.coffee deleted file mode 100644 index f35f7fbfa..000000000 --- a/src/app/common/grade-icon/grade-icon.coffee +++ /dev/null @@ -1,16 +0,0 @@ -angular.module('doubtfire.common.grade-icon', []) - -.directive 'gradeIcon', -> - restrict: 'E' - replace: true - templateUrl: 'common/grade-icon/grade-icon.tpl.html' - scope: - inputGrade: '=?grade' - colorful: '=?' - controller: ($scope, gradeService) -> - $scope.$watch 'inputGrade', (newGrade) -> - $scope.grade = if _.isString($scope.inputGrade) then gradeService.stringToGrade($scope.inputGrade) else $scope.inputGrade - $scope.gradeText = (grade) -> - if grade? then gradeService.grades[grade] or "Grade" - $scope.gradeLetter = (grade) -> - gradeService.gradeAcronyms[grade] or 'G' diff --git a/src/app/common/grade-icon/grade-icon.component.html b/src/app/common/grade-icon/grade-icon.component.html new file mode 100644 index 000000000..2cb10af9d --- /dev/null +++ b/src/app/common/grade-icon/grade-icon.component.html @@ -0,0 +1,16 @@ +
diff --git a/src/app/common/grade-icon/grade-icon.component.scss b/src/app/common/grade-icon/grade-icon.component.scss new file mode 100644 index 000000000..76ea15e62 --- /dev/null +++ b/src/app/common/grade-icon/grade-icon.component.scss @@ -0,0 +1,20 @@ +.grade-icon { + color: #fff; + font-size: 1em; + background-color: #333333; + border-radius: 100%; + width: 2.25em; + height: 2.25em; + font-weight: 100; + font-size: 1em; + margin: 0 auto; + display: flex; + align-items: center; + justify-content: center; +} +.text-left .grade-icon { + margin-left: 0; +} +.text-right .grade-icon { + margin-right: 0; +} diff --git a/src/app/common/grade-icon/grade-icon.component.ts b/src/app/common/grade-icon/grade-icon.component.ts new file mode 100644 index 000000000..5c539d5ea --- /dev/null +++ b/src/app/common/grade-icon/grade-icon.component.ts @@ -0,0 +1,35 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import { Component, Inject, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; +import { GradeService } from '../services/grade.service'; +import { Project } from 'src/app/api/models/project'; + +@Component({ + selector: 'grade-icon', + templateUrl: './grade-icon.component.html', + styleUrls: ['./grade-icon.component.scss'], +}) +export class GradeIconComponent implements OnInit, OnChanges { + @Input() grade?: number; + @Input() colorful: boolean = false; + + InputGrade?: number; + gradeText: string = 'Grade'; + gradeLetter: string = 'G'; + + constructor(private gradeService: GradeService) {} + + ngOnInit(): void { + this.updateGrade(); + } + + ngOnChanges(changes: SimpleChanges): void { + if (changes['grade']) { + this.updateGrade(); + } + } + + private updateGrade(): void { + this.gradeText = this.gradeService.grades[this.grade] || 'Grade'; + this.gradeLetter = this.gradeService.gradeAcronyms[this.grade] || 'G'; + } +} diff --git a/src/app/common/grade-icon/grade-icon.scss b/src/app/common/grade-icon/grade-icon.scss deleted file mode 100644 index 08db661a8..000000000 --- a/src/app/common/grade-icon/grade-icon.scss +++ /dev/null @@ -1,48 +0,0 @@ -.grade-icon.text-muted { - background-color: $text-muted; -} -.grade-icon.text-primary { - background-color: $brand-primary; -} -.grade-icon.text-success { - background-color: $brand-success; -} -.grade-icon.text-danger { - background-color: $brand-danger; -} -.grade-icon.text-info { - background-color: $brand-info; -} -.grade-icon.text-warning { - background-color: $brand-warning; -} -a .grade-icon:hover { - background-color: $link-hover-color; -} -.grade-icon { - color: #fff; - font-size: 1em; - background-color: $text-color; - border-radius: 100%; - width: 2.25em; - height: 2.25em; - font-weight: 100; - font-size: 1em; - @include no-select; - margin: 0 auto; - display: flex; - align-items: center; - justify-content: center; -} -.grade-icon.colorful { - &.grade-0 { background-color: $grade-color-p; } - &.grade-1 { background-color: $grade-color-c; } - &.grade-2 { background-color: $grade-color-d; } - &.grade-3 { background-color: $grade-color-hd; } -} -.text-left .grade-icon { - margin-left: 0; -} -.text-right .grade-icon { - margin-right: 0; -} diff --git a/src/app/common/grade-icon/grade-icon.tpl.html b/src/app/common/grade-icon/grade-icon.tpl.html deleted file mode 100644 index 1939b2136..000000000 --- a/src/app/common/grade-icon/grade-icon.tpl.html +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/src/app/doubtfire-angular.module.ts b/src/app/doubtfire-angular.module.ts index 991ac397b..4b06266dc 100644 --- a/src/app/doubtfire-angular.module.ts +++ b/src/app/doubtfire-angular.module.ts @@ -170,6 +170,7 @@ import {TaskAssessmentModalComponent} from './common/modals/task-assessment-moda import {TaskSubmissionHistoryComponent} from './tasks/task-submission-history/task-submission-history.component'; import {HomeComponent} from './home/states/home/home.component'; import {IsActiveUnitRole} from './common/pipes/is-active-unit-role.pipe'; +import {GradeIconComponent} from './common/grade-icon/grade-icon.component'; import {HeaderComponent} from './common/header/header.component'; import {UnitDropdownComponent} from './common/header/unit-dropdown/unit-dropdown.component'; import {TaskDropdownComponent} from './common/header/task-dropdown/task-dropdown.component'; @@ -316,6 +317,7 @@ const MY_DATE_FORMAT = { TaskAssessmentCommentComponent, TaskAssessmentModalComponent, TaskSubmissionHistoryComponent, + GradeIconComponent, HeaderComponent, UnitDropdownComponent, TaskDropdownComponent, diff --git a/src/app/doubtfire-angularjs.module.ts b/src/app/doubtfire-angularjs.module.ts index e14fdbb54..1f42ca490 100644 --- a/src/app/doubtfire-angularjs.module.ts +++ b/src/app/doubtfire-angularjs.module.ts @@ -122,7 +122,6 @@ import 'build/src/app/common/modals/confirmation-modal/confirmation-modal.js'; import 'build/src/app/common/modals/comments-modal/comments-modal.js'; import 'build/src/app/common/modals/csv-result-modal/csv-result-modal.js'; import 'build/src/app/common/modals/modals.js'; -import 'build/src/app/common/grade-icon/grade-icon.js'; import 'build/src/app/common/file-uploader/file-uploader.js'; import 'build/src/app/common/common.js'; import 'build/src/app/common/services/listener-service.js'; @@ -193,6 +192,7 @@ import {CheckForUpdateService} from './sessions/service-worker-updater/check-for import {TaskSubmissionService} from './common/services/task-submission.service'; import {TaskAssessmentModalService} from './common/modals/task-assessment-modal/task-assessment-modal.service'; import {TaskSubmissionHistoryComponent} from './tasks/task-submission-history/task-submission-history.component'; +import {GradeIconComponent} from './common/grade-icon/grade-icon.component'; import {HeaderComponent} from './common/header/header.component'; import {SplashScreenComponent} from './home/splash-screen/splash-screen.component'; import {GlobalStateService} from './projects/states/index/global-state.service'; @@ -313,6 +313,7 @@ DoubtfireAngularJSModule.directive( 'objectSelect', downgradeComponent({component: ObjectSelectComponent}), ); +DoubtfireAngularJSModule.directive('gradeIcon', downgradeComponent({component: GradeIconComponent})); DoubtfireAngularJSModule.directive('appHeader', downgradeComponent({component: HeaderComponent})); DoubtfireAngularJSModule.directive( 'splashScreen', diff --git a/src/app/groups/group-member-contribution-assigner/group-member-contribution-assigner.tpl.html b/src/app/groups/group-member-contribution-assigner/group-member-contribution-assigner.tpl.html index 4caab308f..149ebb8a1 100644 --- a/src/app/groups/group-member-contribution-assigner/group-member-contribution-assigner.tpl.html +++ b/src/app/groups/group-member-contribution-assigner/group-member-contribution-assigner.tpl.html @@ -1,41 +1,41 @@ -Team Member | -Target Grade | -Contribution | -
---|---|---|
{{contrib.project.student.name}} | -
- |
-
- |
-
Team Member | +Target Grade | +Contribution | +
---|---|---|
{{contrib.project.student.name}} | +
+ |
+
+ |
+
Please provide a grade to change the student's status for task .
-- -
-Please provide a quality rating for task .
-Please provide a grade to change the student's status for task .
++ +
+Please provide a quality rating for task .
+