]> source.dussan.org Git - nextcloud-server.git/commitdiff
Split the menu entry for external shares in two 17861/head
authorDaniel Calviño Sánchez <danxuliu@gmail.com>
Thu, 7 Nov 2019 20:30:56 +0000 (21:30 +0100)
committerDaniel Calviño Sánchez <danxuliu@gmail.com>
Mon, 30 Dec 2019 09:29:36 +0000 (10:29 +0100)
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>
core/css/public.scss
core/js/public/publicpage.js
lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php

index 6ec22cbc6d2f9a9ef869da65a0e49a7bd3ade05f..b171dd4970d8ad6cb5e4334f37f11fa6e0322754 100644 (file)
@@ -21,10 +21,9 @@ $footer-height: 65px;
                                        opacity: 1;
                                }
                        }
-                       #save-external-share {
+                       #external-share-menu-item {
                                form {
                                        display: flex;
-                                       margin: 0;
                                }
                                .hidden {
                                        display: none;
index e71bdff12ae3752950537d59de671381ab1637ba..4fb9c67bfee4ec0becdbdb2c189e5eac8222d919 100644 (file)
@@ -26,9 +26,8 @@ $(document).ready(function () {
                $(this).next('.popovermenu').toggleClass('open');
        });
 
-       $('#save-external-share').find('label').click(function () {
-               $(this).toggleClass('hidden');
-               $('.save-form').toggleClass('hidden')
+       $('#save-external-share').click(function () {
+               $('#external-share-menu-item').toggleClass('hidden')
                $('#remote_address').focus();
        });
 
index 47f62d9f8fdb0bd372825ee2311be985e26e256d..33ca3be94aa9a82233114cd4265a6a40d7211fd3 100644 (file)
@@ -67,14 +67,15 @@ class ExternalShareMenuAction extends SimpleMenuAction {
         */
        public function render(): string {
                return '<li>' .
-                       '    <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) . '">' .
-                       '        <span class="icon ' . Util::sanitizeHTML($this->getIcon()) . '"></span>' .
-                       '        <label for="remote_address">' . Util::sanitizeHTML($this->getLabel()) . '</label>' .
-                       '        <form class="save-form hidden" action="#">' .
+                       '    <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>' .
+                       '</li>' .
+                       '<li id="external-share-menu-item" class="hidden">' .
+                       '    <span class="menuitem">' .
+                       '        <form class="save-form" action="#">' .
                        '            <input type="text" id="remote_address" placeholder="user@yourNextcloud.org">' .
                        '            <input type="submit" value=" " id="save-button-confirm" class="icon-confirm" disabled="disabled"></button>' .
                        '        </form>' .
-                       '    </a>' .
+                       '    </span>' .
                        '</li>';
        }
 }