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 --- core/css/public.scss | 16 +++++++++++++++- core/js/public/publicpage.js | 15 +++++++++++++-- core/templates/layout.public.php | 4 ++-- 3 files changed, 30 insertions(+), 5 deletions(-) (limited to 'core') 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()) ?> + getLabel()) ?> getActionCount()>1) { ?>
-
+
    Date: Thu, 5 Apr 2018 12:22:01 +0200 Subject: Add footer to public page template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/templates/layout.public.php | 5 +++++ .../AppFramework/Http/Template/PublicTemplateResponse.php | 15 +++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'core') diff --git a/core/templates/layout.public.php b/core/templates/layout.public.php index 61b66144502..2317a7b36ef 100644 --- a/core/templates/layout.public.php +++ b/core/templates/layout.public.php @@ -76,6 +76,11 @@
    + getFooterVisible()) { ?> +
    +

    getLongFooter()); ?>

    +
    +
diff --git a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php index 3409d5aae53..a520748a9ea 100644 --- a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php +++ b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php @@ -37,6 +37,7 @@ class PublicTemplateResponse extends TemplateResponse { private $headerTitle = ''; private $headerDetails = ''; private $headerActions = []; + private $footerVisible = true; /** * PublicTemplateResponse constructor. @@ -128,6 +129,20 @@ class PublicTemplateResponse extends TemplateResponse { return array_slice($this->headerActions, 1); } + /** + * @since 14.0.0 + */ + public function setFooterVisible(bool $visible = false) { + $this->footerVisible = $visible; + } + + /** + * @since 14.0.0 + */ + public function getFooterVisible(): bool { + return $this->footerVisible; + } + /** * @return string * @since 14.0.0 -- cgit v1.2.3 From 2e60f91ab159e51b8b39788077178cf96e8cfa0f Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Thu, 5 Apr 2018 13:11:55 +0200 Subject: Move external share saving to template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files_sharing/js/public.js | 20 ++++++++++---------- core/css/public.scss | 17 ++++++++++++++--- core/js/public/publicpage.js | 7 +++++++ .../Http/Template/ExternalShareMenuAction.php | 10 +++------- 4 files changed, 34 insertions(+), 20 deletions(-) (limited to 'core') diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 1be51d4b688..33d8da09166 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -263,15 +263,15 @@ OCA.Sharing.PublicApp = { var remote = $(this).find('#remote_address').val(); var token = $('#sharingToken').val(); - var owner = $('#save').data('owner'); - var ownerDisplayName = $('#save').data('owner-display-name'); - var name = $('#save').data('name'); - var isProtected = $('#save').data('protected') ? 1 : 0; + var owner = $('#save-external-share').data('owner'); + var ownerDisplayName = $('#save-external-share').data('owner-display-name'); + var name = $('#save-external-share').data('name'); + var isProtected = $('#save-external-share').data('protected') ? 1 : 0; OCA.Sharing.PublicApp._createFederatedShare(remote, token, owner, ownerDisplayName, name, isProtected); }); $('#remote_address').on("keyup paste", function() { - if ($(this).val() === '' || $('#save > .icon.icon-loading-small').length > 0) { + if ($(this).val() === '' || $('#save-external-share > .icon.icon-loading-small').length > 0) { $('#save-button-confirm').prop('disabled', true); } else { $('#save-button-confirm').prop('disabled', false); @@ -352,18 +352,18 @@ OCA.Sharing.PublicApp = { }, _toggleLoading: function() { - var loading = $('#save > .icon.icon-loading-small').length === 0; + var loading = $('#save-external-share > .icon.icon-loading-small').length === 0; if (loading) { - $('#save > .icon-external') + $('#save-external-share > .icon-external') .removeClass("icon-external") .addClass("icon-loading-small"); - $('#save #save-button-confirm').prop("disabled", true); + $('#save-external-share #save-button-confirm').prop("disabled", true); } else { - $('#save > .icon-loading-small') + $('#save-external-share > .icon-loading-small') .addClass("icon-external") .removeClass("icon-loading-small"); - $('#save #save-button-confirm').prop("disabled", false); + $('#save-external-share #save-button-confirm').prop("disabled", false); } }, diff --git a/core/css/public.scss b/core/css/public.scss index 412016bc625..cc2c6bd0826 100644 --- a/core/css/public.scss +++ b/core/css/public.scss @@ -17,11 +17,22 @@ #header-secondary-action { margin-right: 13px; - input[type='text'] { - width: 200px; + ul li { + min-width: 270px; + } + #save-external-share { + form { + display: flex; + margin: 0; + } + .hidden { + display: none; + } + #save-button-confirm { + flex-grow: 0; + } } } - } #content { diff --git a/core/js/public/publicpage.js b/core/js/public/publicpage.js index 1b37005540f..e71bdff12ae 100644 --- a/core/js/public/publicpage.js +++ b/core/js/public/publicpage.js @@ -25,6 +25,13 @@ $(document).ready(function () { $('#body-public').find('.header-right .menutoggle').click(function() { $(this).next('.popovermenu').toggleClass('open'); }); + + $('#save-external-share').find('label').click(function () { + $(this).toggleClass('hidden'); + $('.save-form').toggleClass('hidden') + $('#remote_address').focus(); + }); + }); $(document).mouseup(function(e) { diff --git a/lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php b/lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php index 079ae6ea779..d22565e8178 100644 --- a/lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php +++ b/lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php @@ -55,18 +55,14 @@ class ExternalShareMenuAction extends SimpleMenuAction { public function render(): string { return '
  • ' . - '' . + '' . '' . '' . - '' . - '
  • ' . - '
  • ' . - '' . - '
    ' . + '' . '' . '' . '
    ' . - '
    ' . + '' . '
  • '; } } -- cgit v1.2.3