Merge branch 'm36_MDL-63789_Search_SOLR_Fixes_Proxy_Auth' of https://github.com/scara...
[moodle.git] / blocks / recentlyaccessedcourses / amd / build / main.min.js
1 define(["jquery","core_course/repository","core/templates","core/notification","core/pubsub","core_course/events"],function(a,b,c,d,e,f){var g={COURSES_VIEW:'[data-region="recentlyaccessedcourses-view"]',COURSES_VIEW_CONTENT:'[data-region="recentlyaccessedcourses-view-content"]'},h=10,i=function(a,c){return b.getLastAccessedCourses(a,c)},j=function(a,b){if(b.length>0)return c.render("block_recentlyaccessedcourses/view-cards",{courses:b});var d=a.attr("data-nocoursesimgurl");return c.render("block_recentlyaccessedcourses/no-courses",{nocoursesimgurl:d})},k=function(a,b){var e=b.find(g.COURSES_VIEW),f=b.find(g.COURSES_VIEW_CONTENT),k=i(a,h);return k.then(function(a){var b=j(e,a);return b.then(function(a,b){return c.replaceNodeContents(f,a,b)})["catch"](d.exception),k})["catch"](d.exception)},l=function(a,b){e.subscribe(f.favourited,function(){k(a,b)}),e.subscribe(f.unfavorited,function(){k(a,b)})},m=function(b,c){c=a(c),l(b,c),k(b,c)};return{init:m}});