mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
63a410cb04
* Example JSON Form Example with General setting I have created a new Category "General" with several Settings for Hyperion. For now the Submit Button only console.log's the values. Known Bug: For some reason it seems to do not load the bootstrap correctly or maybe the Lib isn't compatible with the newest version of bootstrap. * Translationsupport for JSON Forms * Hotfix * Added Bootstrap Switches for all checkboxes All checkboxes will be converted to Switches
23 lines
807 B
JavaScript
23 lines
807 B
JavaScript
|
|
/**
|
|
* Enables translation for the form
|
|
* with the ID given in "formID"
|
|
* Generates token with the given token prefix
|
|
* and an underscore followed by the input id
|
|
* Example: input id = input_one
|
|
* token prefix = tokenprefix
|
|
* The translation token would be: "tokenprefix_input_one"
|
|
* Default language in "lang" attribute will always be "en"
|
|
* @param {String} tokenPrefix
|
|
* @param {String} formID
|
|
*/
|
|
function enableFormTranslation(tokenPrefix, formID) {
|
|
var $inputs = $("#" + formID + " :input");
|
|
|
|
$inputs.each(function() {
|
|
console.log("InputID: " + $(this).attr('id'));
|
|
var oldtext = $("label[for='" + $(this).attr('id') + "']").text();
|
|
$("label[for='" + $(this).attr('id') + "']").html('<span lang="en" data-lang-token="' + tokenPrefix + "_" + $(this).attr('id') + '">' + oldtext + '</span>');
|
|
});
|
|
}
|