initial commit (da)
This commit is contained in:
commit
634dceef57
26 changed files with 2592 additions and 0 deletions
1
amd/build/search.min.js
vendored
Normal file
1
amd/build/search.min.js
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
define(["jquery","core/ajax","core/templates","core/notification"],function($,ajax,templates,notification){function search_timetable(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){})}function load_timetable(type,name){var promises=ajax.call([{methodname:"mod_timetable_get",args:{type:type,name:name,week:0}}]);promises[0].done(function(response){console.log("mod_timetable/get is"+response);templates.render("mod_timetable/timetable",{get:response}).done(function(html,js){$(".timetable").replaceWith(html);templates.runTemplateJS(js)}).fail(notification.exception)}).fail(function(ex){})}return{initialize:function(){$(document).ready(function(){$(".searchstring").keyup(function(){search_timetable($(this).val())});$(".searchresults").click(function(){load_timetable("teacher","Da")})})}}});
|
||||
34
amd/src/search.js
Normal file
34
amd/src/search.js
Normal 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());
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue