mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 07:10:41 +00:00
Add help tooltip for display object
This commit is contained in:
@@ -244,6 +244,7 @@
|
||||
"gamemode.spectator": "Spectator",
|
||||
"gamemode.survival": "Survival",
|
||||
"help.condition.time_period": "If present, time will be modulo-divided by this value. For example, if set to 24000, value will operate on a time period of days.",
|
||||
"help.display": "If present, advancement will be visible in the advancement tabs.",
|
||||
"help.entry.expand": "If false, entry will return all contents of tag, otherwise entry will behave as multiple item entries",
|
||||
"help.entry.type.alternatives": "Tests conditions of the child entries and executes the first that can run",
|
||||
"help.entry.type.dynamic": "Gets block specific drops",
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
"translate": "display",
|
||||
"type": "object",
|
||||
"collapse": true,
|
||||
"help": true,
|
||||
"color": "dark",
|
||||
"fields": [
|
||||
{
|
||||
|
||||
11
view.js
11
view.js
@@ -70,7 +70,9 @@ function generateSourceAndView(data, struct) {
|
||||
$('#structure').attr('data-index', 'pools');
|
||||
return generateTable(data, struct);
|
||||
} else {
|
||||
return generateObject(data, struct, false);
|
||||
let {out: sourceOut, component: $component} = generateObject(data, struct, false);
|
||||
$component.removeClass('mt-3');
|
||||
return {out: sourceOut, component: $component};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,9 +408,12 @@ function generateObject(data, struct, header) {
|
||||
}
|
||||
for (let field of struct.fields) {
|
||||
if (field.collapse) {
|
||||
let hasNoValue = data[field.id] === undefined
|
||||
let hasNoValue = data[field.id] === undefined;
|
||||
let arrowDirection = hasNoValue ? 'dropright' : 'dropdown'
|
||||
$body.append('<span class="' + arrowDirection + '"><button type="button" class="btn btn-light mt-3 dropdown-toggle" onclick="toggleCollapseObject(this)" data-index="' + field.id + '" data-i18n="' + field.translate + '"></button></span>');
|
||||
$body.append('<span class="mt-3 ' + arrowDirection + '"><button type="button" class="btn btn-light dropdown-toggle" onclick="toggleCollapseObject(this)" data-index="' + field.id + '" data-i18n="' + field.translate + '"></button></span>');
|
||||
if (field.help) {
|
||||
$body.find('span').append(generateTooltip(field.translate));
|
||||
}
|
||||
if (hasNoValue) {
|
||||
$body.append('<div/>');
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user