Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/gallery.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/app.js9
-rw-r--r--js/gallery.js81
-rw-r--r--js/galleryview.js13
-rw-r--r--templates/part.content.php6
-rw-r--r--templates/public.php7
5 files changed, 73 insertions, 43 deletions
diff --git a/js/app.js b/js/app.js
index 73e0213e..024c277e 100644
--- a/js/app.js
+++ b/js/app.js
@@ -62,9 +62,11 @@ $(document).ready(function () {
var windowHeight = $(window).height();
$(window).resize(_.throttle(function () {
if (windowWidth !== $(window).width()) {
- Gallery.view.viewAlbum(Gallery.currentAlbum);
+ if ($('#emptycontent').is(':hidden')) {
+ Gallery.view.viewAlbum(Gallery.currentAlbum);
+ }
// 320 is the width required for the buttons
- Gallery.view.breadcrumb.setMaxWidth($(window).width() - 320);
+ Gallery.view.breadcrumb.setMaxWidth($(window).width() - Gallery.buttonsWidth);
windowWidth = $(window).width();
}
@@ -72,7 +74,8 @@ $(document).ready(function () {
Gallery.resetContentHeight();
var infoContentElement = $('.album-info-content');
// 150 is the space required for the browser toolbar on some mobile OS
- infoContentElement.css('max-height', $(window).height() - 150);
+ infoContentElement.css('max-height',
+ $(window).height() - Gallery.browserToolbarHeight);
windowHeight = $(window).height();
}
diff --git a/js/gallery.js b/js/gallery.js
index 93e398f6..8da43627 100644
--- a/js/gallery.js
+++ b/js/gallery.js
@@ -1,4 +1,4 @@
-/* global Album, GalleryImage, SlideShow */
+/* global Album, GalleryImage */
(function (OC, $, t) {
"use strict";
var Gallery = {
@@ -11,6 +11,8 @@
appName: 'galleryplus',
token: undefined,
activeSlideShow: null,
+ buttonsWidth: 320,
+ browserToolbarHeight: 150,
/**
* Builds a map of the albums located in the current folder
@@ -41,6 +43,10 @@
* @param {string} albumPath
*/
refresh: function (path, albumPath) {
+
+ // FIXME DEBUG CODE
+ console.log('refresh albumPath', albumPath);
+
if (Gallery.currentAlbum !== albumPath) {
Gallery.view.init(albumPath);
}
@@ -93,31 +99,35 @@
Gallery.albumMap = albumCache.albumMap;
} else {
files = data.files;
- for (var i = 0; i < files.length; i++) {
- path = files[i].path;
- fileId = files[i].fileid;
- mimeType = files[i].mimetype;
- mTime = files[i].mtime;
- etag = files[i].etag;
-
- Gallery.images.push(path);
-
- image = new GalleryImage(path, path, fileId, mimeType, mTime, etag);
- var dir = OC.dirname(path);
- if (dir === path) {
- dir = '';
+ if (files.length > 0) {
+ for (var i = 0; i < files.length; i++) {
+ path = files[i].path;
+ fileId = files[i].fileid;
+ mimeType = files[i].mimetype;
+ mTime = files[i].mtime;
+ etag = files[i].etag;
+
+ Gallery.images.push(path);
+
+ image = new GalleryImage(path, path, fileId, mimeType, mTime, etag);
+ var dir = OC.dirname(path);
+ if (dir === path) {
+ dir = '';
+ }
+ album = Gallery.getAlbum(dir);
+ album.images.push(image);
+ Gallery.imageMap[image.path] = image;
}
- album = Gallery.getAlbum(dir);
- album.images.push(image);
- Gallery.imageMap[image.path] = image;
+ Gallery.albumCache[albumInfo.path] = {
+ etag: albumInfo.etag,
+ files: files,
+ images: Gallery.images,
+ imageMap: Gallery.imageMap,
+ albumMap: Gallery.albumMap
+ };
+ } else {
+ Gallery.getAlbum(albumInfo.path);
}
- Gallery.albumCache[albumInfo.path] = {
- etag: albumInfo.etag,
- files: files,
- images: Gallery.images,
- imageMap: Gallery.imageMap,
- albumMap: Gallery.albumMap
- };
}
}, function () {
// Triggered if we couldn't find a working folder
@@ -308,12 +318,33 @@
* Shows an empty gallery message
*/
showEmpty: function () {
- $('#emptycontent').removeClass('hidden');
+ var emptyContentElement = $('#emptycontent');
+ var message = t('gallery',
+ "No pictures found! If you upload pictures in the files app," +
+ "they will be displayed here.");
+ emptyContentElement.html(message);
+ emptyContentElement.removeClass('hidden');
$('#controls').addClass('hidden');
$('#content').removeClass('icon-loading');
},
/**
+ * Shows an empty gallery message
+ */
+ showEmptyFolder: function () {
+ var emptyContentElement = $('#emptycontent');
+ var message = t('gallery',
+ "I am sorry, but I could not find any media files at this location.");
+ emptyContentElement.html(message);
+ emptyContentElement.removeClass('hidden');
+ $('#content').removeClass('icon-loading');
+ $('#album-info-button').hide();
+ $('#share-button').hide();
+ $('#sort-name-button').hide();
+ $('#sort-date-button').hide();
+ },
+
+ /**
* Shows the infamous loading spinner
*/
showLoading: function () {
diff --git a/js/galleryview.js b/js/galleryview.js
index a2b2d5ad..502c22db 100644
--- a/js/galleryview.js
+++ b/js/galleryview.js
@@ -32,7 +32,12 @@
*/
init: function (albumPath) {
if (Gallery.images.length === 0) {
- Gallery.showEmpty();
+ //Gallery.showEmpty();
+ // FIXME Make the diff between a root and deep folder
+ Gallery.showEmptyFolder();
+ Gallery.currentAlbum = albumPath;
+ this.breadcrumb = new Gallery.Breadcrumb(albumPath);
+ this.breadcrumb.setMaxWidth($(window).width() - Gallery.buttonsWidth);
} else {
// Only do it when the app is initialised
if (this.requestId === -1) {
@@ -106,7 +111,7 @@
this.infoButtonSetup();
this.breadcrumb = new Gallery.Breadcrumb(albumPath);
- this.breadcrumb.setMaxWidth($(window).width() - 320);
+ this.breadcrumb.setMaxWidth($(window).width() - Gallery.buttonsWidth);
var currentSort = Gallery.config.albumSorting;
this.sortControlsSetup(currentSort.type, currentSort.order);
@@ -122,7 +127,7 @@
* @param {string} albumPath
*/
shareButtonSetup: function (albumPath) {
- var shareButton = $('button.share');
+ var shareButton = $('#share-button');
if (albumPath === '' || Gallery.token) {
shareButton.hide();
} else {
@@ -138,7 +143,7 @@
infoButton.find('span').hide();
var infoContentElement = $('.album-info-content');
infoContentElement.slideUp();
- infoContentElement.css('max-height', $(window).height() - 150);
+ infoContentElement.css('max-height', $(window).height() - Gallery.browserToolbarHeight);
var albumInfo = Gallery.config.albumInfo;
if (Gallery.config.albumError) {
infoButton.hide();
diff --git a/templates/part.content.php b/templates/part.content.php
index 1881b613..e9ab1926 100644
--- a/templates/part.content.php
+++ b/templates/part.content.php
@@ -76,9 +76,5 @@ style(
</span>
</div>
<div id="gallery" class="hascontrols"></div>
-<div id="emptycontent" class="hidden"><?php p(
- $l->t(
- "No pictures found! If you upload pictures in the files app, they will be displayed here."
- )
- ); ?></div>
+<div id="emptycontent" class="hidden"></div>
<input type="hidden" name="allowShareWithLink" id="allowShareWithLink" value="yes"/>
diff --git a/templates/public.php b/templates/public.php
index 9d464de1..15d0d769 100644
--- a/templates/public.php
+++ b/templates/public.php
@@ -117,12 +117,7 @@ style(
data-requesttoken="<?php p($_['requesttoken']) ?>"
data-token="<?php isset($_['token']) ? p($_['token']) : p(false) ?>">
</div>
- <div id="emptycontent" class="hidden"><?php p(
- $l->t(
- "No pictures found! If you upload pictures in the files app, they will be displayed here."
- )
- ); ?>
- </div>
+ <div id="emptycontent" class="hidden"></div>
</div>
</div>
</div>