diff --git a/app/controllers/admin/courses.php b/app/controllers/admin/courses.php index db9c2d1ef409ce33ad92ed5409f211045bbb347b..bee38d19b352752d621bbc84451fc391f85dbf24 100644 --- a/app/controllers/admin/courses.php +++ b/app/controllers/admin/courses.php @@ -305,7 +305,7 @@ class Admin_CoursesController extends AuthenticatedController public function index_action() { $this->fields = $this->getViewFilters(); - $this->sortby = $GLOBALS['user']->cfg->MEINE_SEMINARE_SORT ?? 'name'; + $this->sortby = $GLOBALS['user']->cfg->MEINE_SEMINARE_SORT ?? (Config::get()->IMPORTANT_SEMNUMBER ? 'number' : 'name'); $this->sortflag = $GLOBALS['user']->cfg->MEINE_SEMINARE_SORT_FLAG ?? 'ASC'; $this->buildSidebar(); diff --git a/resources/vue/components/AdminCourses.vue b/resources/vue/components/AdminCourses.vue index 9c6e28c84b09f9a090db32ddf8a0c7d9f057a265..7d39345d038013ee502bad2556e468655834ce56 100644 --- a/resources/vue/components/AdminCourses.vue +++ b/resources/vue/components/AdminCourses.vue @@ -235,6 +235,16 @@ export default { if (sortby === 'last_activity') { sortFunction = (a, b) => a.last_activity_raw - b.last_activity_raw; + } else if (sortby === 'name') { + sortFunction = (a, b) => { + return collator.compare(striptags(a.name), striptags(b.name)) + || collator.compare(striptags(a.number), striptags(b.number)); + }; + } else if (sortby === 'number') { + sortFunction = (a, b) => { + return collator.compare(striptags(a.number), striptags(b.number)) + || collator.compare(striptags(a.name), striptags(b.name)); + }; } else { let is_numeric = true; for (let i in array) {