Skip to content

Commit 883a71c

Browse files
committed
Split the menu entry for external shares in two
The external shares entry showed a "button" that, when pressed, replaced the button with the input to set the remote share address. The "button" was actually a label for the input, so when the label was focused it transferred the focus to the input and thus pressing enter or space did not show the input. Moreover, inputs inside links are not valid HTML, and once shown there was no way to hide the input again. Due to all this, and for consistency with the direct link input, the external share input was moved to a different menu item that is shown and hidden when the button, which nows is also a real button, is clicked. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
1 parent 33b2f4e commit 883a71c

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

core/css/public.scss

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ $footer-height: 65px;
2121
opacity: 1;
2222
}
2323
}
24-
#save-external-share {
24+
#external-share-menu-item {
2525
form {
2626
display: flex;
27-
margin: 0;
2827
}
2928
.hidden {
3029
display: none;

core/js/public/publicpage.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ $(document).ready(function () {
2626
$(this).next('.popovermenu').toggleClass('open');
2727
});
2828

29-
$('#save-external-share').find('label').click(function () {
30-
$(this).toggleClass('hidden');
31-
$('.save-form').toggleClass('hidden')
29+
$('#save-external-share').click(function () {
30+
$('#external-share-menu-item').toggleClass('hidden')
3231
$('#remote_address').focus();
3332
});
3433

lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,15 @@ public function __construct(string $label, string $icon, string $owner, string $
6767
*/
6868
public function render(): string {
6969
return '<li>' .
70-
' <a id="save-external-share" data-protected="false" data-owner-display-name="' . Util::sanitizeHTML($this->displayname) . '" data-owner="' . Util::sanitizeHTML($this->owner) . '" data-name="' . Util::sanitizeHTML($this->shareName) . '">' .
71-
' <span class="icon ' . Util::sanitizeHTML($this->getIcon()) . '"></span>' .
72-
' <label for="remote_address">' . Util::sanitizeHTML($this->getLabel()) . '</label>' .
73-
' <form class="save-form hidden" action="#">' .
70+
' <button id="save-external-share" class="icon ' . Util::sanitizeHTML($this->getIcon()) . '" data-protected="false" data-owner-display-name="' . Util::sanitizeHTML($this->displayname) . '" data-owner="' . Util::sanitizeHTML($this->owner) . '" data-name="' . Util::sanitizeHTML($this->shareName) . '">' . Util::sanitizeHTML($this->getLabel()) . '</button>' .
71+
'</li>' .
72+
'<li id="external-share-menu-item" class="hidden">' .
73+
' <span class="menuitem">' .
74+
' <form class="save-form" action="#">' .
7475
' <input type="text" id="remote_address" placeholder="user@yourNextcloud.org">' .
7576
' <input type="submit" value=" " id="save-button-confirm" class="icon-confirm" disabled="disabled"></button>' .
7677
' </form>' .
77-
' </a>' .
78+
' </span>' .
7879
'</li>';
7980
}
8081
}

0 commit comments

Comments
 (0)