Skip to content

Commit ef4c1cc

Browse files
committed
feat(periods): add an option to hide the period switch
1 parent ff7cb76 commit ef4c1cc

File tree

6 files changed

+10
-0
lines changed

6 files changed

+10
-0
lines changed

src/cards/base-period-related-card.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class BasePeriodRelatedPronoteCard extends BasePronoteCard {
1818
this.setPeriodFilterFromConfig(this.config.default_period);
1919
}
2020

21+
if (this.config.hide_period_switch) {
22+
return html``;
23+
}
24+
2125
let available_periods = [...this.getActivePeriods()];
2226
if (this.allow_all_periods) {
2327
available_periods.push({
@@ -107,6 +111,7 @@ class BasePeriodRelatedPronoteCard extends BasePronoteCard {
107111
getDefaultConfig() {
108112
return {
109113
default_period: 'current',
114+
hide_period_switch: false,
110115
}
111116
}
112117

src/editors/absences-card-editor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class PronoteAbsencesCardEditor extends BasePronoteCardEditor {
1616
${this.buildEntityPickerField('Absences entity', 'entity', this._config.entity, 'absences')}
1717
${this.buildSwitchField('Display header', 'display_header', this._config.display_header)}
1818
${this.buildNumberField('Max absences', 'max_absences', this._config.max_absences)}
19+
${this.buildSwitchField('Hide period switch', 'hide_period_switch', this._config.hide_period_switch, false)}
1920
${this.buildDefaultPeriodSelectField('Default period', 'default_period', 'absences', this._config.default_period)}
2021
`;
2122
}

src/editors/averages-card-editor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class PronoteAveragesCardEditor extends BasePronoteCardEditor {
2121
${this.buildTextField('Compare with ratio', 'compare_with_ratio', this._config.compare_with_ratio, '')}
2222
${this.buildSwitchField('Display class min', 'display_class_min', this._config.display_class_min)}
2323
${this.buildSwitchField('Display class max', 'display_class_max', this._config.display_class_max)}
24+
${this.buildSwitchField('Hide period switch', 'hide_period_switch', this._config.hide_period_switch, false)}
2425
${this.buildDefaultPeriodSelectField('Default period', 'default_period', 'averages', this._config.default_period, 'current', false)}
2526
`;
2627
}

src/editors/delays-card-editor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class PronoteDelaysCardEditor extends BasePronoteCardEditor {
1616
${this.buildEntityPickerField('Delays entity', 'entity', this._config.entity, 'delays')}
1717
${this.buildSwitchField('Display header', 'display_header', this._config.display_header)}
1818
${this.buildNumberField('Max delays', 'max_delays', this._config.max_delays)}
19+
${this.buildSwitchField('Hide period switch', 'hide_period_switch', this._config.hide_period_switch, false)}
1920
${this.buildDefaultPeriodSelectField('Default period', 'default_period', 'delays', this._config.default_period)}
2021
`;
2122
}

src/editors/evaluations-card-editor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class PronoteEvaluationsCardEditor extends BasePronoteCardEditor {
2121
${this.buildSwitchField('Display comment', 'display_comment', this._config.display_comment)}
2222
${this.buildSwitchField('Display coefficient', 'display_coefficient', this._config.display_coefficient)}
2323
${this.buildNumberField('Max evaluations', 'max_evaluations', this._config.max_evaluations)}
24+
${this.buildSwitchField('Hide period switch', 'hide_period_switch', this._config.hide_period_switch, false)}
2425
${this.buildDefaultPeriodSelectField('Default period', 'default_period', 'evaluations', this._config.default_period)}
2526
`;
2627
}

src/editors/grades-card-editor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class PronoteGradesCardEditor extends BasePronoteCardEditor {
2525
${this.buildSwitchField('Display class max', 'display_class_max', this._config.display_class_max)}
2626
${this.buildSwitchField('Display new grade notice', 'display_new_grade_notice', this._config.display_new_grade_notice)}
2727
${this.buildNumberField('Max grades', 'max_grades', this._config.max_grades)}
28+
${this.buildSwitchField('Hide period switch', 'hide_period_switch', this._config.hide_period_switch, false)}
2829
${this.buildDefaultPeriodSelectField('Default period', 'default_period', 'grades', this._config.default_period)}
2930
`;
3031
}

0 commit comments

Comments
 (0)