mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Merge pull request #251 from YunoHost/config-panel-ynh-arguments
Config panel ynh arguments
This commit is contained in:
commit
6109a1cf6c
4 changed files with 48 additions and 18 deletions
|
@ -633,6 +633,17 @@ input[type='radio'].nice-radio {
|
||||||
margin-top: -5px;
|
margin-top: -5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.auto-width {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-debug {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
.app-card .panel-body {
|
.app-card .panel-body {
|
||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
|
|
|
@ -272,6 +272,11 @@
|
||||||
// Get app config panel
|
// Get app config panel
|
||||||
app.get('#/apps/:app/config-panel', function (c) {
|
app.get('#/apps/:app/config-panel', function (c) {
|
||||||
c.api('/apps/'+c.params['app']+'/config-panel', function(data) {
|
c.api('/apps/'+c.params['app']+'/config-panel', function(data) {
|
||||||
|
$.each(data.config_panel.panel, function(_, panel) {
|
||||||
|
$.each(panel.sections, function(_, section) {
|
||||||
|
formatYunoHostStyleArguments(section.options, c.params);
|
||||||
|
});
|
||||||
|
});
|
||||||
c.view('app/app_config-panel', data);
|
c.view('app/app_config-panel', data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -318,7 +323,7 @@
|
||||||
args[k].inputType = 'text';
|
args[k].inputType = 'text';
|
||||||
args[k].isPassword = false;
|
args[k].isPassword = false;
|
||||||
args[k].isDisplayText = 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" || v.optional == true)) ? '' : 'required';
|
||||||
args[k].attributes = "";
|
args[k].attributes = "";
|
||||||
args[k].helpText = "";
|
args[k].helpText = "";
|
||||||
args[k].helpLink = "";
|
args[k].helpLink = "";
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
app.before(/apps\/install\//, prefetchUsers);
|
app.before(/apps\/install\//, prefetchUsers);
|
||||||
app.before(/apps\/\w+\/actions/, prefetchUsers);
|
app.before(/apps\/\w+\/actions/, prefetchUsers);
|
||||||
app.before(/apps\/\w+\/actions/, prefetchDomains);
|
app.before(/apps\/\w+\/actions/, prefetchDomains);
|
||||||
|
app.before(/apps\/\w+\/config-panel/, prefetchUsers);
|
||||||
|
app.before(/apps\/\w+\/config-panel/, prefetchDomains);
|
||||||
|
|
||||||
|
|
||||||
app.before({except: {path: ['#/logout', '#/login', '#/postinstall', '#/postinstall/domain', '#/postinstall/password']}}, function (req) {
|
app.before({except: {path: ['#/logout', '#/login', '#/postinstall', '#/postinstall/domain', '#/postinstall/password']}}, function (req) {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
{{#config_panel}}
|
{{#config_panel}}
|
||||||
<h2>{{../app_name}} configuration panel</h2>
|
<h2>{{../app_name}} configuration panel</h2>
|
||||||
<hr>
|
<hr>
|
||||||
|
<form class="form-horizontal" action="#/apps/{{../app_id}}/config" method="POST">
|
||||||
{{#panel}}
|
{{#panel}}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading" role="tab" id="heading-{{ @index }}">
|
<div class="panel-heading" role="tab" id="heading-{{ @index }}">
|
||||||
|
@ -28,40 +29,51 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="collapse-{{ @index }}" class="panel-collapse collapse {{#if (eq @index 0)}}in{{/if}}" role="tabpanel" aria-labelledby="heading-{{ @index }}">
|
<div id="collapse-{{ @index }}" class="panel-collapse collapse {{#if (eq @index 0)}}in{{/if}}" role="tabpanel" aria-labelledby="heading-{{ @index }}">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form class="form-horizontal" action="#/apps/{{../../app_id}}/config" method="POST">
|
|
||||||
{{#sections}}
|
{{#sections}}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading"><h3 class="panel-title">{{name}} <small>{{help}}</small></h3></div>
|
<div class="panel-heading"><h3 class="panel-title">{{name}} <small>{{help}}</small></h3></div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<ul>
|
|
||||||
{{#options}}
|
{{#options}}
|
||||||
<div class="form-group">
|
<div class="form-group input-{{inputType}}">
|
||||||
<label for="{{id}}" class="col-sm-2 control-label">{{name}}</label>
|
<label for="{{name}}" class="col-sm-2 control-label">{{label}}</label>
|
||||||
|
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
{{#if (in type "number" "text" "password" "color" "date" "datetime-local" "email" "month number" "range" "search" "tel" "time" "url" "week")}}
|
|
||||||
<input type="number" class="form-control" id="{{id}}" name="{{id}}" placeholder="{{placeholder}}">
|
{{#if choices}}
|
||||||
<span class="help-block">{{ help }}</span>
|
<select id="{{name}}" name="{{name}}" required class="form-control" {{{attributes}}}>
|
||||||
{{else if (eq type "bool")}}
|
{{#choices}}<option value="{{value}}" {{#if selected}}selected{{/if}}>{{label}}</option>{{/choices}}
|
||||||
<input type="radio" name="{{id}}" value="true" {{#if value}}checked{{/if}}> yes
|
</select>
|
||||||
<input type="radio" name="{{id}}" value="false"{{#if (eq value false)}}checked{{/if}}> no
|
{{else if (eq inputType "checkbox")}}
|
||||||
<span class="help-block">{{ help }}</span>
|
<input type="{{inputType}}" id="{{name}}" name="{{name}}" class="form-control auto-width" value="{{default}}" placeholder="{{example}}" {{required}} {{{attributes}}}>
|
||||||
{{/if}}
|
{{else}}
|
||||||
|
<input type="{{inputType}}" id="{{name}}" name="{{name}}" class="form-control" value="{{default}}" placeholder="{{example}}" {{required}} {{{attributes}}}>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if helpLink}}
|
||||||
|
<span class="help-block help-block--link">{{{helpLink}}}</span>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if example}}
|
||||||
|
<span class="help-block help-block--example">{{t 'form_input_example' example}}</span>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if helpText}}
|
||||||
|
<span class="help-block">{{{helpText}}}</span>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/options}}
|
{{/options}}
|
||||||
</ul></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/sections}}
|
{{/sections}}
|
||||||
|
|
||||||
<br>
|
|
||||||
<div><button class="btn btn-primary" type="submit">Save</button></div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/panel}}
|
{{/panel}}
|
||||||
|
<br>
|
||||||
|
<div><button class="btn btn-primary" type="submit">Save</button></div>
|
||||||
|
</form>
|
||||||
{{/config_panel}}
|
{{/config_panel}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue