mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
[enh] Allow key/value choices in manifest arguments.
This commit is contained in:
parent
3d1d5c302f
commit
0ed417b85e
1 changed files with 13 additions and 5 deletions
|
@ -104,13 +104,21 @@
|
||||||
// Input with choices becomes select list
|
// Input with choices becomes select list
|
||||||
if (typeof data.manifest.arguments.install[k].choices !== 'undefined') {
|
if (typeof data.manifest.arguments.install[k].choices !== 'undefined') {
|
||||||
// Update choices values with key and checked data
|
// Update choices values with key and checked data
|
||||||
|
var choices = []
|
||||||
$.each(data.manifest.arguments.install[k].choices, function(ck, cv){
|
$.each(data.manifest.arguments.install[k].choices, function(ck, cv){
|
||||||
data.manifest.arguments.install[k].choices[ck] = {
|
// Non key/value choices have numeric key, that we don't want.
|
||||||
value: cv,
|
if (typeof ck == "number") {
|
||||||
|
// Key is Value in this case.
|
||||||
|
ck = cv;
|
||||||
|
}
|
||||||
|
|
||||||
|
choices.push({
|
||||||
|
value: ck,
|
||||||
label: cv,
|
label: cv,
|
||||||
selected: (cv == data.manifest.arguments.install[k].default) ? true : false,
|
selected: (ck == data.manifest.arguments.install[k].default) ? true : false,
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
data.manifest.arguments.install[k].choices = choices;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special case for domain input.
|
// Special case for domain input.
|
||||||
|
|
Loading…
Add table
Reference in a new issue