Skip to content
Snippets Groups Projects
Commit f652829c authored by Ron Lucke's avatar Ron Lucke Committed by Jan-Hendrik Willms
Browse files

Biest #254

parent d0d03433
No related branches found
No related tags found
No related merge requests found
......@@ -189,6 +189,7 @@ 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',
'navigation_show_only_new' => $GLOBALS['user']->cfg->MY_COURSES_SHOW_NEW_ICONS_ONLY,
......@@ -763,28 +764,6 @@ class MyCoursesController extends AuthenticatedController
$this->redirect($this->url_for('my_courses'));
}
/**
* Changes a config setting for the current use
* @param string $config Config setting
* @param bool $state State of setting
*/
public function config_action($config, $state = null)
{
if ($config === 'tiled') {
if ($state === null) {
$state = !$GLOBALS['user']->cfg->MY_COURSES_TILED_DISPLAY;
}
$GLOBALS['user']->cfg->store('MY_COURSES_TILED_DISPLAY', (bool) $state);
} elseif ($config === 'new') {
if ($state === null) {
$state = !$GLOBALS['user']->cfg->MY_COURSES_SHOW_NEW_ICONS_ONLY;
}
$GLOBALS['user']->cfg->store('MY_COURSES_SHOW_NEW_ICONS_ONLY', (bool) $state);
}
$this->redirect('my_courses');
}
/**
* Get widget for grouping selected courses (e.g. by colors, ...)
* @param $action
......@@ -927,22 +906,23 @@ class MyCoursesController extends AuthenticatedController
$views->id = 'tiled-courses-sidebar-switch';
$views->addLink(
_('Tabellarische Ansicht'),
$this->config('tiled', 0)
'#'
)->setActive(!$GLOBALS['user']->cfg->MY_COURSES_TILED_DISPLAY);
$views->addLink(
_('Kachelansicht'),
$this->config('tiled', 1)
'#'
)->setActive($GLOBALS['user']->cfg->MY_COURSES_TILED_DISPLAY);
$options = $sidebar->addWidget(new OptionsWidget());
$options->id = 'tiled-courses-new-contents-toggle';
$options->addCheckbox(
_('Nur neue Inhalte anzeigen'),
$GLOBALS['user']->cfg->MY_COURSES_SHOW_NEW_ICONS_ONLY,
$this->config('new')
);
}
$options = $sidebar->addWidget(new OptionsWidget());
$options->id = 'tiled-courses-new-contents-toggle';
$options->addCheckbox(
_('Nur neue Inhalte anzeigen'),
$GLOBALS['user']->cfg->MY_COURSES_SHOW_NEW_ICONS_ONLY,
'#'
);
$export_widget = $sidebar->addWidget(new ExportWidget());
$export_widget->addLink(
_('Veranstaltungsübersicht exportieren'),
......
......@@ -21,7 +21,7 @@
</studip-message-box>
<component v-else :is="displayComponent" :icon-size="iconSize"></component>
<MountingPortal mount-to="#tiled-courses-sidebar-switch .sidebar-widget-content .widget-list" name="sidebar-switch">
<MountingPortal v-if="allowTiled" mount-to="#tiled-courses-sidebar-switch .sidebar-widget-content .widget-list" name="sidebar-switch">
<my-courses-sidebar-switch></my-courses-sidebar-switch>
</MountingPortal>
......@@ -49,6 +49,9 @@ export default {
MyCoursesNewContentToggle,
},
computed: {
allowTiled () {
return this.getConfig('allow_tiled_display');
},
displayComponent () {
return this.displayedType === 'tiles'
? MyCoursesTiles
......
......@@ -166,9 +166,7 @@ export default {
created () {
this.responsiveDisplay = Responsive.media_query.matches;
Responsive.media_query.addListener(() => {
console.log('changing responsive display', Responsive.media_query.matches);
this.responsiveDisplay = Responsive.media_query.matches;
console.log('changed responsive display', this.responsiveDisplay);
})
}
}
const configMapping = {
allow_tiled_display: value => {
return {
MY_COURSES_ALLOW_TILED_DISPLAY: value,
}
},
display_type: value => {
return {
MY_COURSES_TILED_DISPLAY: value === 'tiles',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment