Streamlined type of star and public

This commit is contained in:
Tobias Reich 2015-02-27 22:14:19 +01:00
parent b226f879b0
commit 138bf714c5
5 changed files with 56 additions and 50 deletions

BIN
dist/main.js vendored

Binary file not shown.

View File

@ -384,7 +384,7 @@ album.setPublic = function(albumID, e) {
albums.refresh(); albums.refresh();
if (!basicModal.visible()&&album.json.public==0) { if (!basicModal.visible()&&album.json.public==='0') {
var msg = '', var msg = '',
action; action;
@ -475,7 +475,7 @@ album.setPublic = function(albumID, e) {
view.album.public(); view.album.public();
view.album.password(); view.album.password();
if (album.json.public==1) contextMenu.shareAlbum(albumID, e); if (album.json.public==='1') contextMenu.shareAlbum(albumID, e);
} }

View File

@ -25,45 +25,7 @@ albums.load = function() {
api.post('Album::getAll', {}, function(data) { api.post('Album::getAll', {}, function(data) {
/* Smart Albums */ /* Smart Albums */
data.smartalbums.unsorted = { if (lychee.publicMode===false) albums._createSmartAlbums(data.smartalbums);
id: 0,
title: 'Unsorted',
sysdate: data.smartalbums.unsorted.num + ' photos',
unsorted: '1',
thumb0: data.smartalbums.unsorted.thumb0,
thumb1: data.smartalbums.unsorted.thumb1,
thumb2: data.smartalbums.unsorted.thumb2
};
data.smartalbums.starred = {
id: 'f',
title: 'Starred',
sysdate: data.smartalbums.starred.num + ' photos',
star: '1',
thumb0: data.smartalbums.starred.thumb0,
thumb1: data.smartalbums.starred.thumb1,
thumb2: data.smartalbums.starred.thumb2
};
data.smartalbums.public = {
id: 's',
title: 'Public',
sysdate: data.smartalbums.public.num + ' photos',
public: '1',
thumb0: data.smartalbums.public.thumb0,
thumb1: data.smartalbums.public.thumb1,
thumb2: data.smartalbums.public.thumb2
};
data.smartalbums.recent = {
id: 'r',
title: 'Recent',
sysdate: data.smartalbums.recent.num + ' photos',
recent: '1',
thumb0: data.smartalbums.recent.thumb0,
thumb1: data.smartalbums.recent.thumb1,
thumb2: data.smartalbums.recent.thumb2
};
albums.json = data; albums.json = data;
@ -108,6 +70,50 @@ albums.parse = function(album) {
} }
albums._createSmartAlbums = function(data) {
data.unsorted = {
id: 0,
title: 'Unsorted',
sysdate: data.unsorted.num + ' photos',
unsorted: '1',
thumb0: data.unsorted.thumb0,
thumb1: data.unsorted.thumb1,
thumb2: data.unsorted.thumb2
};
data.starred = {
id: 'f',
title: 'Starred',
sysdate: data.starred.num + ' photos',
star: '1',
thumb0: data.starred.thumb0,
thumb1: data.starred.thumb1,
thumb2: data.starred.thumb2
};
data.public = {
id: 's',
title: 'Public',
sysdate: data.public.num + ' photos',
public: '1',
thumb0: data.public.thumb0,
thumb1: data.public.thumb1,
thumb2: data.public.thumb2
};
data.recent = {
id: 'r',
title: 'Recent',
sysdate: data.recent.num + ' photos',
recent: '1',
thumb0: data.recent.thumb0,
thumb1: data.recent.thumb1,
thumb2: data.recent.thumb2
};
}
albums.refresh = function() { albums.refresh = function() {
albums.json = null; albums.json = null;

View File

@ -393,12 +393,12 @@ photo.setStar = function(photoIDs) {
if (!photoIDs) return false; if (!photoIDs) return false;
if (visible.photo()) { if (visible.photo()) {
photo.json.star = (photo.json.star==0) ? 1 : 0; photo.json.star = (photo.json.star==='0') ? '1' : '0';
view.photo.star(); view.photo.star();
} }
photoIDs.forEach(function(id, index, array) { photoIDs.forEach(function(id, index, array) {
album.json.content[id].star = (album.json.content[id].star==0) ? 1 : 0; album.json.content[id].star = (album.json.content[id].star==='0') ? '1' : '0';
view.album.content.star(id); view.album.content.star(id);
}); });
@ -449,13 +449,13 @@ photo.setPublic = function(photoID, e) {
if (visible.photo()) { if (visible.photo()) {
photo.json.public = (photo.json.public==0) ? 1 : 0; photo.json.public = (photo.json.public==='0') ? '1' : '0';
view.photo.public(); view.photo.public();
if (photo.json.public==1) contextMenu.sharePhoto(photoID, e); if (photo.json.public==='1') contextMenu.sharePhoto(photoID, e);
} }
album.json.content[photoID].public = (album.json.content[photoID].public==0) ? 1 : 0; album.json.content[photoID].public = (album.json.content[photoID].public==='0') ? '1' : '0';
view.album.content.public(photoID); view.album.content.public(photoID);
albums.refresh(); albums.refresh();

View File

@ -209,14 +209,14 @@ view.album = {
star: function(photoID) { star: function(photoID) {
$('.photo[data-id="' + photoID + '"] .iconic-star').remove(); $('.photo[data-id="' + photoID + '"] .iconic-star').remove();
if (album.json.content[photoID].star==1) $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-star'>" + build.iconic('star') + "</a>"); if (album.json.content[photoID].star==='1') $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-star'>" + build.iconic('star') + "</a>");
}, },
public: function(photoID) { public: function(photoID) {
$('.photo[data-id="' + photoID + '"] .iconic-share').remove(); $('.photo[data-id="' + photoID + '"] .iconic-share').remove();
if (album.json.content[photoID].public==1) $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-share'>" + build.iconic('eye') + "</a>"); if (album.json.content[photoID].public==='1') $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-share'>" + build.iconic('eye') + "</a>");
}, },
@ -253,7 +253,7 @@ view.album = {
public: function() { public: function() {
if (album.json.public==1) { if (album.json.public==='1') {
$('#button_share_album') $('#button_share_album')
.addClass('active') .addClass('active')
@ -378,7 +378,7 @@ view.photo = {
public: function() { public: function() {
if (photo.json.public==1||photo.json.public==2) { if (photo.json.public==='1'||photo.json.public==='2') {
// Photo public // Photo public
$('#button_share') $('#button_share')
.addClass('active') .addClass('active')