Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public page template enhancements #9084

Merged
merged 9 commits into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions apps/files_sharing/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,5 @@
'OCA\\Files_Sharing\\ShareBackend\\Folder' => $baseDir . '/../lib/ShareBackend/Folder.php',
'OCA\\Files_Sharing\\SharedMount' => $baseDir . '/../lib/SharedMount.php',
'OCA\\Files_Sharing\\SharedStorage' => $baseDir . '/../lib/SharedStorage.php',
'OCA\\Files_Sharing\\Template\\ExternalShareMenuAction' => $baseDir . '/../lib/Template/ExternalShareMenuAction.php',
'OCA\\Files_Sharing\\Template\\LinkMenuAction' => $baseDir . '/../lib/Template/LinkMenuAction.php',
'OCA\\Files_Sharing\\Updater' => $baseDir . '/../lib/Updater.php',
);
2 changes: 0 additions & 2 deletions apps/files_sharing/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ class ComposerStaticInitFiles_Sharing
'OCA\\Files_Sharing\\ShareBackend\\Folder' => __DIR__ . '/..' . '/../lib/ShareBackend/Folder.php',
'OCA\\Files_Sharing\\SharedMount' => __DIR__ . '/..' . '/../lib/SharedMount.php',
'OCA\\Files_Sharing\\SharedStorage' => __DIR__ . '/..' . '/../lib/SharedStorage.php',
'OCA\\Files_Sharing\\Template\\ExternalShareMenuAction' => __DIR__ . '/..' . '/../lib/Template/ExternalShareMenuAction.php',
'OCA\\Files_Sharing\\Template\\LinkMenuAction' => __DIR__ . '/..' . '/../lib/Template/LinkMenuAction.php',
'OCA\\Files_Sharing\\Updater' => __DIR__ . '/..' . '/../lib/Updater.php',
);

Expand Down
4 changes: 0 additions & 4 deletions apps/files_sharing/css/mobile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 0 additions & 14 deletions apps/files_sharing/css/public.scss
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
38 changes: 11 additions & 27 deletions apps/files_sharing/js/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

}
},
Expand Down Expand Up @@ -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');
}
});
});
4 changes: 2 additions & 2 deletions apps/files_sharing/lib/Controller/ShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
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;
Expand Down
8 changes: 1 addition & 7 deletions apps/files_sharing/templates/public.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<?php endif; ?>
<input type="hidden" name="maxSizeAnimateGif" value="<?php p($_['maxSizeAnimateGif']); ?>" id="maxSizeAnimateGif">
<?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { ?>
<div id="content">
<div id="files-public-content">
<div id="preview">
<?php if (isset($_['folder'])): ?>
<?php print_unescaped($_['folder']); ?>
Expand Down Expand Up @@ -84,9 +84,3 @@
data-url="<?php p(\OC::$server->getURLGenerator()->linkTo('files', 'ajax/upload.php')); ?>" />
</div>
<?php endif; ?>

<footer>
<p class="info">
<?php print_unescaped($theme->getLongFooter()); ?>
</p>
</footer>
4 changes: 2 additions & 2 deletions apps/files_sharing/tests/Controller/ShareControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
use OC\Files\Filesystem;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Files_Sharing\Controller\ShareController;
use OCA\Files_Sharing\Template\ExternalShareMenuAction;
use OCA\Files_Sharing\Template\LinkMenuAction;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\Template\ExternalShareMenuAction;
use OCP\AppFramework\Http\Template\LinkMenuAction;
use OCP\AppFramework\Http\Template\PublicTemplateResponse;
use OCP\AppFramework\Http\Template\SimpleMenuAction;
use OCP\IConfig;
Expand Down
27 changes: 26 additions & 1 deletion core/css/public.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#body-public {
.header-right {

span:not(.popovermenu) a {
#header-primary-action a {
color: $color-primary-text;
}

Expand All @@ -16,7 +16,32 @@

#header-secondary-action {
margin-right: 13px;

ul li {
min-width: 270px;
}
#save-external-share {
form {
display: flex;
margin: 0;
}
.hidden {
display: none;
}
#save-button-confirm {
flex-grow: 0;
}
}
}
}

#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;
}
}
22 changes: 20 additions & 2 deletions core/js/public/publicpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,26 @@

$(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');
});

$('#save-external-share').find('label').click(function () {
$(this).toggleClass('hidden');
$('.save-form').toggleClass('hidden')
$('#remote_address').focus();
});

});

$(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');
}
});
9 changes: 7 additions & 2 deletions core/templates/layout.public.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
<div class="header-right">
<span id="header-primary-action" class="<?php if($template->getActionCount() === 1) { p($primary->getIcon()); } ?>">
<a href="<?php p($primary->getLink()); ?>">
<span class="share-menutoggle-text"><?php p($primary->getLabel()) ?></span>
<span><?php p($primary->getLabel()) ?></span>
</a>
</span>
<?php if($template->getActionCount()>1) { ?>
<div id="header-secondary-action">
<span id="header-actions-toggle" class="menutoggle icon-more-white"></span>
<div id="share-menu" class="popovermenu menu">
<div id="header-actions-menu" class="popovermenu menu">
<ul>
<?php
/** @var \OCP\AppFramework\Http\Template\IMenuAction $action */
Expand All @@ -76,6 +76,11 @@
<div id="content" class="app-<?php p($_['appid']) ?>" role="main">
<?php print_unescaped($_['content']); ?>
</div>
<?php if($template->getFooterVisible()) { ?>
<footer>
<p class="info"><?php print_unescaped($theme->getLongFooter()); ?></p>
</footer>
<?php } ?>
</div>

</body>
Expand Down
2 changes: 2 additions & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
'OCP\\AppFramework\\Http\\Response' => $baseDir . '/lib/public/AppFramework/Http/Response.php',
'OCP\\AppFramework\\Http\\StreamResponse' => $baseDir . '/lib/public/AppFramework/Http/StreamResponse.php',
'OCP\\AppFramework\\Http\\TemplateResponse' => $baseDir . '/lib/public/AppFramework/Http/TemplateResponse.php',
'OCP\\AppFramework\\Http\\Template\\ExternalShareMenuAction' => $baseDir . '/lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php',
'OCP\\AppFramework\\Http\\Template\\IMenuAction' => $baseDir . '/lib/public/AppFramework/Http/Template/IMenuAction.php',
'OCP\\AppFramework\\Http\\Template\\LinkMenuAction' => $baseDir . '/lib/public/AppFramework/Http/Template/LinkMenuAction.php',
'OCP\\AppFramework\\Http\\Template\\PublicTemplateResponse' => $baseDir . '/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php',
'OCP\\AppFramework\\Http\\Template\\SimpleMenuAction' => $baseDir . '/lib/public/AppFramework/Http/Template/SimpleMenuAction.php',
'OCP\\AppFramework\\IAppContainer' => $baseDir . '/lib/public/AppFramework/IAppContainer.php',
Expand Down
2 changes: 2 additions & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\AppFramework\\Http\\Response' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/Response.php',
'OCP\\AppFramework\\Http\\StreamResponse' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/StreamResponse.php',
'OCP\\AppFramework\\Http\\TemplateResponse' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/TemplateResponse.php',
'OCP\\AppFramework\\Http\\Template\\ExternalShareMenuAction' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php',
'OCP\\AppFramework\\Http\\Template\\IMenuAction' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/Template/IMenuAction.php',
'OCP\\AppFramework\\Http\\Template\\LinkMenuAction' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/Template/LinkMenuAction.php',
'OCP\\AppFramework\\Http\\Template\\PublicTemplateResponse' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php',
'OCP\\AppFramework\\Http\\Template\\SimpleMenuAction' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/Template/SimpleMenuAction.php',
'OCP\\AppFramework\\IAppContainer' => __DIR__ . '/../../..' . '/lib/public/AppFramework/IAppContainer.php',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,31 @@
*
* @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 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.
* 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 <http://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\Files_Sharing\Template;
namespace OCP\AppFramework\Http\Template;

use OCP\AppFramework\Http\Template\SimpleMenuAction;
use OCP\Util;

/**
* Class LinkMenuAction
*
* @package OCP\AppFramework\Http\Template
* @since 14.0.0
*/
class ExternalShareMenuAction extends SimpleMenuAction {

/** @var string */
Expand All @@ -45,6 +50,7 @@ class ExternalShareMenuAction extends SimpleMenuAction {
* @param string $owner
* @param string $displayname
* @param string $shareName
* @since 14.0.0
*/
public function __construct(string $label, string $icon, string $owner, string $displayname, string $shareName) {
parent::__construct('save', $label, $icon);
Expand All @@ -53,20 +59,19 @@ public function __construct(string $label, string $icon, string $owner, string $
$this->shareName = $shareName;
}

/**
* @since 14.0.0
*/
public function render(): string {
return '<li>' .
'<a id="save" data-protected="false" data-owner-display-name="' . Util::sanitizeHTML($this->displayname) . '" data-owner="' . Util::sanitizeHTML($this->owner) . '" data-name="' . Util::sanitizeHTML($this->shareName) . '">' .
'<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>' .
'</a>' .
'</li>' .
'<li>' .
'<span class="menuitem">' .
'<form class="save-form" action="#">' .
'<form class="save-form hidden" 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>' .
'</span>' .
'</a>' .
'</li>';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@
*
*/

namespace OCA\Files_Sharing\Template;
namespace OCP\AppFramework\Http\Template;

use OCP\AppFramework\Http\Template\SimpleMenuAction;
use OCP\Util;

/**
* Class LinkMenuAction
*
* @package OCP\AppFramework\Http\Template
* @since 14.0.0
*/
class LinkMenuAction extends SimpleMenuAction {

/**
Expand All @@ -34,13 +40,15 @@ class LinkMenuAction extends SimpleMenuAction {
* @param string $label
* @param string $icon
* @param string $link
* @since 14.0.0
*/
public function __construct(string $label, string $icon, string $link) {
parent::__construct('directLink-container', $label, $icon, $link);
}

/**
* @return string
* @since 14.0.0
*/
public function render(): string {
return '<li>' .
Expand Down
Loading