From eb19899f8eab686ec1144ad304cdffd560b2dd2f Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Thu, 5 Apr 2018 11:09:19 +0200 Subject: Move common menu templates to public API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .../lib/Controller/ShareController.php | 4 +- .../lib/Template/ExternalShareMenuAction.php | 72 ---------------------- apps/files_sharing/lib/Template/LinkMenuAction.php | 58 ----------------- 3 files changed, 2 insertions(+), 132 deletions(-) delete mode 100644 apps/files_sharing/lib/Template/ExternalShareMenuAction.php delete mode 100644 apps/files_sharing/lib/Template/LinkMenuAction.php (limited to 'apps/files_sharing') diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index f793d35e3ae..a196f552f6e 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -38,9 +38,9 @@ namespace OCA\Files_Sharing\Controller; use OC_Files; use OC_Util; use OCA\FederatedFileSharing\FederatedShareProvider; -use OCA\Files_Sharing\Template\ExternalShareMenuAction; -use OCA\Files_Sharing\Template\LinkMenuAction; use OCP\AppFramework\Http\Template\SimpleMenuAction; +use OCP\AppFramework\Http\Template\ExternalShareMenuAction; +use OCP\AppFramework\Http\Template\LinkMenuAction; use OCP\AppFramework\Http\Template\PublicTemplateResponse; use OCP\Defaults; use OCP\IL10N; diff --git a/apps/files_sharing/lib/Template/ExternalShareMenuAction.php b/apps/files_sharing/lib/Template/ExternalShareMenuAction.php deleted file mode 100644 index e30a77cb2e6..00000000000 --- a/apps/files_sharing/lib/Template/ExternalShareMenuAction.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * @author Julius Härtl - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -namespace OCA\Files_Sharing\Template; - -use OCP\AppFramework\Http\Template\SimpleMenuAction; -use OCP\Util; - -class ExternalShareMenuAction extends SimpleMenuAction { - - /** @var string */ - private $owner; - - /** @var string */ - private $displayname; - - /** @var string */ - private $shareName; - - /** - * ExternalShareMenuAction constructor. - * - * @param string $label - * @param string $icon - * @param string $owner - * @param string $displayname - * @param string $shareName - */ - public function __construct(string $label, string $icon, string $owner, string $displayname, string $shareName) { - parent::__construct('save', $label, $icon); - $this->owner = $owner; - $this->displayname = $displayname; - $this->shareName = $shareName; - } - - public function render(): string { - return '
  • ' . - '' . - '' . - '' . - '' . - '
  • ' . - '
  • ' . - '' . - '
    ' . - '' . - '' . - '
    ' . - '
    ' . - '
  • '; - } -} diff --git a/apps/files_sharing/lib/Template/LinkMenuAction.php b/apps/files_sharing/lib/Template/LinkMenuAction.php deleted file mode 100644 index 519bc553228..00000000000 --- a/apps/files_sharing/lib/Template/LinkMenuAction.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * @author Julius Härtl - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -namespace OCA\Files_Sharing\Template; - -use OCP\AppFramework\Http\Template\SimpleMenuAction; -use OCP\Util; - -class LinkMenuAction extends SimpleMenuAction { - - /** - * LinkMenuAction constructor. - * - * @param string $label - * @param string $icon - * @param string $link - */ - public function __construct(string $label, string $icon, string $link) { - parent::__construct('directLink-container', $label, $icon, $link); - } - - /** - * @return string - */ - public function render(): string { - return '
  • ' . - '' . - '' . - '' . - '' . - '
  • ' . - '
  • ' . - '' . - '' . - '' . - '
  • '; - } -} -- cgit v1.2.3 From cc3b1179fc2ad0051cb6043ff022cd033144a936 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Thu, 5 Apr 2018 11:32:11 +0200 Subject: Do not hide primary action text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files_sharing/css/mobile.scss | 4 ---- 1 file changed, 4 deletions(-) (limited to 'apps/files_sharing') diff --git a/apps/files_sharing/css/mobile.scss b/apps/files_sharing/css/mobile.scss index 56f57d53263..272dbbc0c34 100644 --- a/apps/files_sharing/css/mobile.scss +++ b/apps/files_sharing/css/mobile.scss @@ -46,10 +46,6 @@ table td.filename .nametext { text-overflow: ellipsis; } -// Hide Download label of 3-dot-menu on public share pages -.share-menutoggle-text { - display: none; -} #header .menutoggle { padding-right: 14px; background-position: center; -- cgit v1.2.3 From bbeb3402b6bc778de393b6da1b5fdc214f825b16 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Thu, 5 Apr 2018 12:21:39 +0200 Subject: Move styling and menu handling to publicpage.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files_sharing/css/public.scss | 14 -------------- apps/files_sharing/js/public.js | 18 +----------------- apps/files_sharing/templates/public.php | 8 +------- core/css/public.scss | 16 +++++++++++++++- core/js/public/publicpage.js | 15 +++++++++++++-- core/templates/layout.public.php | 4 ++-- .../features/bootstrap/FilesSharingAppContext.php | 2 +- 7 files changed, 33 insertions(+), 44 deletions(-) (limited to 'apps/files_sharing') diff --git a/apps/files_sharing/css/public.scss b/apps/files_sharing/css/public.scss index cc3788884e7..277814207b3 100644 --- a/apps/files_sharing/css/public.scss +++ b/apps/files_sharing/css/public.scss @@ -1,13 +1,3 @@ -#content { - height: initial; - min-height: calc(100vh - 160px); -} - -/* force layout to make sure the content element's height matches its contents' height */ -.ie #content { - display: inline-block; -} - #preview { background: #fff; text-align: center; @@ -105,10 +95,6 @@ thead { border-color: rgba(0,0,0,0.3) !important; } -#share-menu input[type='text'] { - width: 200px; -} - #public-upload .avatardiv { margin: 0 auto; } diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 4b3ede24389..1be51d4b688 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -423,20 +423,4 @@ $(document).ready(function () { }; } - $('#share-menutoggle').click(function() { - $('#share-menu').toggleClass('open'); - }); -}); - - -$(document).mouseup(function(e) { - var toggle = $('#share-menutoggle'); - var container = $('#share-menu'); - - // if the target of the click isn't the menu toggle, nor a descendant of the - // menu toggle, nor the container nor a descendant of the container - if (!toggle.is(e.target) && toggle.has(e.target).length === 0 && - !container.is(e.target) && container.has(e.target).length === 0) { - container.removeClass('open'); - } -}); +}); \ No newline at end of file diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index e8eb28f25c6..476f0851547 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -30,7 +30,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size); -
    +
    @@ -84,9 +84,3 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size); data-url="getURLGenerator()->linkTo('files', 'ajax/upload.php')); ?>" />
    - -
    -

    - getLongFooter()); ?> -

    -
    diff --git a/core/css/public.scss b/core/css/public.scss index 6a175de6431..412016bc625 100644 --- a/core/css/public.scss +++ b/core/css/public.scss @@ -1,7 +1,7 @@ #body-public { .header-right { - span:not(.popovermenu) a { + #header-primary-action a { color: $color-primary-text; } @@ -16,7 +16,21 @@ #header-secondary-action { margin-right: 13px; + + input[type='text'] { + width: 200px; + } } } + + #content { + height: initial; + min-height: calc(100vh - 160px); + } + + /* force layout to make sure the content element's height matches its contents' height */ + .ie #content { + display: inline-block; + } } diff --git a/core/js/public/publicpage.js b/core/js/public/publicpage.js index 31b862ba12a..1b37005540f 100644 --- a/core/js/public/publicpage.js +++ b/core/js/public/publicpage.js @@ -22,8 +22,19 @@ $(document).ready(function () { - console.log('public'); - $('#body-public .header-right .menutoggle').click(function() { + $('#body-public').find('.header-right .menutoggle').click(function() { $(this).next('.popovermenu').toggleClass('open'); }); }); + +$(document).mouseup(function(e) { + var toggle = $('#body-public').find('.header-right .menutoggle'); + var container = toggle.next('.popovermenu'); + + // if the target of the click isn't the menu toggle, nor a descendant of the + // menu toggle, nor the container nor a descendant of the container + if (!toggle.is(e.target) && toggle.has(e.target).length === 0 && + !container.is(e.target) && container.has(e.target).length === 0) { + container.removeClass('open'); + } +}); diff --git a/core/templates/layout.public.php b/core/templates/layout.public.php index d3c12f8fd96..61b66144502 100644 --- a/core/templates/layout.public.php +++ b/core/templates/layout.public.php @@ -50,13 +50,13 @@
    - + getLabel()) ?> getActionCount()>1) { ?>
    -