initial commit (da)

This commit is contained in:
Raphael Dannecker 2020-09-03 21:25:42 +02:00
commit 634dceef57
26 changed files with 2592 additions and 0 deletions

34
amd/src/search.js Normal file
View file

@ -0,0 +1,34 @@
define([
'jquery','core/ajax','core/templates', 'core/notification'
], function($, ajax, templates, notification) {
function search_timetable(searchstring) {
//alert(searchstring);
var promises = ajax.call([
{ methodname: 'mod_timetable_search', args: { searchstring: searchstring } },
]);
promises[0].done(function(response) {
console.log('mod_timetable/search is' + response);
templates.render('mod_timetable/searchresult',{searchresults: response}).done(function(html, js) {
$('.searchresult').replaceWith(html);
templates.runTemplateJS(js);
}).fail(notification.exception);
}).fail(function(ex) {
// do something with the exception
});
}
return {
initialize: function () {
$(document).ready(function () {
//alert('Hi there');
$(".searchstring").keyup(function() {
search_timetable($(this).val());
});
});
}
};
});