New dialogs
This commit is contained in:
parent
17d96ef3d2
commit
53c1366e7e
BIN
dist/main.js
vendored
BIN
dist/main.js
vendored
Binary file not shown.
@ -251,13 +251,10 @@ album.setTitle = function(albumIDs) {
|
|||||||
action = function(data) {
|
action = function(data) {
|
||||||
|
|
||||||
var params,
|
var params,
|
||||||
newTitle;
|
newTitle = data.title;
|
||||||
|
|
||||||
basicModal.close();
|
basicModal.close();
|
||||||
|
|
||||||
// Get input
|
|
||||||
newTitle = data.title;
|
|
||||||
|
|
||||||
// Remove html from input
|
// Remove html from input
|
||||||
newTitle = lychee.removeHTML(newTitle);
|
newTitle = lychee.removeHTML(newTitle);
|
||||||
|
|
||||||
@ -301,7 +298,7 @@ album.setTitle = function(albumIDs) {
|
|||||||
body: msg,
|
body: msg,
|
||||||
buttons: {
|
buttons: {
|
||||||
action: {
|
action: {
|
||||||
title: 'Set title',
|
title: 'Set Title',
|
||||||
fn: action
|
fn: action
|
||||||
},
|
},
|
||||||
cancel: {
|
cancel: {
|
||||||
@ -315,23 +312,25 @@ album.setTitle = function(albumIDs) {
|
|||||||
|
|
||||||
album.setDescription = function(photoID) {
|
album.setDescription = function(photoID) {
|
||||||
|
|
||||||
var oldDescription = album.json.description.replace("'", ''');
|
var oldDescription = album.json.description.replace("'", '''),
|
||||||
|
action;
|
||||||
|
|
||||||
action = function(data) {
|
action = function(data) {
|
||||||
|
|
||||||
var params;
|
var params,
|
||||||
|
description = data.description;
|
||||||
|
|
||||||
basicModal.close();
|
basicModal.close();
|
||||||
|
|
||||||
// Remove html from input
|
// Remove html from input
|
||||||
data.description = lychee.removeHTML(data.description);
|
description = lychee.removeHTML(description);
|
||||||
|
|
||||||
if (visible.album()) {
|
if (visible.album()) {
|
||||||
album.json.description = data.description;
|
album.json.description = description;
|
||||||
view.album.description();
|
view.album.description();
|
||||||
}
|
}
|
||||||
|
|
||||||
params = 'setAlbumDescription&albumID=' + photoID + '&description=' + escape(encodeURI(data.description));
|
params = 'setAlbumDescription&albumID=' + photoID + '&description=' + escape(encodeURI(description));
|
||||||
lychee.api(params, function(data) {
|
lychee.api(params, function(data) {
|
||||||
|
|
||||||
if (data!==true) lychee.error(null, params, data);
|
if (data!==true) lychee.error(null, params, data);
|
||||||
@ -378,11 +377,9 @@ album.setPublic = function(albumID, e) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
msg = "<p class='less'>This album will be shared with the following properties:</p><form>";
|
msg = "<p class='less'>This album will be shared with the following properties:</p><form>";
|
||||||
|
|
||||||
msg += "<div class='choice'><label><input type='checkbox' name='listed' checked><span class='checkbox'>" + build.iconic('check') + "</span><span class='label'>Visible</span></label><p>Listed to visitors of your Lychee.</p></div>";
|
msg += "<div class='choice'><label><input type='checkbox' name='listed' checked><span class='checkbox'>" + build.iconic('check') + "</span><span class='label'>Visible</span></label><p>Listed to visitors of your Lychee.</p></div>";
|
||||||
msg += "<div class='choice'><label><input type='checkbox' name='downloadable'><span class='checkbox'>" + build.iconic('check') + "</span><span class='label'>Downloadable</span></label><p>Visitors of your Lychee can download this album.</p></div>";
|
msg += "<div class='choice'><label><input type='checkbox' name='downloadable'><span class='checkbox'>" + build.iconic('check') + "</span><span class='label'>Downloadable</span></label><p>Visitors of your Lychee can download this album.</p></div>";
|
||||||
msg += "<div class='choice'><label><input type='checkbox' name='password'><span class='checkbox'>" + build.iconic('check') + "</span><span class='label'>Password protected</span></label><p>Only accessible with a valid password.</p><input class='text' data-name='password' type='password' placeholder='password' value=''></div>";
|
msg += "<div class='choice'><label><input type='checkbox' name='password'><span class='checkbox'>" + build.iconic('check') + "</span><span class='label'>Password protected</span></label><p>Only accessible with a valid password.</p><input class='text' data-name='password' type='password' placeholder='password' value=''></div>";
|
||||||
|
|
||||||
msg += "</form>"
|
msg += "</form>"
|
||||||
|
|
||||||
basicModal.show({
|
basicModal.show({
|
||||||
|
@ -168,9 +168,10 @@ photo.duplicate = function(photoIDs) {
|
|||||||
|
|
||||||
photo.delete = function(photoIDs) {
|
photo.delete = function(photoIDs) {
|
||||||
|
|
||||||
var params,
|
var action = {},
|
||||||
buttons,
|
cancel = {},
|
||||||
photoTitle;
|
msg = '',
|
||||||
|
photoTitle = '';
|
||||||
|
|
||||||
if (!photoIDs) return false;
|
if (!photoIDs) return false;
|
||||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs];
|
if (photoIDs instanceof Array===false) photoIDs = [photoIDs];
|
||||||
@ -186,72 +187,87 @@ photo.delete = function(photoIDs) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons = [
|
action.fn = function() {
|
||||||
['', function() {
|
|
||||||
|
|
||||||
var nextPhoto = '',
|
var params = '',
|
||||||
previousPhoto = '';
|
nextPhoto = '',
|
||||||
|
previousPhoto = '';
|
||||||
|
|
||||||
photoIDs.forEach(function(id, index, array) {
|
basicModal.close();
|
||||||
|
|
||||||
// Change reference for the next and previous photo
|
photoIDs.forEach(function(id, index, array) {
|
||||||
if (album.json.content[id].nextPhoto!==''||album.json.content[id].previousPhoto!=='') {
|
|
||||||
|
|
||||||
nextPhoto = album.json.content[id].nextPhoto;
|
// Change reference for the next and previous photo
|
||||||
previousPhoto = album.json.content[id].previousPhoto;
|
if (album.json.content[id].nextPhoto!==''||album.json.content[id].previousPhoto!=='') {
|
||||||
|
|
||||||
album.json.content[previousPhoto].nextPhoto = nextPhoto;
|
nextPhoto = album.json.content[id].nextPhoto;
|
||||||
album.json.content[nextPhoto].previousPhoto = previousPhoto;
|
previousPhoto = album.json.content[id].previousPhoto;
|
||||||
|
|
||||||
}
|
album.json.content[previousPhoto].nextPhoto = nextPhoto;
|
||||||
|
album.json.content[nextPhoto].previousPhoto = previousPhoto;
|
||||||
|
|
||||||
album.json.content[id] = null;
|
}
|
||||||
view.album.content.delete(id);
|
|
||||||
|
|
||||||
});
|
album.json.content[id] = null;
|
||||||
|
view.album.content.delete(id);
|
||||||
|
|
||||||
albums.refresh();
|
});
|
||||||
|
|
||||||
// Go to next photo if there is a next photo and
|
albums.refresh();
|
||||||
// next photo is not the current one. Show album otherwise.
|
|
||||||
if (visible.photo()&&nextPhoto!==''&&nextPhoto!==photo.getID()) lychee.goto(album.getID() + '/' + nextPhoto);
|
|
||||||
else if (!visible.albums()) lychee.goto(album.getID());
|
|
||||||
|
|
||||||
params = 'deletePhoto&photoIDs=' + photoIDs;
|
// Go to next photo if there is a next photo and
|
||||||
lychee.api(params, function(data) {
|
// next photo is not the current one. Show album otherwise.
|
||||||
|
if (visible.photo()&&nextPhoto!==''&&nextPhoto!==photo.getID()) lychee.goto(album.getID() + '/' + nextPhoto);
|
||||||
|
else if (!visible.albums()) lychee.goto(album.getID());
|
||||||
|
|
||||||
if (data!==true) lychee.error(null, params, data);
|
params = 'deletePhoto&photoIDs=' + photoIDs;
|
||||||
|
lychee.api(params, function(data) {
|
||||||
|
|
||||||
});
|
if (data!==true) lychee.error(null, params, data);
|
||||||
|
|
||||||
}],
|
});
|
||||||
['', function() {}]
|
|
||||||
];
|
}
|
||||||
|
|
||||||
if (photoIDs.length===1) {
|
if (photoIDs.length===1) {
|
||||||
|
|
||||||
buttons[0][0] = 'Delete Photo';
|
action.title = 'Delete Photo';
|
||||||
buttons[1][0] = 'Keep Photo';
|
cancel.title = 'Keep Photo';
|
||||||
|
|
||||||
modal.show('Delete Photo', "Are you sure you want to delete the photo '" + photoTitle + "'?<br>This action can't be undone!", buttons);
|
msg = "<p>Are you sure you want to delete the photo '" + photoTitle + "'?<br>This action can't be undone!</p>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
buttons[0][0] = 'Delete Photos';
|
action.title = 'Delete Photo';
|
||||||
buttons[1][0] = 'Keep Photos';
|
cancel.title = 'Keep Photo';
|
||||||
|
|
||||||
modal.show('Delete Photos', "Are you sure you want to delete all " + photoIDs.length + " selected photo?<br>This action can't be undone!", buttons);
|
msg = "<p>Are you sure you want to delete all " + photoIDs.length + " selected photo?<br>This action can't be undone!</p>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
basicModal.show({
|
||||||
|
body: msg,
|
||||||
|
buttons: {
|
||||||
|
action: {
|
||||||
|
title: action.title,
|
||||||
|
fn: action.fn,
|
||||||
|
class: 'red'
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
title: cancel.title,
|
||||||
|
fn: basicModal.close
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
photo.setTitle = function(photoIDs) {
|
photo.setTitle = function(photoIDs) {
|
||||||
|
|
||||||
var oldTitle = '',
|
var oldTitle = '',
|
||||||
newTitle,
|
input = '',
|
||||||
params,
|
msg = '',
|
||||||
buttons;
|
action;
|
||||||
|
|
||||||
if (!photoIDs) return false;
|
if (!photoIDs) return false;
|
||||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs];
|
if (photoIDs instanceof Array===false) photoIDs = [photoIDs];
|
||||||
@ -263,38 +279,53 @@ photo.setTitle = function(photoIDs) {
|
|||||||
oldTitle = oldTitle.replace("'", ''');
|
oldTitle = oldTitle.replace("'", ''');
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons = [
|
action = function(data) {
|
||||||
['Set Title', function() {
|
|
||||||
|
|
||||||
// Get input
|
var params,
|
||||||
newTitle = $('.message input.text').val();
|
newTitle = data.title;
|
||||||
|
|
||||||
// Remove html from input
|
basicModal.close();
|
||||||
newTitle = lychee.removeHTML(newTitle);
|
|
||||||
|
|
||||||
if (visible.photo()) {
|
// Remove html from input
|
||||||
photo.json.title = (newTitle==='') ? 'Untitled' : newTitle;
|
newTitle = lychee.removeHTML(newTitle);
|
||||||
view.photo.title();
|
|
||||||
|
if (visible.photo()) {
|
||||||
|
photo.json.title = (newTitle==='') ? 'Untitled' : newTitle;
|
||||||
|
view.photo.title();
|
||||||
|
}
|
||||||
|
|
||||||
|
photoIDs.forEach(function(id, index, array) {
|
||||||
|
album.json.content[id].title = newTitle;
|
||||||
|
view.album.content.title(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
params = 'setPhotoTitle&photoIDs=' + photoIDs + '&title=' + escape(encodeURI(newTitle));
|
||||||
|
lychee.api(params, function(data) {
|
||||||
|
|
||||||
|
if (data!==true) lychee.error(null, params, data);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
input = "<input class='text' data-name='title' type='text' maxlength='30' placeholder='Title' value='" + oldTitle + "'>";
|
||||||
|
|
||||||
|
if (photoIDs.length===1) msg = "<p>Enter a new title for this photo: " + input + "</p>";
|
||||||
|
else msg = "<p>Enter a title for all " + photoIDs.length + " selected photos: " + input + "</p>";
|
||||||
|
|
||||||
|
basicModal.show({
|
||||||
|
body: msg,
|
||||||
|
buttons: {
|
||||||
|
action: {
|
||||||
|
title: 'Set title',
|
||||||
|
fn: action
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
title: 'Cancel',
|
||||||
|
fn: basicModal.close
|
||||||
}
|
}
|
||||||
|
}
|
||||||
photoIDs.forEach(function(id, index, array) {
|
});
|
||||||
album.json.content[id].title = newTitle;
|
|
||||||
view.album.content.title(id);
|
|
||||||
});
|
|
||||||
|
|
||||||
params = 'setPhotoTitle&photoIDs=' + photoIDs + '&title=' + escape(encodeURI(newTitle));
|
|
||||||
lychee.api(params, function(data) {
|
|
||||||
|
|
||||||
if (data!==true) lychee.error(null, params, data);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}],
|
|
||||||
['Cancel', function() {}]
|
|
||||||
];
|
|
||||||
|
|
||||||
if (photoIDs.length===1) modal.show('Set Title', "Enter a new title for this photo: <input class='text' type='text' maxlength='30' placeholder='Title' value='" + oldTitle + "'>", buttons);
|
|
||||||
else modal.show('Set Titles', "Enter a title for all " + photoIDs.length + " selected photos: <input class='text' type='text' maxlength='30' placeholder='Title' value=''>", buttons);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +400,29 @@ photo.setPublic = function(photoID, e) {
|
|||||||
|
|
||||||
if (photo.json.public==2) {
|
if (photo.json.public==2) {
|
||||||
|
|
||||||
modal.show('Public Album', "This photo is located in a public album. To make this photo private or public, edit the visibility of the associated album.", [['Show Album', function() { lychee.goto(photo.json.original_album) }], ['Close', function() {}]]);
|
var action;
|
||||||
|
|
||||||
|
action = function() {
|
||||||
|
|
||||||
|
basicModal.close();
|
||||||
|
lychee.goto(photo.json.original_album);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
basicModal.show({
|
||||||
|
body: "<p>This photo is located in a public album. To make this photo private or public, edit the visibility of the associated album.</p>",
|
||||||
|
buttons: {
|
||||||
|
action: {
|
||||||
|
title: 'Show Album',
|
||||||
|
fn: action
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
title: 'Cancel',
|
||||||
|
fn: basicModal.close
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -399,44 +452,53 @@ photo.setPublic = function(photoID, e) {
|
|||||||
photo.setDescription = function(photoID) {
|
photo.setDescription = function(photoID) {
|
||||||
|
|
||||||
var oldDescription = photo.json.description.replace("'", '''),
|
var oldDescription = photo.json.description.replace("'", '''),
|
||||||
description,
|
action;
|
||||||
params,
|
|
||||||
buttons;
|
|
||||||
|
|
||||||
buttons = [
|
action = function(data) {
|
||||||
['Set Description', function() {
|
|
||||||
|
|
||||||
// Get input
|
var params,
|
||||||
description = $('.message input.text').val();
|
description = data.description;
|
||||||
|
|
||||||
// Remove html from input
|
basicModal.close();
|
||||||
description = lychee.removeHTML(description);
|
|
||||||
|
|
||||||
if (visible.photo()) {
|
// Remove html from input
|
||||||
photo.json.description = description;
|
description = lychee.removeHTML(description);
|
||||||
view.photo.description();
|
|
||||||
|
if (visible.photo()) {
|
||||||
|
photo.json.description = description;
|
||||||
|
view.photo.description();
|
||||||
|
}
|
||||||
|
|
||||||
|
params = 'setPhotoDescription&photoID=' + photoID + '&description=' + escape(encodeURI(description));
|
||||||
|
lychee.api(params, function(data) {
|
||||||
|
|
||||||
|
if (data!==true) lychee.error(null, params, data);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
basicModal.show({
|
||||||
|
body: "<p>Enter a description for this photo: <input class='text' data-name='description' type='text' maxlength='800' placeholder='Description' value='" + oldDescription + "'></p>",
|
||||||
|
buttons: {
|
||||||
|
action: {
|
||||||
|
title: 'Set Description',
|
||||||
|
fn: action
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
title: 'Cancel',
|
||||||
|
fn: basicModal.close
|
||||||
}
|
}
|
||||||
|
}
|
||||||
params = 'setPhotoDescription&photoID=' + photoID + '&description=' + escape(encodeURI(description));
|
});
|
||||||
lychee.api(params, function(data) {
|
|
||||||
|
|
||||||
if (data!==true) lychee.error(null, params, data);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}],
|
|
||||||
['Cancel', function() {}]
|
|
||||||
];
|
|
||||||
|
|
||||||
modal.show('Set Description', "Enter a description for this photo: <input class='text' type='text' maxlength='800' placeholder='Description' value='" + oldDescription + "'>", buttons);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
photo.editTags = function(photoIDs) {
|
photo.editTags = function(photoIDs) {
|
||||||
|
|
||||||
var oldTags = '',
|
var oldTags = '',
|
||||||
tags = '',
|
msg = '',
|
||||||
buttons;
|
input = '';
|
||||||
|
|
||||||
if (!photoIDs) return false;
|
if (!photoIDs) return false;
|
||||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs];
|
if (photoIDs instanceof Array===false) photoIDs = [photoIDs];
|
||||||
@ -456,19 +518,31 @@ photo.editTags = function(photoIDs) {
|
|||||||
// Improve tags
|
// Improve tags
|
||||||
oldTags = oldTags.replace(/,/g, ', ');
|
oldTags = oldTags.replace(/,/g, ', ');
|
||||||
|
|
||||||
buttons = [
|
action = function(data) {
|
||||||
['Set Tags', function() {
|
|
||||||
|
|
||||||
tags = $('.message input.text').val();
|
basicModal.close();
|
||||||
|
photo.setTags(photoIDs, data.tags);
|
||||||
|
|
||||||
photo.setTags(photoIDs, tags);
|
}
|
||||||
|
|
||||||
}],
|
input = "<input class='text' data-name='tags' type='text' maxlength='800' placeholder='Tags' value='" + oldTags + "'>";
|
||||||
['Cancel', function() {}]
|
|
||||||
];
|
|
||||||
|
|
||||||
if (photoIDs.length===1) modal.show('Set Tags', "Enter your tags for this photo. You can add multiple tags by separating them with a comma: <input class='text' type='text' maxlength='800' placeholder='Tags' value='" + oldTags + "'>", buttons);
|
if (photoIDs.length===1) msg = "<p>Enter your tags for this photo. You can add multiple tags by separating them with a comma: " + input + "</p>";
|
||||||
else modal.show('Set Tags', "Enter your tags for all " + photoIDs.length + " selected photos. Existing tags will be overwritten. You can add multiple tags by separating them with a comma: <input class='text' type='text' maxlength='800' placeholder='Tags' value='" + oldTags + "'>", buttons);
|
else msg = "<p>Enter your tags for all " + photoIDs.length + " selected photos. Existing tags will be overwritten. You can add multiple tags by separating them with a comma: " + input + "</p>";
|
||||||
|
|
||||||
|
basicModal.show({
|
||||||
|
body: msg,
|
||||||
|
buttons: {
|
||||||
|
action: {
|
||||||
|
title: 'Set Tags',
|
||||||
|
fn: action
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
title: 'Cancel',
|
||||||
|
fn: basicModal.close
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user