]> source.dussan.org Git - nextcloud-server.git/commitdiff
Improve credentials dialog usability a bit
authorVincent Petry <pvince81@owncloud.com>
Thu, 4 Feb 2016 16:18:21 +0000 (17:18 +0100)
committerVincent Petry <pvince81@owncloud.com>
Thu, 4 Feb 2016 16:18:21 +0000 (17:18 +0100)
Automatically focus on the first field.
Pressing enter submits the form.

apps/files_external/js/statusmanager.js

index ed9a0ba1a90a11b26c7c984cd4ec332009a0b326..33d2ea104be4e9283924ae984d30f0a157b58dde 100644 (file)
@@ -421,12 +421,12 @@ OCA.External.StatusManager = {
                                        OC.Notification.showTemporary(t('files_external', 'Credentials saving failed'));
                                }
                        });
+                       return false;
                };
 
-               dialog.find('form').on('submit', apply);
-
                var ocdialogParams = {
                        modal: true,
+                       title: t('files_external', 'Credentials required'),
                        buttons: [{
                                text: t('files_external', 'Save'),
                                click: apply,
@@ -439,6 +439,17 @@ OCA.External.StatusManager = {
                        .bind('ocdialogclose', function () {
                                dialog.ocdialog('destroy').remove();
                        });
+
+               dialog.find('form').on('submit', apply);
+               dialog.find('form input:first').focus();
+               dialog.find('form input').keyup(function (e) {
+                       if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
+                               $(e.target).closest('form').submit();
+                               return false;
+                       } else {
+                               return true;
+                       }
+               });
        }
 };