diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-11-08 00:02:59 +0000 |
---|---|---|
committer | Robin McCorkell <rmccorkell@owncloud.com> | 2015-11-08 00:02:59 +0000 |
commit | 6959d5ca225540bb2249e92aaccc52326f71e631 (patch) | |
tree | 5f576b3bfa1e587c5d8308507473ddceb108ab89 /settings/js/admin.js | |
parent | 49122e66dd442dbafaad145b1f320650773b2861 (diff) | |
download | nextcloud-server-6959d5ca225540bb2249e92aaccc52326f71e631.tar.gz nextcloud-server-6959d5ca225540bb2249e92aaccc52326f71e631.zip |
Properly detect setup check messages set in the HTML template
Diffstat (limited to 'settings/js/admin.js')
-rw-r--r-- | settings/js/admin.js | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/settings/js/admin.js b/settings/js/admin.js index 9f7133c6571..eb3b756bf0f 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -174,38 +174,46 @@ $(document).ready(function(){ var messages = [].concat(check1, check2, check3); var $el = $('#postsetupchecks'); $el.find('.loading').addClass('hidden'); - if (messages.length === 0) { + + var hasMessages = false; + var $errorsEl = $el.find('.errors'); + var $warningsEl = $el.find('.warnings'); + var $infoEl = $el.find('.info'); + + for (var i = 0; i < messages.length; i++ ) { + switch(messages[i].type) { + case OC.SetupChecks.MESSAGE_TYPE_INFO: + $infoEl.append('<li>' + messages[i].msg + '</li>'); + break; + case OC.SetupChecks.MESSAGE_TYPE_WARNING: + $warningsEl.append('<li>' + messages[i].msg + '</li>'); + break; + case OC.SetupChecks.MESSAGE_TYPE_ERROR: + default: + $errorsEl.append('<li>' + messages[i].msg + '</li>'); + } + } + + if ($errorsEl.find('li').length > 0) { + $errorsEl.removeClass('hidden'); + hasMessages = true; + } + if ($warningsEl.find('li').length > 0) { + $warningsEl.removeClass('hidden'); + hasMessages = true; + } + if ($infoEl.find('li').length > 0) { + $infoEl.removeClass('hidden'); + hasMessages = true; + } + + if (hasMessages) { + $el.find('.hint').removeClass('hidden'); + } else { var securityWarning = $('#security-warning'); if (securityWarning.children('ul').children().length === 0) { $('#security-warning-state').find('span').removeClass('hidden'); } - } else { - var $errorsEl = $el.find('.errors'); - var $warningsEl = $el.find('.warnings'); - var $infoEl = $el.find('.info'); - for (var i = 0; i < messages.length; i++ ) { - switch(messages[i].type) { - case OC.SetupChecks.MESSAGE_TYPE_INFO: - $infoEl.append('<li>' + messages[i].msg + '</li>'); - break; - case OC.SetupChecks.MESSAGE_TYPE_WARNING: - $warningsEl.append('<li>' + messages[i].msg + '</li>'); - break; - case OC.SetupChecks.MESSAGE_TYPE_ERROR: - default: - $errorsEl.append('<li>' + messages[i].msg + '</li>'); - } - } - if ($errorsEl.find('li').length > 0) { - $errorsEl.removeClass('hidden'); - } - if ($warningsEl.find('li').length > 0) { - $warningsEl.removeClass('hidden'); - } - if ($infoEl.find('li').length > 0) { - $infoEl.removeClass('hidden'); - } - $el.find('.hint').removeClass('hidden'); } }); }); |