diff options
author | Robin McCorkell <rmccorkell@karoshi.org.uk> | 2014-03-21 13:51:45 +0000 |
---|---|---|
committer | Robin McCorkell <rmccorkell@karoshi.org.uk> | 2014-03-21 13:51:45 +0000 |
commit | c4e7d7989a94ec974842120544a9510a56d70319 (patch) | |
tree | 9bce816a570ef3f7ea6a14219a4aa61dad7035f4 /apps/files_external/js | |
parent | 7a0eccfc63e80ea27188032135560dbb45a1e5cb (diff) | |
download | nextcloud-server-c4e7d7989a94ec974842120544a9510a56d70319.tar.gz nextcloud-server-c4e7d7989a94ec974842120544a9510a56d70319.zip |
Enable the use of 'optional' on password fields (JavaScript part)
See ed0c10a10b0b3a9d9d898a64461de707026cd6d3
Diffstat (limited to 'apps/files_external/js')
-rw-r--r-- | apps/files_external/js/settings.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index cd2a3103eb7..0fceb41c0af 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -181,16 +181,21 @@ $(document).ready(function() { $.each(configurations, function(backend, parameters) { if (backend == backendClass) { $.each(parameters['configuration'], function(parameter, placeholder) { - if (placeholder.indexOf('*') != -1) { - td.append('<input type="password" data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />'); - } else if (placeholder.indexOf('!') != -1) { + var is_optional = false; + if (placeholder.indexOf('&') === 0) { + is_optional = true; + placeholder = placeholder.substring(1); + } + if (placeholder.indexOf('*') === 0) { + var class_string = is_optional ? ' class="optional"' : ''; + td.append('<input type="password"' + class_string + ' data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />'); + else if (placeholder.indexOf('!') === 0) { td.append('<label><input type="checkbox" data-parameter="'+parameter+'" />'+placeholder.substring(1)+'</label>'); - } else if (placeholder.indexOf('&') != -1) { - td.append('<input type="text" class="optional" data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />'); - } else if (placeholder.indexOf('#') != -1) { + else if (placeholder.indexOf('#') === 0) { td.append('<input type="hidden" data-parameter="'+parameter+'" />'); - } else { - td.append('<input type="text" data-parameter="'+parameter+'" placeholder="'+placeholder+'" />'); + else { + var class_string = is_optional ? ' class="optional"' : ''; + td.append('<input type="text"' + class_string + ' data-parameter="'+parameter+'" placeholder="'+placeholder+'" />'); } }); if (parameters['custom'] && $('#externalStorage tbody tr.'+backendClass.replace(/\\/g, '\\\\')).length == 1) { |