diff --git a/src/css/style.less b/src/css/style.less index ef07bf21..201309b9 100644 --- a/src/css/style.less +++ b/src/css/style.less @@ -633,6 +633,17 @@ input[type='radio'].nice-radio { margin-top: -5px; } +.auto-width { + width: auto; +} + +.input-hidden { + display: none; +} + +.alert-debug { + background-color: white; +} .app-card .panel-body { padding: 1.5rem; diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index 1afd4678..26630ddc 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -272,6 +272,11 @@ // Get app config panel app.get('#/apps/:app/config-panel', function (c) { 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); }); }); @@ -318,7 +323,7 @@ args[k].inputType = 'text'; 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" || v.optional == true)) ? '' : 'required'; args[k].attributes = ""; args[k].helpText = ""; args[k].helpLink = ""; diff --git a/src/js/yunohost/filters.js b/src/js/yunohost/filters.js index 043d7d14..0b793580 100644 --- a/src/js/yunohost/filters.js +++ b/src/js/yunohost/filters.js @@ -30,6 +30,8 @@ app.before(/apps\/install\//, prefetchUsers); app.before(/apps\/\w+\/actions/, prefetchUsers); 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) { diff --git a/src/views/app/app_config-panel.ms b/src/views/app/app_config-panel.ms index 3d00f64c..61035438 100644 --- a/src/views/app/app_config-panel.ms +++ b/src/views/app/app_config-panel.ms @@ -16,6 +16,7 @@ {{#config_panel}}

{{../app_name}} configuration panel


+
{{#panel}}
- {{#sections}}

{{name}} {{help}}

-
    {{#options}} -
    - +
    + +
    - {{#if (in type "number" "text" "password" "color" "date" "datetime-local" "email" "month number" "range" "search" "tel" "time" "url" "week")}} - - {{ help }} - {{else if (eq type "bool")}} - yes - no - {{ help }} - {{/if}} + + {{#if choices}} + + {{else if (eq inputType "checkbox")}} + + {{else}} + + {{/if}} + + {{#if helpLink}} + {{{helpLink}}} + {{/if}} + + {{#if example}} + {{t 'form_input_example' example}} + {{/if}} + + {{#if helpText}} + {{{helpText}}} + {{/if}}
    {{/options}} -
-
{{/sections}} -
-
-
{{/panel}} +
+
+ {{/config_panel}}