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 @@ +
+ + {{ gradeLetter }} + +
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 @@ -
- - {{gradeLetter(grade)}} - -
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 MemberTarget GradeContribution
{{contrib.project.student.name}} - - - - - - - {{contrib.percent}} % effort - - - No effort - - -
-
+
+ + + + + + + + + + + + + + + +
Team MemberTarget GradeContribution
{{contrib.project.student.name}} + + + + + + + {{contrib.percent}} % effort + + + No effort + + +
+
diff --git a/src/app/projects/project-progress-dashboard/project-progress-dashboard.tpl.html b/src/app/projects/project-progress-dashboard/project-progress-dashboard.tpl.html index 5dc40dc5b..7e59cac17 100644 --- a/src/app/projects/project-progress-dashboard/project-progress-dashboard.tpl.html +++ b/src/app/projects/project-progress-dashboard/project-progress-dashboard.tpl.html @@ -22,7 +22,7 @@

Target Grade

diff --git a/src/app/tasks/modals/grade-task-modal/grade-task-modal.tpl.html b/src/app/tasks/modals/grade-task-modal/grade-task-modal.tpl.html index 0906d7b59..4d02cce31 100644 --- a/src/app/tasks/modals/grade-task-modal/grade-task-modal.tpl.html +++ b/src/app/tasks/modals/grade-task-modal/grade-task-modal.tpl.html @@ -1,27 +1,27 @@ -
- - - -
+
+ + + +
diff --git a/src/app/units/states/portfolios/portfolios.tpl.html b/src/app/units/states/portfolios/portfolios.tpl.html index 2b8a2277e..800d4f4cb 100644 --- a/src/app/units/states/portfolios/portfolios.tpl.html +++ b/src/app/units/states/portfolios/portfolios.tpl.html @@ -65,7 +65,7 @@

Mark Portfolios

btn-radio="{{$index}}" > Mark Portfolios {{student.tutorNames()}} {{student.shortTutorialDescription()}} - + - + diff --git a/src/app/units/states/students-list/students-list.tpl.html b/src/app/units/states/students-list/students-list.tpl.html index 929cefe38..d81fdb4cd 100644 --- a/src/app/units/states/students-list/students-list.tpl.html +++ b/src/app/units/states/students-list/students-list.tpl.html @@ -1,182 +1,182 @@ -
-
-
-
- - - - -
- -
-
-
- -
-
- - -
-
-
-
- -
-
- - - -
-
-

- Click the button twice to reverse the sort ordering. -

-
-
-
-
-

No students found

-

- No students were found using the filters specified. -

-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - Username - - - - Name - - - - Stats - - - - Flags - - - - - Campus - - - - Tutorial - -
- - - {{project.student.username || "N/A"}} - - {{project.student.name}} - - - - {{bar.value !== bar.value ? 'No Interaction' : (bar.value + '%')}} - - - - - - - - - - - - - - - - - - -
- -
-
+
+
+
+
+ + + + +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + + +
+
+

+ Click the button twice to reverse the sort ordering. +

+
+
+
+
+

No students found

+

+ No students were found using the filters specified. +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + Username + + + + Name + + + + Stats + + + + Flags + + + + + Campus + + + + Tutorial + +
+ + + {{project.student.username || "N/A"}} + + {{project.student.name}} + + + + {{bar.value !== bar.value ? 'No Interaction' : (bar.value + '%')}} + + + + + + + + + + + + + + + + + + +
+ +
+
From 91b42988188a2e9ebfdfbcca338382da656a7e32 Mon Sep 17 00:00:00 2001 From: ShounakB <65479699+Shounaks@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:21:41 +1100 Subject: [PATCH 2/3] Fixing All components and CSS Cleanup --- .../common/grade-icon/grade-icon.component.html | 14 +++++++------- .../common/grade-icon/grade-icon.component.scss | 14 -------------- .../common/grade-icon/grade-icon.component.ts | 17 +++++++++-------- src/app/doubtfire-angularjs.module.ts | 2 +- .../group-member-contribution-assigner.tpl.html | 2 +- .../group-member-list.tpl.html | 2 +- .../project-progress-dashboard.tpl.html | 2 +- .../portfolio-grade-select-step.tpl.html | 6 +++--- .../grade-task-modal/grade-task-modal.tpl.html | 2 +- .../units/states/portfolios/portfolios.tpl.html | 8 ++++---- .../states/students-list/students-list.tpl.html | 2 +- 11 files changed, 29 insertions(+), 42 deletions(-) diff --git a/src/app/common/grade-icon/grade-icon.component.html b/src/app/common/grade-icon/grade-icon.component.html index 2cb10af9d..7af15c0ba 100644 --- a/src/app/common/grade-icon/grade-icon.component.html +++ b/src/app/common/grade-icon/grade-icon.component.html @@ -1,12 +1,12 @@ -
+
{{contrib.project.student.name}} - + No members in group {{member.student.username || "N/A"}} {{member.student.name}} - +

diff --git a/src/app/tasks/modals/grade-task-modal/grade-task-modal.tpl.html b/src/app/tasks/modals/grade-task-modal/grade-task-modal.tpl.html index 4d02cce31..7fa8e7055 100644 --- a/src/app/tasks/modals/grade-task-modal/grade-task-modal.tpl.html +++ b/src/app/tasks/modals/grade-task-modal/grade-task-modal.tpl.html @@ -7,7 +7,7 @@

Assess Task Quality

Please provide a grade to change the student's status for task .

diff --git a/src/app/units/states/portfolios/portfolios.tpl.html b/src/app/units/states/portfolios/portfolios.tpl.html index 800d4f4cb..c67b13e40 100644 --- a/src/app/units/states/portfolios/portfolios.tpl.html +++ b/src/app/units/states/portfolios/portfolios.tpl.html @@ -64,12 +64,12 @@

Mark Portfolios

ng-model="filterOptions.selectedGrade" btn-radio="{{$index}}" > - + > @@ -194,10 +194,10 @@

Mark Portfolios

{{student.tutorNames()}} {{student.shortTutorialDescription()}} - + - + diff --git a/src/app/units/states/students-list/students-list.tpl.html b/src/app/units/states/students-list/students-list.tpl.html index d81fdb4cd..830d0a4c3 100644 --- a/src/app/units/states/students-list/students-list.tpl.html +++ b/src/app/units/states/students-list/students-list.tpl.html @@ -130,7 +130,7 @@

No students found

- + From e3fdd3b0fafe1988e1f19346b11b18a5b4274072 Mon Sep 17 00:00:00 2001 From: ShounakB <65479699+Shounaks@users.noreply.github.com> Date: Sat, 23 Nov 2024 00:46:19 +1100 Subject: [PATCH 3/3] Fixing updateGrade Method --- src/app/common/grade-icon/grade-icon.component.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app/common/grade-icon/grade-icon.component.ts b/src/app/common/grade-icon/grade-icon.component.ts index d90bc6298..5f8f31c7b 100644 --- a/src/app/common/grade-icon/grade-icon.component.ts +++ b/src/app/common/grade-icon/grade-icon.component.ts @@ -11,7 +11,7 @@ export class GradeIconComponent implements OnInit, OnChanges { @Input() grade?: number | string; @Input() colorful: boolean = false; - gradeText: number | string = 'Grade'; + gradeText: string = 'Grade'; gradeLetter: string = 'G'; constructor(private gradeService: GradeService) {} @@ -27,10 +27,9 @@ export class GradeIconComponent implements OnInit, OnChanges { } private updateGrade(): void { - this.gradeText = - typeof this.grade === 'string' - ? this.gradeService.stringToGrade(this.grade) - : this.gradeService.grades[this.grade] || 'Grade'; - this.gradeLetter = this.gradeService.gradeAcronyms[this.grade] || 'G'; + const grade: number = + typeof this.grade === 'string' ? this.gradeService.stringToGrade(this.grade) : this.grade; + this.gradeText = this.gradeService.grades[grade] || 'Grade'; + this.gradeLetter = this.gradeService.gradeAcronyms[grade] || 'G'; } }