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

refactor: migrated group-set-selector #239

Open
wants to merge 2 commits into
base: development
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
3 changes: 3 additions & 0 deletions src/app/doubtfire-angular.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ import {TasksViewerComponent} from './units/states/tasks/tasks-viewer/tasks-view
import {UnitCodeComponent} from './common/unit-code/unit-code.component';
import {GradeService} from './common/services/grade.service';

import {GroupSetSelectorComponent} from './groups/group-set-selector/group-set-selector.component';
@NgModule({
// Components we declare
declarations: [
Expand Down Expand Up @@ -325,6 +326,7 @@ import {GradeService} from './common/services/grade.service';
FUsersComponent,
FTaskBadgeComponent,
FUnitsComponent,
GroupSetSelectorComponent,
],
// Services we provide
providers: [
Expand All @@ -348,6 +350,7 @@ import {GradeService} from './common/services/grade.service';
UserService,
TaskService,
GradeService,

TaskSimilarityService,
WebcalService,
ActivityTypeService,
Expand Down
9 changes: 7 additions & 2 deletions src/app/doubtfire-angularjs.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import 'build/src/app/groups/group-set-manager/group-set-manager.js';
import 'build/src/app/groups/groups.js';
import 'build/src/app/groups/group-member-contribution-assigner/group-member-contribution-assigner.js';
import 'build/src/app/groups/group-member-list/group-member-list.js';
import 'build/src/app/groups/group-set-selector/group-set-selector.js';

import 'build/src/app/units/modals/unit-student-enrolment-modal/unit-student-enrolment-modal.js';
import 'build/src/app/units/modals/unit-ilo-edit-modal/unit-ilo-edit-modal.js';
import 'build/src/app/units/modals/modals.js';
Expand Down Expand Up @@ -220,7 +220,7 @@ import {FUnitTaskListComponent} from './units/states/tasks/viewer/directives/f-u
import {FTaskDetailsViewComponent} from './units/states/tasks/viewer/directives/f-task-details-view/f-task-details-view.component';
import {FTaskSheetViewComponent} from './units/states/tasks/viewer/directives/f-task-sheet-view/f-task-sheet-view.component';
import {TasksViewerComponent} from './units/states/tasks/tasks-viewer/tasks-viewer.component';

import {GroupSetSelectorComponent} from './groups/group-set-selector/group-set-selector.component';
import {FUnitsComponent} from './admin/states/f-units/f-units.component';
import {MarkedPipe} from './common/pipes/marked.pipe';
import {AlertService} from './common/services/alert.service';
Expand All @@ -235,6 +235,7 @@ export const DoubtfireAngularJSModule = angular.module('doubtfire', [
'doubtfire.projects',
'doubtfire.groups',
'doubtfire.visualisations',

]);

// Downgrade angular modules that we need...
Expand Down Expand Up @@ -321,6 +322,10 @@ DoubtfireAngularJSModule.directive(
'splashScreen',
downgradeComponent({component: SplashScreenComponent}),
);
DoubtfireAngularJSModule.directive(
'groupSetSelector',
downgradeComponent({component: GroupSetSelectorComponent}),
);
DoubtfireAngularJSModule.directive(
'userBadge',
downgradeComponent({component: UserBadgeComponent}),
Expand Down
8 changes: 4 additions & 4 deletions src/app/groups/group-selector/group-selector.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ <h4 class="panel-title">
Groups for
<strong ng-hide="showGroupSetSelector"> {{selectedGroupSet.name}} </strong>
<group-set-selector
ng-show="showGroupSetSelector"
unit="unit"
ng-model="selectedGroupSet"
on-change="selectGroupSet"
*ngIf="showGroupSetSelector"
[unit]="unit"
[(selectedGroupSet)]="selectedGroupSet"
(selectGroupSet)="selectGroupSet($event)"
>
</group-set-selector>
</h4>
Expand Down
18 changes: 0 additions & 18 deletions src/app/groups/group-set-selector/group-set-selector.coffee

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<select class="form-control" [(ngModel)]="selectedGroupSet" (ngModelChange)="onGroupSetSelect()">
<option *ngFor="let gs of unit.groupSets" [ngValue]="gs">{{ gs.name }}</option>
</select>
24 changes: 24 additions & 0 deletions src/app/groups/group-set-selector/group-set-selector.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {Component, Input, Output, EventEmitter, OnInit} from '@angular/core';
import {Unit, GroupSet} from '/workspace/doubtfire-web/src/app/api/models/doubtfire-model';

@Component({
// eslint-disable-next-line @angular-eslint/component-selector
selector: 'group-set-selector',
templateUrl: './group-set-selector.component.html',
})
export class GroupSetSelectorComponent implements OnInit {
@Input() unit: Unit;
@Input() selectedGroupSet: GroupSet;
@Output() selectGroupSet = new EventEmitter<GroupSet>(); // Renamed to follow Angular conventions

ngOnInit() {
if (!this.unit) {
throw new Error('Unit not supplied to group set selector');
}
}

onGroupSetSelect() {
// Method name changed to be more descriptive and avoid confusion with the @Output name
this.selectGroupSet.emit(this.selectedGroupSet);
}
}
6 changes: 0 additions & 6 deletions src/app/groups/group-set-selector/group-set-selector.tpl.html

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/groups/groups.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ angular.module('doubtfire.groups', [
'doubtfire.groups.group-member-list'
'doubtfire.groups.group-selector'
'doubtfire.groups.group-set-manager'
'doubtfire.groups.group-set-selector'

])