initial commit (da)
This commit is contained in:
commit
634dceef57
26 changed files with 2592 additions and 0 deletions
50
templates/searchresult.mustache
Normal file
50
templates/searchresult.mustache
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<div class="searchresult">
|
||||
<ul>
|
||||
{{#searchresults}}
|
||||
<li><a href="javascript:;" class="searchresults" data-type="{{type}}" data-name="{{name}}" data-add="0">{{description}}</a> <a href="javascript:;" class="searchresults" data-type="{{type}}" data-name="{{name}}" data-add="1">+</a></li>
|
||||
{{/searchresults}}
|
||||
</ul>
|
||||
{{^searchresults}}Keine Treffer{{/searchresults}}
|
||||
</div>
|
||||
{{# js }}
|
||||
require([
|
||||
'jquery','core/ajax','core/templates', 'core/notification'
|
||||
] , function($, ajax, templates, notification) {
|
||||
|
||||
|
||||
function load_timetable(type, name, add) {
|
||||
//alert(searchstring);
|
||||
var promises = ajax.call([
|
||||
{ methodname: 'mod_timetable_get', args: { type: type, name: name, week: 0 } },
|
||||
]);
|
||||
|
||||
if (add=='1') {
|
||||
promises[0].done(function(response) {
|
||||
console.log('mod_timetable/get is' + response);
|
||||
templates.render('mod_timetable/timetable',response).done(function(html, js) {
|
||||
$('.timetable').last().after(html);
|
||||
templates.runTemplateJS(js);
|
||||
}).fail(notification.exception);
|
||||
}).fail(function(ex) {
|
||||
// do something with the exception
|
||||
});
|
||||
} else {
|
||||
promises[0].done(function(response) {
|
||||
console.log('mod_timetable/get is' + response);
|
||||
templates.render('mod_timetable/timetable',response).done(function(html, js) {
|
||||
$('.timetable').first().replaceWith(html);
|
||||
templates.runTemplateJS(js);
|
||||
}).fail(notification.exception);
|
||||
}).fail(function(ex) {
|
||||
// do something with the exception
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(".searchresults").click(function() {
|
||||
load_timetable($(event.target).data('type'),$(event.target).data('name'),$(event.target).data('add'));
|
||||
});
|
||||
});
|
||||
{{/ js }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue