MDL-64438 block_recentlyaccessedcourses: Optionally show course category
[moodle.git] / blocks / recentlyaccessedcourses / amd / src / main.js
index 6a3ca16..ca3186b 100644 (file)
@@ -47,6 +47,7 @@ define(
         // Constants.
         var NUM_COURSES_TOTAL = 10;
         var SELECTORS = {
+            BLOCK_CONTAINER: '[data-region="recentlyaccessedcourses"]',
             CARD_CONTAINER: '[data-region="card-deck"]',
             COURSE_IS_FAVOURITE: '[data-region="is-favourite"]',
             CONTENT: '[data-region="view-content"]',
@@ -145,7 +146,9 @@ define(
          * @return {promise} Resolved with list of rendered courses as jQuery objects.
          */
         var renderAllCourses = function(courses) {
+            var showcoursecategory = $(SELECTORS.BLOCK_CONTAINER).data('displaycoursecategory');
             var promises = courses.map(function(course) {
+                course.showcoursecategory = showcoursecategory;
                 return Templates.render('block_recentlyaccessedcourses/course-card', course);
             });