mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Handle 'choices' with radios on app_install.
This commit is contained in:
parent
97b6d59d90
commit
db9e70d34f
2 changed files with 23 additions and 1 deletions
12
js/app.js
12
js/app.js
|
@ -524,6 +524,18 @@ app = Sammy('#main', function (sam) {
|
||||||
$.each(appData.manifest.arguments.install, function(k, v) {
|
$.each(appData.manifest.arguments.install, function(k, v) {
|
||||||
appData.manifest.arguments.install[k].allowedValues = [];
|
appData.manifest.arguments.install[k].allowedValues = [];
|
||||||
|
|
||||||
|
// Radio button
|
||||||
|
if (typeof appData.manifest.arguments.install[k].choices !== 'undefined') {
|
||||||
|
// Update choices values with key and checked data
|
||||||
|
$.each(appData.manifest.arguments.install[k].choices, function(ck, cv){
|
||||||
|
appData.manifest.arguments.install[k].choices[ck] = {
|
||||||
|
value: cv,
|
||||||
|
key: ck,
|
||||||
|
checked: (cv == appData.manifest.arguments.install[k].default) ? true : false,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Special case for domain input.
|
// Special case for domain input.
|
||||||
// Display a list of available domains
|
// Display a list of available domains
|
||||||
if (v.name == 'domain') {
|
if (v.name == 'domain') {
|
||||||
|
|
|
@ -43,7 +43,17 @@
|
||||||
{{#allowedValues}}<option value="{{value}}">{{label}}</option>{{/allowedValues}}
|
{{#allowedValues}}<option value="{{value}}">{{label}}</option>{{/allowedValues}}
|
||||||
</select>
|
</select>
|
||||||
{{else}}
|
{{else}}
|
||||||
<input type="text" name="{{name}}" class="form-control" value="{{default}}" placeholder="{{example}}" required>
|
{{#if choices}}
|
||||||
|
{{#each choices}}
|
||||||
|
<div class="radio">
|
||||||
|
<label for="{{../name}}-{{key}}">
|
||||||
|
<input type="radio" id="{{../name}}-{{key}}" name="{{../name}}" value="{{value}}" {{#if checked}}checked{{/if}} required> {{value}}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{else}}
|
||||||
|
<input type="text" name="{{name}}" class="form-control" value="{{default}}" placeholder="{{example}}" required>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if help}}
|
{{#if help}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue