diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2026-03-19 10:49:40 +0100 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2026-03-19 10:49:40 +0100 |
| commit | d3f234e367aede066d44927173445382953d169b (patch) | |
| tree | 652d50d395e7d5450e25b0ebd7e8900c0b1874d7 | |
| parent | c724f59e5ef1af25dde949bc50e996a4dbf2b943 (diff) | |
remove minimal version of mycourses mixin, fixes #6357
Closes #6357
Merge request studip/studip!4840
| -rw-r--r-- | resources/vue/apps/my-courses/ColorGroupSelector.vue | 2 | ||||
| -rw-r--r-- | resources/vue/mixins/MyCoursesMixin.js | 268 |
2 files changed, 134 insertions, 136 deletions
diff --git a/resources/vue/apps/my-courses/ColorGroupSelector.vue b/resources/vue/apps/my-courses/ColorGroupSelector.vue index 8572964..a620569 100644 --- a/resources/vue/apps/my-courses/ColorGroupSelector.vue +++ b/resources/vue/apps/my-courses/ColorGroupSelector.vue @@ -96,7 +96,7 @@ import { createMixin } from "@/vue/mixins/MyCoursesMixin"; export default { name: "MyCoursesColorGroupSelector", mixins: [ - createMixin(true), + createMixin(), ], props: { cid: String, diff --git a/resources/vue/mixins/MyCoursesMixin.js b/resources/vue/mixins/MyCoursesMixin.js index db30924..bf8c7d8 100644 --- a/resources/vue/mixins/MyCoursesMixin.js +++ b/resources/vue/mixins/MyCoursesMixin.js @@ -4,7 +4,7 @@ import { mapState, mapActions, mapGetters } from 'vuex'; import Navigation from '../components/my-courses/Navigation.vue'; import { $gettext } from "../../assets/javascripts/lib/gettext"; -function createMixin(minimal = false) { +function createMixin() { const result = { data () { return { @@ -63,159 +63,157 @@ function createMixin(minimal = false) { } }; - if (!minimal) { - result.components = { Navigation }; - - result.computed = { - ...result.computed, - - ...mapState('mycourses', [ - 'courses', - 'groups', - 'userid', - 'config', - ]), - ...mapGetters('mycourses', [ - 'isGroupOpen', - 'getConfig', - ]), - - numberOfNavElements () { - return Math.max( - ...Object.values(this.courses).map(course => { - const navigation = this.getNavigationForCourse(course, true); - return Object.values(navigation).length; - }) - ); - } - }; - - result.methods = { - ...result.methods, + result.components = { Navigation }; + + result.computed = { + ...result.computed, + + ...mapState('mycourses', [ + 'courses', + 'groups', + 'userid', + 'config', + ]), + ...mapGetters('mycourses', [ + 'isGroupOpen', + 'getConfig', + ]), + + numberOfNavElements () { + return Math.max( + ...Object.values(this.courses).map(course => { + const navigation = this.getNavigationForCourse(course, true); + return Object.values(navigation).length; + }) + ); + } + }; - ...mapActions('mycourses', [ - 'toggleOpenGroup', - 'updateConfigValue', - ]), + result.methods = { + ...result.methods, + + ...mapActions('mycourses', [ + 'toggleOpenGroup', + 'updateConfigValue', + ]), + + getActionMenuForCourse(course, withColorPicker = false) { + let menu = []; + + if (!course.is_studygroup) { + menu.push({ + url: this.urlFor(`dispatch.php/course/details/index/${course.id}`, {from: this.urlFor('dispatch.php/my_courses/index')}), + label: this.$gettext('Veranstaltungsdetails'), + icon: 'info-circle', + attributes: { + 'data-dialog': '', + }, + }); + } - getActionMenuForCourse(course, withColorPicker = false) { - let menu = []; + if (withColorPicker) { + // Color grouping + menu.push({ + emit: 'show-color-picker', + emitArguments: [course], + label: this.$gettext('Farbgruppierung ändern'), + icon: 'group4' + }); + } - if (!course.is_studygroup) { + // Extra navigation? + if (!course.is_group) { + if (course.extra_navigation) { + menu.push(course.extra_navigation); + } else if (course.admission_binding) { menu.push({ - url: this.urlFor(`dispatch.php/course/details/index/${course.id}`, {from: this.urlFor('dispatch.php/my_courses/index')}), - label: this.$gettext('Veranstaltungsdetails'), - icon: 'info-circle', + url: this.urlFor('dispatch.php/my_courses/decline_binding'), + label: this.$gettext('Aus der Veranstaltung austragen'), + icon: 'door-leave', attributes: { - 'data-dialog': '', + title: this.$gettext('Die Teilnahme ist bindend. Bitte wenden Sie sich an die Lehrenden.'), }, + disabled: true }); - } - - if (withColorPicker) { - // Color grouping + } else { menu.push({ - emit: 'show-color-picker', - emitArguments: [course], - label: this.$gettext('Farbgruppierung ändern'), - icon: 'group4' + url: this.urlFor(`dispatch.php/my_courses/decline/${course.id}`, {cmd: 'suppose_to_kill'}), + label: this.$gettext('Aus der Veranstaltung austragen'), + icon: 'door-leave' }); } + } - // Extra navigation? - if (!course.is_group) { - if (course.extra_navigation) { - menu.push(course.extra_navigation); - } else if (course.admission_binding) { - menu.push({ - url: this.urlFor('dispatch.php/my_courses/decline_binding'), - label: this.$gettext('Aus der Veranstaltung austragen'), - icon: 'door-leave', - attributes: { - title: this.$gettext('Die Teilnahme ist bindend. Bitte wenden Sie sich an die Lehrenden.'), - }, - disabled: true - }); - } else { - menu.push({ - url: this.urlFor(`dispatch.php/my_courses/decline/${course.id}`, {cmd: 'suppose_to_kill'}), - label: this.$gettext('Aus der Veranstaltung austragen'), - icon: 'door-leave' - }); - } - } + return menu; + }, + getHiddenTooltip(course) { + let infotext = this.$gettext('Versteckte Veranstaltungen können über die Suchfunktionen nicht gefunden werden.'); + infotext += ' '; + if (course.is_teacher && this.getConfig('allow_dozent_visibility')) { + infotext += this.$gettext('Um die Veranstaltung sichtbar zu machen, wählen Sie den Punkt "Sichtbarkeit" im Administrationsbereich der Veranstaltung.'); + } else { + infotext += this.$gettext('Um die Veranstaltung sichtbar zu machen, wenden Sie sich an Administrierende.'); + } + return infotext; + }, + getNavigationForCourse(course, gaps = false) { + let navigation = {}; - return menu; - }, - getHiddenTooltip(course) { - let infotext = this.$gettext('Versteckte Veranstaltungen können über die Suchfunktionen nicht gefunden werden.'); - infotext += ' '; - if (course.is_teacher && this.getConfig('allow_dozent_visibility')) { - infotext += this.$gettext('Um die Veranstaltung sichtbar zu machen, wählen Sie den Punkt "Sichtbarkeit" im Administrationsbereich der Veranstaltung.'); - } else { - infotext += this.$gettext('Um die Veranstaltung sichtbar zu machen, wenden Sie sich an Administrierende.'); + Object.entries(course.navigation).forEach(([key, nav]) => { + if (!nav && !gaps) { + return; } - return infotext; - }, - getNavigationForCourse(course, gaps = false) { - let navigation = {}; - Object.entries(course.navigation).forEach(([key, nav]) => { - if (!nav && !gaps) { - return; - } + if (this.getViewConfig('only_new') && !nav.important) { + return; + } - if (this.getViewConfig('only_new') && !nav.important) { - return; + let result = nav ? Object.assign({}, nav) : false; + if (nav) { + if (nav.important) { + result.class = 'my-courses-navigation-important'; + result.icon.role = 'attention'; + result.icon.shape = result.icon.shape.replace(/^new\//, ''); + } else { + result.class = false; + result.icon.role = 'clickable'; } - let result = nav ? Object.assign({}, nav) : false; - if (nav) { - if (nav.important) { - result.class = 'my-courses-navigation-important'; - result.icon.role = 'attention'; - result.icon.shape = result.icon.shape.replace(/^new\//, ''); - } else { - result.class = false; - result.icon.role = 'clickable'; - } - - result.url = this.urlFor('dispatch.php/course/go', { - to: course.id, - redirect_to: result.url, - }); - } + result.url = this.urlFor('dispatch.php/course/go', { + to: course.id, + redirect_to: result.url, + }); + } - navigation[key] = result; - }); + navigation[key] = result; + }); - return navigation; - }, - getViewConfig(key) { - return this.getConfig( - 'view_settings', - this.responsiveDisplay ? 'responsive' : 'regular', - key - ); - }, - isChild (course) { - return course.parent !== null && this.courses[course.parent] !== undefined; - }, - isParent (course) { - return course.children.length > 0 && course.children.every(childId => { - return this.courses[childId] !== undefined; - }); - }, - updateViewConfig(key, value) { - let config = this.getConfig('view_settings'); - config[this.responsiveDisplay ? 'responsive' : 'regular'][key] = value; - return this.updateConfigValue({ - key: 'view_settings', - value: config - }); - }, - }; - } + return navigation; + }, + getViewConfig(key) { + return this.getConfig( + 'view_settings', + this.responsiveDisplay ? 'responsive' : 'regular', + key + ); + }, + isChild (course) { + return course.parent !== null && this.courses[course.parent] !== undefined; + }, + isParent (course) { + return course.children.length > 0 && course.children.every(childId => { + return this.courses[childId] !== undefined; + }); + }, + updateViewConfig(key, value) { + let config = this.getConfig('view_settings'); + config[this.responsiveDisplay ? 'responsive' : 'regular'][key] = value; + return this.updateConfigValue({ + key: 'view_settings', + value: config + }); + }, + }; return result; } |
