mirror of
https://gitlab.com/comenius-institut/foerbico/metadata-form.git
synced 2025-12-09 16:24:30 +00:00
use destatis subjects
This commit is contained in:
parent
137e73af5c
commit
45d3904f95
5 changed files with 1055 additions and 54 deletions
|
|
@ -193,58 +193,14 @@
|
|||
<label for="inputSourceOrganization" class="col-sm-2 col-form-label" data-i18n="LABEL_ORGANIZATION">Institution</label>
|
||||
<div class="col-sm-10">
|
||||
<select data-style="input-dropdown" data-width="100%" class="selectpicker" id="inputSourceOrganization" data-live-search="true">
|
||||
<option value="" selected data-i18n="LABEL_CHOOSE">Wähle ...</option>
|
||||
<option value="" data-i18n="LABEL_CHOOSE" selected>Wähle ...</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputDescrition" class="col-sm-2 col-form-label">Schulart</label>
|
||||
<label for="inputSubjectOf" class="col-sm-2 col-form-label" data-i18n="LABEL_SUBJECT">Fach</label>
|
||||
<div class="col-sm-10">
|
||||
<select style="background: #F1F6DF; color: #0A1F40;" class="custom-select" id="schooltype">
|
||||
<option selected>Wähle ...</option>
|
||||
<option value="HS">Hochschule</option>
|
||||
<option value="GS">Grundschule</option>
|
||||
<option value="GY">Gymnasium</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputSubjectOf" class="col-sm-2 col-form-label">Fach</label>
|
||||
<div class="col-sm-10">
|
||||
<select style="background-color: #F1F6DF; color: #0A1F40;" class="selectpicker" id="inputSubjectOf"
|
||||
data-live-search="true">
|
||||
<option selected>Wähle ...</option>
|
||||
<optgroup label="Hochschule">
|
||||
<option data-tokens="ba">Bauingenieurwesen</option>
|
||||
<option data-tokens="ma">Medizin</option>
|
||||
<option data-tokens="ph">Betriebswirtschaft</option>
|
||||
</optgroup>
|
||||
<optgroup label="Gymnasium">
|
||||
<option data-tokens="ma">Mathematik</option>
|
||||
<option data-tokens="ph">Physik</option>
|
||||
<option data-tokens="ba">Erdkunde</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputDescrition" class="col-sm-2 col-form-label">Gebiet</label>
|
||||
<div class="col-sm-10">
|
||||
<select style="background-color: #F1F6DF; color: #0A1F40;" class="selectpicker" data-live-search="true">
|
||||
<option selected>Wähle ...</option>
|
||||
<optgroup label="Bauingenieurwesen">
|
||||
<option data-tokens="ek">Verkehr</option>
|
||||
<option data-tokens="ma">Mathematik</option>
|
||||
<option data-tokens="ph">Mechanik</option>
|
||||
<option data-tokens="ek">Statik</option>
|
||||
<option data-tokens="ek">Holzbau</option>
|
||||
</optgroup>
|
||||
<optgroup label="Mathematik">
|
||||
<option data-tokens="ma">Geometrie</option>
|
||||
<option data-tokens="ph">Zahlensysteme</option>
|
||||
<option data-tokens="ek">Gleichungssysteme</option>
|
||||
<option data-tokens="ek">Stochastik</option>
|
||||
</optgroup>
|
||||
<select data-style="input-dropdown" data-width="100%" class="selectpicker" id="inputSubjectOf" data-live-search="true" data-i18n-title="LABEL_CHOOSE" multiple>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -265,10 +221,14 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
loadVocabs()
|
||||
chooseLicense()
|
||||
addCreator()
|
||||
i18nLoader()
|
||||
init();
|
||||
|
||||
async function init() {
|
||||
await loadVocabs();
|
||||
await i18nLoader();
|
||||
chooseLicense();
|
||||
addCreator();
|
||||
}
|
||||
|
||||
function loadVocabs() {
|
||||
$(document).ready(function () {
|
||||
|
|
@ -287,6 +247,11 @@
|
|||
$("#inputSourceOrganization").append('<option value="' + item["ror"] + '">' + item["label"] + '</option>');
|
||||
});
|
||||
});
|
||||
$.getJSON("vocabs/subject.json", function (result) {
|
||||
$.each(result, function (i, item) {
|
||||
$("#inputSubjectOf").append('<option value="' + item + '" data-i18n="' + item + '"></option>');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -499,6 +464,7 @@
|
|||
|
||||
function generate() {
|
||||
const inputSourceOrganization = document.getElementById("inputSourceOrganization");
|
||||
const selectedSubjects = $('#inputSubjectOf').val();
|
||||
var meta = "---\n"
|
||||
meta += "name: \"" + document.getElementById("inputTitle").value + "\"\n"
|
||||
meta += "creator:\n"
|
||||
|
|
@ -515,8 +481,9 @@
|
|||
meta += " id: \"" + inputSourceOrganization.value + "\"\n"
|
||||
meta += " type: \"Organization\"\n"
|
||||
}
|
||||
meta += "subjectOf: \"" + document.getElementById("inputSubjectOf").value + "\"\n"
|
||||
meta += "version: 1.0\n"
|
||||
if (selectedSubjects.length > 0) {
|
||||
meta += "about:\n" + selectedSubjects.map((s) => " - id: \"" + s + "\"").join("\n") + "\n"
|
||||
}
|
||||
meta += "license: \"" + document.getElementById("licenseUrl").value + "\"\n"
|
||||
meta += "thumbnailUrl: http://placehold.it/100x100\n"
|
||||
meta += "learningResourceType: \"" + document.getElementById("inputResourceType").value + "\"\n"
|
||||
|
|
@ -534,8 +501,11 @@
|
|||
const languageLabels = await Promise.all(
|
||||
langs.map((l) => fetch("i18n/language-" + l + ".json").then((r) => r.json()))
|
||||
);
|
||||
const subjectLabels = await Promise.all(
|
||||
langs.map((l) => fetch("i18n/subject-" + l + ".json").then((r) => r.json()))
|
||||
);
|
||||
const res = langs.reduce((acc, l, idx) => {
|
||||
acc[l] = {translation: {...jsons[idx], ...hcrt[idx], ...languageLabels[idx]}};
|
||||
acc[l] = {translation: {...jsons[idx], ...hcrt[idx], ...languageLabels[idx], ...subjectLabels[idx]}};
|
||||
return acc;
|
||||
}, {});
|
||||
await i18next.init({
|
||||
|
|
@ -567,6 +537,10 @@
|
|||
const k = element.getAttribute("data-i18n-placeholder");
|
||||
element.setAttribute("placeholder", i18next.t(k));
|
||||
}
|
||||
$("[data-i18n-title]").each( function () {
|
||||
const k = $(this).attr("data-i18n-title")
|
||||
$(this).selectpicker({title: i18next.t(k)}).selectpicker('render');
|
||||
})
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue