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
|
@ -103,14 +103,22 @@
|
|||
|
||||
// Input with choices becomes select list
|
||||
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){
|
||||
data.manifest.arguments.install[k].choices[ck] = {
|
||||
value: cv,
|
||||
// Non key/value choices have numeric key, that we don't want.
|
||||
if (typeof ck == "number") {
|
||||
// Key is Value in this case.
|
||||
ck = cv;
|
||||
}
|
||||
|
||||
choices.push({
|
||||
value: ck,
|
||||
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.
|
||||
|
|
Loading…
Add table
Reference in a new issue