Preload quiz.index template on pages.home quizs loading

This commit is contained in:
Niko 2022-02-23 10:49:56 +01:00
parent 5cff51596e
commit d00803e90f
2 changed files with 2 additions and 1 deletions

View File

@ -35,6 +35,7 @@ app.template = {
return app.template.get(name) !== undefined;
},
load: function(name, cback) {
cback = cback || function() {};
file = app.vars.js_dir + '/templates/' +
name.replaceAll('.', '/') + '.html';
if (app.template.get(name) !== undefined)

View File

@ -10,6 +10,7 @@ app.pages.home = {
await app.template.loadMany(['home.quiz_item']);
app.pages.home.data.quizs = json;
app.pages.home.paint('quizs', json);
app.template.load('quiz.index');
});
});
},
@ -37,7 +38,6 @@ app.pages.home = {
const item = data[i];
var tpl = app.template.fill(item, app.template.get('home.quiz_item'),
function(k,v) {
console.log(v);
if (k === 'from.name') return app.emoji.expand(capitalize(v));
});
if (item.responses === undefined)