diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-11-23 08:46:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-23 08:46:07 +0100 |
commit | b2891507004ff80b12812e0775fc39285c840d26 (patch) | |
tree | c75087031a7934ebc063638a1d4e09288f1124d0 | |
parent | e1873e89289757bb62e7d7f439f4a66945714c06 (diff) | |
parent | d8a8c03c362bce0a357528a17853cf479b27d4c9 (diff) | |
download | nextcloud-server-b2891507004ff80b12812e0775fc39285c840d26.tar.gz nextcloud-server-b2891507004ff80b12812e0775fc39285c840d26.zip |
Merge pull request #12560 from nextcloud/stb14-share-menu-click-fix
[stable14] Fix share link password input
-rw-r--r-- | apps/files_sharing/css/sharetabview.scss | 23 | ||||
-rw-r--r-- | core/js/sharedialoglinkshareview.js | 14 | ||||
-rw-r--r-- | core/js/tests/specs/sharedialogviewSpec.js | 13 |
3 files changed, 33 insertions, 17 deletions
diff --git a/apps/files_sharing/css/sharetabview.scss b/apps/files_sharing/css/sharetabview.scss index 14be9562228..017d0a82a2f 100644 --- a/apps/files_sharing/css/sharetabview.scss +++ b/apps/files_sharing/css/sharetabview.scss @@ -23,17 +23,13 @@ .shareWithLoading { padding-left: 10px; right: 35px; - top: 0px; + top: 3px; } - .shareWithConfirm, - .clipboardButton, - .linkPass .icon-loading-small { + .shareWithConfirm { position: absolute; right: 2px; top: 6px; padding: 14px; - } - .shareWithConfirm { opacity: 0.5; } .shareWithField:focus ~ .shareWithConfirm { @@ -46,6 +42,21 @@ padding: 14px; } .popovermenu { + .linkPassMenu { + .share-pass-submit { + width: auto !important; + } + .icon-loading-small { + background-color: var(--color-main-background); + position: absolute; + right: 8px; + margin: 3px; + padding: 10px; + width: 32px; + height: 32px; + z-index: 10; + } + } .datepicker { margin-left: 35px; } diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index 3338b70550e..4d513bcee01 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -93,6 +93,7 @@ ' </span></li>' + ' <li class="{{#unless isPasswordSet}}hidden{{/unless}} linkPassMenu"><span class="shareOption menuitem icon-share-pass">' + ' <input id="linkPassText-{{cid}}" class="linkPassText" type="password" placeholder="{{passwordPlaceholder}}" autocomplete="new-password" />' + + ' <input type="submit" class="icon-confirm share-pass-submit" value="" />' + ' <span class="icon icon-loading-small hidden"></span>' + ' </span></li>' + '{{/if}}' + @@ -189,8 +190,8 @@ // open menu 'click .share-menu .icon-more': 'onToggleMenu', // password - 'focusout input.linkPassText': 'onPasswordEntered', - 'keyup input.linkPassText': 'onPasswordKeyUp', + 'click input.share-pass-submit': 'onPasswordEntered', + 'keyup input.linkPassText': 'onPasswordKeyUp', // check for the enter key 'change .showPasswordCheckbox': 'onShowPasswordClick', 'change .publicEditingCheckbox': 'onAllowPublicEditingChange', // copy link url @@ -374,11 +375,12 @@ }, error: function(model, msg) { // destroy old tooltips - $input.tooltip('destroy'); + var $container = $input.parent(); + $container.tooltip('destroy'); $input.addClass('error'); - $input.attr('title', msg); - $input.tooltip({placement: 'bottom', trigger: 'manual'}); - $input.tooltip('show'); + $container.attr('title', msg); + $container.tooltip({placement: 'bottom', trigger: 'manual'}); + $container.tooltip('show'); } }); }, diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js index efe50c415c8..0cefda11b56 100644 --- a/core/js/tests/specs/sharedialogviewSpec.js +++ b/core/js/tests/specs/sharedialogviewSpec.js @@ -127,7 +127,7 @@ describe('OC.Share.ShareDialogView', function() { describe('Share with link', function() { // TODO: test ajax calls // TODO: test password field visibility (whenever enforced or not) - it('update password on focus out', function() { + it('update password on enter', function() { $('#allowShareWithLink').val('yes'); dialog.model.set('linkShare', { @@ -135,18 +135,21 @@ describe('OC.Share.ShareDialogView', function() { }); dialog.render(); - // Enable password, enter password and focusout + // Toggle linkshare + dialog.$el.find('.linkCheckbox').click(); + + // Enable password and enter password dialog.$el.find('[name=showPassword]').click(); dialog.$el.find('.linkPassText').focus(); dialog.$el.find('.linkPassText').val('foo'); - dialog.$el.find('.linkPassText').focusout(); + dialog.$el.find('.linkPassText').trigger(new $.Event('keyup', {keyCode: 13})); expect(saveLinkShareStub.calledOnce).toEqual(true); expect(saveLinkShareStub.firstCall.args[0]).toEqual({ password: 'foo' }); }); - it('update password on enter', function() { + it('update password on submit', function() { $('#allowShareWithLink').val('yes'); dialog.model.set('linkShare', { @@ -161,7 +164,7 @@ describe('OC.Share.ShareDialogView', function() { dialog.$el.find('[name=showPassword]').click(); dialog.$el.find('.linkPassText').focus(); dialog.$el.find('.linkPassText').val('foo'); - dialog.$el.find('.linkPassText').trigger(new $.Event('keyup', {keyCode: 13})); + dialog.$el.find('.linkPassText + .icon-confirm').click(); expect(saveLinkShareStub.calledOnce).toEqual(true); expect(saveLinkShareStub.firstCall.args[0]).toEqual({ |