[M] Rename time selection to grading period

This commit is contained in:
Hykilpikonna
2019-11-06 21:49:17 -05:00
parent 7bc843aa9a
commit 2057f08e40
4 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -27,7 +27,7 @@
width: 110px; width: 110px;
} }
#nav-time-selection #nav-grading-period
{ {
// Float right // Float right
position: absolute; position: absolute;
+10 -10
View File
@@ -17,7 +17,7 @@ export default class Navigation extends Vue
@Prop({required: true}) courses: Course[]; @Prop({required: true}) courses: Course[];
private selectedTime: string = 'All Year'; private gradingPeriod: string = 'All Year';
// Instance // Instance
public static instance: Navigation; public static instance: Navigation;
@@ -30,9 +30,9 @@ export default class Navigation extends Vue
// Check selected time // Check selected time
if (!this.$cookies.isKey('va.selected-time')) if (!this.$cookies.isKey('va.selected-time'))
{ {
this.$cookies.set('va.selected-time', this.selectedTime, '10y'); this.$cookies.set('va.selected-time', this.gradingPeriod, '10y');
} }
this.selectedTime = this.$cookies.get('va.selected-time'); this.gradingPeriod = this.$cookies.get('va.selected-time');
} }
/** /**
@@ -162,25 +162,25 @@ export default class Navigation extends Vue
} }
/** /**
* Select time * Select grading period
* *
* @param command Term 1, Term 2, All Year, etc. * @param command Term 1, Term 2, All Year, etc.
*/ */
public selectTime(command: string) public selectGradingPeriod(command: string)
{ {
this.selectedTime = command; this.gradingPeriod = command;
this.$cookies.set('va.selected-time', command, '10y'); this.$cookies.set('va.selected-time', command, '10y');
// Call event // Call event
this.$emit('select-time', this.getSelectedTimeCode()); this.$emit('select-time', this.getSelectedGradingPeriod());
} }
/** /**
* Get code for selected time * Get code for selected time
*/ */
public getSelectedTimeCode(): number public getSelectedGradingPeriod(): number
{ {
if (this.selectedTime == 'All Year') return -1; if (this.gradingPeriod == 'All Year') return -1;
else return +this.selectedTime.replace('Term ', '') - 1; else return +this.gradingPeriod.replace('Term ', '') - 1;
} }
} }
+2 -2
View File
@@ -16,8 +16,8 @@
:key="course.name">{{course.name}}</el-menu-item> :key="course.name">{{course.name}}</el-menu-item>
</el-submenu> </el-submenu>
<!-- Time selection --> <!-- Grading period selection -->
<el-dropdown id="nav-time-selection" @command="selectTime"> <el-dropdown id="nav-grading-period" @command="selectTime">
<el-button type="primary" size="medium"> <el-button type="primary" size="medium">
{{selectedTime}}<i class="el-icon-arrow-down el-icon--right"></i> {{selectedTime}}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
+1 -1
View File
@@ -128,7 +128,7 @@ export default class Course
*/ */
get assignments(): Assignment[] get assignments(): Assignment[]
{ {
let timeCode = Navigation.instance.getSelectedTimeCode(); let timeCode = Navigation.instance.getSelectedGradingPeriod();
// All year // All year
if (timeCode == -1) if (timeCode == -1)