Add home menu

This commit is contained in:
Misode
2019-12-29 18:30:34 +01:00
parent cab0885fc0
commit 303205aea9
10 changed files with 87 additions and 178 deletions

View File

@@ -23,6 +23,10 @@ function initLng() {
function changeLng(code) {
i18next.changeLanguage(code).then(() => {
updateView()
if ('listeners' in window) {
listeners.forEach(l => l());
} else {
$('html').localize();
}
})
}

View File

@@ -24,6 +24,7 @@ function addListener(listener) {
loadGenerator($('[data-generator]').attr('data-generator'));
function loadGenerator(generator) {
if (!generator) return;
const versions = generators[generator] || [];
versions.forEach(v => {
$('#versionList').append(`<a class="dropdown-item" onclick="changeVersion('${v}')">${v}</a>`)
@@ -37,6 +38,7 @@ function loadGenerator(generator) {
function loadVersion(generator, version) {
return $.getJSON('../schemas/' + version + '.json', json => {
structure = json.roots.find(e => e.id === generator);
table = structure.default;
components = json.components;
collections = json.collections;
}).fail((jqXHR, textStatus, errorThrown) => {

View File

@@ -7,6 +7,7 @@ addListener(updateView);
changeTheme(localStorage.getItem('theme'))
function changeTheme(theme) {
console.log(theme);
if (theme === null) {
theme = 'light';
}