diff --git a/app/controllers/my_courses.php b/app/controllers/my_courses.php index da3210712532f70cdde2c3c560a77084c37365d3..3071e8c2405f1d606f8f094814e994a39d6a7398 100644 --- a/app/controllers/my_courses.php +++ b/app/controllers/my_courses.php @@ -192,9 +192,8 @@ class MyCoursesController extends AuthenticatedController 'allow_dozent_visibility' => Config::get()->ALLOW_DOZENT_VISIBILITY, 'open_groups' => $GLOBALS['user']->cfg->MY_COURSES_OPEN_GROUPS, 'sem_number' => Config::get()->IMPORTANT_SEMNUMBER, - 'allow_tiled_display' => Config::get()->MY_COURSES_ALLOW_TILED_DISPLAY, - 'display_type' => Config::get()->MY_COURSES_ALLOW_TILED_DISPLAY && $GLOBALS['user']->cfg->MY_COURSES_TILED_DISPLAY ? 'tiles' : 'tables', - 'responsive_type' => Config::get()->MY_COURSES_ALLOW_TILED_DISPLAY && $GLOBALS['user']->cfg->MY_COURSES_TILED_DISPLAY_RESPONSIVE ? 'tiles' : 'tables', + 'display_type' => $GLOBALS['user']->cfg->MY_COURSES_TILED_DISPLAY ? 'tiles' : 'tables', + 'responsive_type' => $GLOBALS['user']->cfg->MY_COURSES_TILED_DISPLAY_RESPONSIVE ? 'tiles' : 'tables', 'navigation_show_only_new' => $GLOBALS['user']->cfg->MY_COURSES_SHOW_NEW_ICONS_ONLY, 'group_by' => $this->getGroupField(), ], @@ -904,19 +903,16 @@ class MyCoursesController extends AuthenticatedController $this->setGroupingSelector($group_field); - if (Config::get()->MY_COURSES_ALLOW_TILED_DISPLAY) { - $views = $sidebar->addWidget(new ViewsWidget()); - $views->id = 'tiled-courses-sidebar-switch'; - $views->addLink( - _('Tabellarische Ansicht'), - '#' - )->setActive(!$GLOBALS['user']->cfg->MY_COURSES_TILED_DISPLAY); - $views->addLink( - _('Kachelansicht'), - '#' - )->setActive($GLOBALS['user']->cfg->MY_COURSES_TILED_DISPLAY); - - } + $views = $sidebar->addWidget(new ViewsWidget()); + $views->id = 'tiled-courses-sidebar-switch'; + $views->addLink( + _('Tabellarische Ansicht'), + '#tabular' + )->setActive(!$GLOBALS['user']->cfg->MY_COURSES_TILED_DISPLAY); + $views->addLink( + _('Kachelansicht'), + '#tiles' + )->setActive($GLOBALS['user']->cfg->MY_COURSES_TILED_DISPLAY); $options = $sidebar->addWidget(new OptionsWidget()); $options->id = 'tiled-courses-new-contents-toggle'; diff --git a/db/migrations/5.3.4_remove_allow_tiled_display_configuration.php b/db/migrations/5.3.4_remove_allow_tiled_display_configuration.php new file mode 100644 index 0000000000000000000000000000000000000000..6aa898a4ea6244e6f63ac82dd65874a03e1806c6 --- /dev/null +++ b/db/migrations/5.3.4_remove_allow_tiled_display_configuration.php @@ -0,0 +1,26 @@ +<?php +final class RemoveAllowTiledDisplayConfiguration extends Migration +{ + protected function up() + { + $query = "DELETE config, config_values + FROM `config` + LEFT JOIN `config_values` USING(`field`) + WHERE `field` = 'MY_COURSES_ALLOW_TILED_DISPLAY'"; + DBManager::get()->exec($query); + } + + protected function down() + { + $query = "INSERT IGNORE INTO `config` ( + `field`, `value`, `type`, `range`, + `section`, `description`, + `mkdate`, `chdate` + ) VALUES ( + 'MY_COURSES_ALLOW_TILED_DISPLAY', '0', 'boolean', 'global', + 'MeineVeranstaltungen', 'Soll die Kachelansicht unter \"Meine Veranstaltungen\" aktiviert werden?', + UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + )"; + DBManager::get()->exec($query); + } +} diff --git a/resources/vue/components/MyCourses.vue b/resources/vue/components/MyCourses.vue index c458f220b0a2aa1a82bee7af843d3fdf9d401f41..3e99ad79f794917dd0e415a09523fbe006fc984f 100644 --- a/resources/vue/components/MyCourses.vue +++ b/resources/vue/components/MyCourses.vue @@ -21,7 +21,7 @@ </studip-message-box> <component v-else :is="displayComponent" :icon-size="iconSize"></component> - <MountingPortal v-if="allowTiled" mount-to="#tiled-courses-sidebar-switch .sidebar-widget-content .widget-list" name="sidebar-switch"> + <MountingPortal mount-to="#tiled-courses-sidebar-switch .sidebar-widget-content .widget-list" name="sidebar-switch"> <my-courses-sidebar-switch></my-courses-sidebar-switch> </MountingPortal> @@ -49,9 +49,6 @@ export default { MyCoursesNewContentToggle, }, computed: { - allowTiled () { - return this.getConfig('allow_tiled_display'); - }, displayComponent () { return this.displayedType === 'tiles' ? MyCoursesTiles diff --git a/resources/vue/store/MyCoursesStore.js b/resources/vue/store/MyCoursesStore.js index a2aa2cd6ce274290bb0f499b8c3c2561a9076ce8..a0900404e44c289626f93590a0a9b64696a016ca 100644 --- a/resources/vue/store/MyCoursesStore.js +++ b/resources/vue/store/MyCoursesStore.js @@ -1,9 +1,4 @@ const configMapping = { - allow_tiled_display: value => { - return { - MY_COURSES_ALLOW_TILED_DISPLAY: value, - } - }, display_type: value => { return { MY_COURSES_TILED_DISPLAY: value === 'tiles',