diff --git a/www/core/components/courses/controllers/coursecategories.js b/www/core/components/courses/controllers/coursecategories.js index 62c37762224..dbb433de5d0 100644 --- a/www/core/components/courses/controllers/coursecategories.js +++ b/www/core/components/courses/controllers/coursecategories.js @@ -21,7 +21,7 @@ angular.module('mm.core.courses') * @ngdoc controller * @name mmCourseCategoriesCtrl */ -.controller('mmCourseCategoriesCtrl', function($scope, $stateParams, $mmCourses, $mmUtil, $q, $state, $mmSite) { +.controller('mmCourseCategoriesCtrl', function($scope, $stateParams, $mmCourses, $mmUtil, $q, $mmSite) { var categoryId = $stateParams.categoryid || 0; diff --git a/www/core/components/courses/services/courses.js b/www/core/components/courses/services/courses.js index 50d1e216270..ec0ec9d10c0 100644 --- a/www/core/components/courses/services/courses.js +++ b/www/core/components/courses/services/courses.js @@ -307,7 +307,25 @@ angular.module('mm.core.courses') }; return site.read('core_course_get_courses_by_field', data, preSets).then(function(courses) { - return courses.courses || $q.reject(); + if (courses.courses) { + // Courses will be sorted using sortorder if avalaible. + return courses.courses.sort(function(a, b) { + if (typeof a.sortorder == "undefined" && typeof b.sortorder == "undefined") { + return b.id - a.id; + } + + if (typeof a.sortorder == "undefined") { + return 1; + } + + if (typeof b.sortorder == "undefined") { + return -1; + } + + return b.sortorder - a.sortorder; + }); + } + return $q.reject(); }); }); }; diff --git a/www/core/components/courses/templates/courselistitem.html b/www/core/components/courses/templates/courselistitem.html index c14014b2342..2984da57d2b 100644 --- a/www/core/components/courses/templates/courselistitem.html +++ b/www/core/components/courses/templates/courselistitem.html @@ -1,4 +1,4 @@ - +

{{course.fullname}}

diff --git a/www/core/scss/styles.scss b/www/core/scss/styles.scss index e314d6c0f4c..7a9cc75554a 100644 --- a/www/core/scss/styles.scss +++ b/www/core/scss/styles.scss @@ -265,6 +265,9 @@ p.item-text-wrap { .item.item-disabled, .platform-android .item.item-disabled { color: $item-disabled-color; + h2 { + color: $item-disabled-color; + } } // Avoid adding too much padding.