Skip to content

Commit

Permalink
Merge pull request #12491 from nextcloud/share-menu-click-fix
Browse files Browse the repository at this point in the history
Fix share link password input
  • Loading branch information
skjnldsv authored Nov 20, 2018
2 parents a9de88e + 7a9ea03 commit ebc690b
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 19 deletions.
22 changes: 17 additions & 5 deletions apps/files_sharing/css/sharetabview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,13 @@
.shareWithLoading {
padding-left: 10px;
right: 35px;
top: 0px;
top: 3px;
}
.shareWithConfirm,
.linkPass .icon-loading-small {
.shareWithConfirm {
position: absolute;
right: 2px;
top: 6px;
padding: 14px;
}
.shareWithConfirm {
opacity: 0.5;
}
.shareWithField:focus ~ .shareWithConfirm {
Expand All @@ -70,6 +67,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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<li class="{{#unless isPasswordSet}}hidden{{/unless}} linkPassMenu">
<span class="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>
Expand Down
13 changes: 7 additions & 6 deletions core/js/sharedialoglinkshareview.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
// hide download
'change .hideDownloadCheckbox': 'onHideDownloadChange',
// 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 .passwordByTalkCheckbox': 'onPasswordByTalkChange',
'change .publicEditingCheckbox': 'onAllowPublicEditingChange',
Expand Down Expand Up @@ -381,11 +381,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');
}
});
},
Expand Down
2 changes: 1 addition & 1 deletion core/js/sharetemplates.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions core/js/tests/specs/sharedialoglinkshareview.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,11 @@ describe('OC.Share.ShareDialogLinkShareView', function () {
});
view.render();

var $passwordDiv = view.$el.find('#linkPass');
$passwordText = view.$el.find('.linkPassText');
$workingIcon = view.$el.find('.linkPassMenu .icon-loading-small');

sinon.stub(shareModel, 'saveLinkShare');

expect($passwordDiv.hasClass('hidden')).toBeFalsy();
expect($passwordText.hasClass('hidden')).toBeFalsy();
expect($workingIcon.hasClass('hidden')).toBeTruthy();

Expand Down
10 changes: 5 additions & 5 deletions core/js/tests/specs/sharedialogviewSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -137,19 +137,19 @@ describe('OC.Share.ShareDialogView', function() {
});
dialog.render();

// Enable password, enter password and focusout
// 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({
cid: 123,
password: 'foo'
});
});
it('update password on enter', function() {
it('update password on submit', function() {
$('#allowShareWithLink').val('yes');

dialog.model.set({
Expand All @@ -163,7 +163,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({
Expand Down

0 comments on commit ebc690b

Please sign in to comment.