Merge pull request #234 from YunoHost/display_text

[enh] support display_text
This commit is contained in:
Alexandre Aubin 2019-04-02 02:22:34 +02:00 committed by GitHub
commit 46e6ccf74e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -339,12 +339,12 @@
args[k].type = (typeof v.type !== 'undefined') ? v.type : 'string'; args[k].type = (typeof v.type !== 'undefined') ? v.type : 'string';
args[k].inputType = 'text'; args[k].inputType = 'text';
args[k].isPassword = false; args[k].isPassword = false;
args[k].isDisplayText = false;
args[k].required = (typeof v.optional !== 'undefined' && v.optional == "true") ? '' : 'required'; args[k].required = (typeof v.optional !== 'undefined' && v.optional == "true") ? '' : 'required';
args[k].attributes = ""; args[k].attributes = "";
args[k].helpText = ""; args[k].helpText = "";
args[k].helpLink = ""; args[k].helpLink = "";
// Multilingual label // Multilingual label
args[k].label = (typeof args[k].ask[y18n.locale] !== 'undefined') ? args[k].label = (typeof args[k].ask[y18n.locale] !== 'undefined') ?
args[k].ask[y18n.locale] : args[k].ask[y18n.locale] :
@ -460,6 +460,11 @@
args[k].isPassword = true; args[k].isPassword = true;
} }
if (args[k].type == "display_text") {
args[k].isDisplayText = true;
args[k].label = args[k].label.split("\n");
}
}); });
} }

View file

@ -39,6 +39,13 @@
</div> </div>
{{#manifest.arguments.install}} {{#manifest.arguments.install}}
<div class="form-group"> <div class="form-group">
{{#if isDisplayText}}
<div class="col-sm-12">
{{#label}}
<p>{{.}}</p>
{{/label}}
</div>
{{else}}
<label for="{{name}}" class="col-sm-12">{{label}}</label> <label for="{{name}}" class="col-sm-12">{{label}}</label>
@ -68,6 +75,7 @@
{{/if}} {{/if}}
</div> </div>
{{/if}}
</div> </div>
{{/manifest.arguments.install}} {{/manifest.arguments.install}}
<hr> <hr>