Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #457 from nextcloud/adjust-ui-to-changes-in-server
Browse files Browse the repository at this point in the history
Adjust ui to changes in server
  • Loading branch information
MorrisJobke authored Aug 31, 2018
2 parents 743ed07 + 7d1f166 commit bae1a33
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 24 deletions.
12 changes: 6 additions & 6 deletions css/share.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
right: 17px;
top: 18px;
}
#app #dropdown.shareDropDown .shareWithLoading {
/* The "box-sizing" of "#app" descendants is set to "border-box" in the
* server. To have the same size the padding here has to be set to the
#app-content #dropdown.shareDropDown .shareWithLoading {
/* The "box-sizing" of "#app-content" descendants is set to "border-box" in
* the server. To have the same size the padding here has to be set to the
* min-width/min-height plus the padding set for the icon in the default
* "content-box" sizing. */
padding: 19px;
Expand All @@ -52,9 +52,9 @@
top: 18px;
}

#app #dropdown .shareWithConfirm {
/* The "box-sizing" of "#app" descendants is set to "border-box" in the
* server. To have the same size the padding here has to be set to the
#app-content #dropdown .shareWithConfirm {
/* The "box-sizing" of "#app-content" descendants is set to "border-box" in
* the server. To have the same size the padding here has to be set to the
* min-width/min-height plus the padding set for the icon in the default
* "content-box" sizing. */
padding: 19px;
Expand Down
9 changes: 0 additions & 9 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,6 @@ div.crumb.last a {
list-style: initial;
}

#app {
/* #app is the parent of #controls and #gallery, and #controls uses a sticky
* position, so the #app height must contain the full gallery for the
* controls to be stuck while scrolling. The server sets "height: 100%" for
* the app, so that value has to be overriden. */
height: auto;
width: 100%;
}

#gallery.hascontrols {
position: relative;
overflow: hidden;
Expand Down
1 change: 0 additions & 1 deletion js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/* global OC, $, _, Gallery, SlideShow */
$(document).ready(function () {
"use strict";
$('#controls').prependTo($('#app'));
Gallery.utility = new Gallery.Utility();
Gallery.view = new Gallery.View();
Gallery.token = Gallery.utility.getPublicToken();
Expand Down
2 changes: 1 addition & 1 deletion js/breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
*/
_build: function () {
var i, crumbs, name, path, currentAlbum;
var albumName = $('#app').data('albumname');
var albumName = $('#app-content').data('albumname');
if (!albumName) {
albumName = t('gallery', 'Gallery');
}
Expand Down
2 changes: 1 addition & 1 deletion js/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
download: function (event) {
event.preventDefault();

var path = $('#app').data('albumname');
var path = $('#app-content').data('albumname');
var files = Gallery.currentAlbum;
var downloadUrl = Gallery.utility.buildFilesUrl(path, files);

Expand Down
4 changes: 2 additions & 2 deletions js/galleryview.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
* At this stage, there is no loading taking place, so we can look for new rows
*/

var scroll = $('#content-wrapper').scrollTop() + $(window).scrollTop();
var scroll = $(window).scrollTop() + $(window).scrollTop();
// 2 windows worth of rows is the limit from which we need to start loading new rows.
// As we scroll down, it grows
var targetHeight = ($(window).height() * 2) + scroll;
Expand Down Expand Up @@ -490,7 +490,7 @@
* @private
*/
_setBackgroundColour: function () {
var wrapper = $('#content-wrapper');
var wrapper = $('#app-content');
var albumDesign = Gallery.config.albumDesign;
if (!$.isEmptyObject(albumDesign) && albumDesign.background) {
wrapper.css('background-color', albumDesign.background);
Expand Down
37 changes: 36 additions & 1 deletion js/slideshow.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
this.container,
this.zoomablePreview,
interval,
features);
features,
this.restoreContent.bind(this));
this.controls.init();

this._initControlsAutoFader();
Expand Down Expand Up @@ -93,6 +94,39 @@
this.controls.update(images, autoPlay);
},

/**
* Hides the content behind the slideshow
*
* This should be called when the slideshow is shown.
*
* It hides the content (and, in the public share page, also the footer)
* to ensure that the body size is just the slideshow size and thus no
* scroll bars are shown.
*/
hideContent: function () {
this._savedScrollPosition = $(window).scrollTop();

$('#content').hide();
$('footer').hide();
},

/**
* Shows again the content behind the slideshow
*
* This should be called when the slideshow is hidden.
*
* It restores the content hidden when calling "hideContent", including
* the vertical scrolling position.
*/
restoreContent: function () {
$('#content').show();
$('footer').show();

if (this._savedScrollPosition) {
$(window).scrollTop(this._savedScrollPosition);
}
},

/**
* Launches the slideshow
*
Expand All @@ -104,6 +138,7 @@
this.hideErrorNotification();
this.active = true;
this.container.show();
this.hideContent();
this.container.css('background-position', 'center');
this._hideImage();
this.container.find('.icon-loading-dark').show();
Expand Down
5 changes: 4 additions & 1 deletion js/slideshowcontrols.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
* @param {Object} zoomablePreview
* @param {number} interval
* @param {Array} features
* @param {Function} restoreContentCallback
* @constructor
*/
var Controls = function (slideshow, container, zoomablePreview, interval, features) {
var Controls = function (slideshow, container, zoomablePreview, interval, features, restoreContentCallback) {
this.slideshow = slideshow;
this.container = container;
this.zoomablePreview = zoomablePreview;
Expand All @@ -31,6 +32,7 @@
if (features.indexOf('background_colour_toggle') > -1) {
this.backgroundToggle = true;
}
this.restoreContentCallback = restoreContentCallback;
};

Controls.prototype = {
Expand Down Expand Up @@ -110,6 +112,7 @@
this.zoomablePreview.stop();

this._clearTimeout();
this.restoreContentCallback();
this.container.hide();
this.active = false;
},
Expand Down
2 changes: 1 addition & 1 deletion templates/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
?>

<div id="app">
<div id="app-content">
<?php
if (isset($_['code'])) {
if ($_['code'] === 404) {
Expand Down
2 changes: 1 addition & 1 deletion templates/public.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
style('files_sharing', 'public');

?>
<div id="app" data-albumname="<?php p($_['albumName']) ?>">
<div id="app-content" data-albumname="<?php p($_['albumName']) ?>">
<div id="controls">
<div id="breadcrumbs"></div>
<!-- sorting buttons -->
Expand Down

0 comments on commit bae1a33

Please sign in to comment.