mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-05-15 05:46:01 +02:00
Update Validation
Save mechanism is now fully operational
This commit is contained in:
@@ -11,10 +11,16 @@ $(document).ready(function () {
|
||||
if (user_interacted == true) {
|
||||
showUnsavedLocalBadge(pictureId);
|
||||
updateUnsavedGlobalBadge();
|
||||
console.log("Change seen on " + pictureId);
|
||||
}
|
||||
});
|
||||
|
||||
$('.icon-cancel-circled, .item-add').on('click', function() {
|
||||
var pictureId = $(this).parents("fieldset").data("image_id");
|
||||
showUnsavedLocalBadge(pictureId);
|
||||
updateUnsavedGlobalBadge();
|
||||
|
||||
});
|
||||
|
||||
function updateUnsavedGlobalBadge() {
|
||||
var visibleLocalUnsavedCount = $(".local-unsaved-badge").filter(function() {
|
||||
return $(this).css('display') === 'block';
|
||||
@@ -71,12 +77,29 @@ function hideSuccesLocalBadge(pictureId) {
|
||||
$("#picture-" + pictureId + " .local-succes-badge").css('display', 'none');
|
||||
}
|
||||
|
||||
function showLocalSaveIcon (pictureId) {
|
||||
$("#picture-" + pictureId + " .local-save-icon").css('display', 'block');
|
||||
$("#picture-" + pictureId + " .action-save-picture").css({
|
||||
'pointer-events': 'none',
|
||||
'opacity': '0.5'
|
||||
});
|
||||
}
|
||||
|
||||
function hideLocalSaveIcon(pictureId) {
|
||||
$("#picture-" + pictureId + " .local-save-icon").css('display', 'none');
|
||||
$("#picture-" + pictureId + " .action-save-picture").css({
|
||||
'pointer-events': 'auto',
|
||||
'opacity': '1'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// DELETE
|
||||
$('.action-delete-picture').on('click', function(event) {
|
||||
var $fieldset = $(this).parents("fieldset");
|
||||
var pictureId = $fieldset.data("image_id");
|
||||
|
||||
console.log(pictureId);
|
||||
|
||||
$.confirm({
|
||||
title: str_are_you_sure,
|
||||
@@ -97,7 +120,6 @@ function hideSuccesLocalBadge(pictureId) {
|
||||
btnClass: 'btn-red',
|
||||
action: function () {
|
||||
var image_ids = [pictureId];
|
||||
|
||||
(function(ids) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@@ -140,6 +162,7 @@ function hideSuccesLocalBadge(pictureId) {
|
||||
});
|
||||
|
||||
// VALIDATION
|
||||
|
||||
//Unit Save
|
||||
$('.action-save-picture').on('click', function(event) {
|
||||
var $fieldset = $(this).parents("fieldset");
|
||||
@@ -177,7 +200,7 @@ function hideSuccesLocalBadge(pictureId) {
|
||||
tags.push(tagId);
|
||||
});
|
||||
var tagsStr = tags.join(',');
|
||||
|
||||
showLocalSaveIcon(pictureId);
|
||||
$.ajax({
|
||||
url: 'ws.php?format=json',
|
||||
method: 'POST',
|
||||
@@ -197,11 +220,13 @@ function hideSuccesLocalBadge(pictureId) {
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
hideLocalSaveIcon(pictureId);
|
||||
hideUnsavedLocalBadge(pictureId);
|
||||
showSuccesLocalBadge(pictureId);
|
||||
updateUnsavedGlobalBadge();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
hideLocalSaveIcon(pictureId);
|
||||
hideUnsavedLocalBadge(pictureId);
|
||||
showErrorLocalBadge(pictureId);
|
||||
console.error('Error:', error);
|
||||
@@ -216,7 +241,6 @@ function hideSuccesLocalBadge(pictureId) {
|
||||
var pictureId = $(this).data("image_id");
|
||||
saveChanges(pictureId);
|
||||
});
|
||||
console.log("changed all")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ var sliders = {
|
||||
|
||||
<div class="calendar-box">
|
||||
<strong>{'Creation date'|@translate}</strong>
|
||||
<input type="hidden" id="date_creation-{$element.id}" name="date_creation" value="{$element.DATE_CREATION}">
|
||||
<input type="hidden" id="date_creation-{$element.id}" name="date_creation-{$element.id}" value="{$element.DATE_CREATION}">
|
||||
<label class="calendar-input">
|
||||
<i class="icon-calendar"></i>
|
||||
<input type="text" data-datepicker="date_creation-{$element.id}" data-datepicker-unset="date_creation_unset-{$element.id}" readonly>
|
||||
@@ -452,6 +452,7 @@ var sliders = {
|
||||
</div>
|
||||
<div class="validation-container">
|
||||
<div class="buttonLike action-save-picture"><i class="icon-floppy"></i>{'Submit'|@translate}</div>
|
||||
<i class="local-save-icon icon-spin6 animate-spin" style="display: none;"></i>
|
||||
<div class="local-unsaved-badge badge-container" style="display: none;"><p class="badge-unsaved"><i class="icon-attention"></i>Changes pending</p></div>
|
||||
<div class="local-succes-badge badge-container" style="display: none;"><p class="badge-succes"><i class="icon-ok"></i>Changes saved</p></div>
|
||||
<div class="local-error-badge badge-container" style="display: none;"><p class="badge-error"><i class="icon-cancel"></i>Error during save</p></div>
|
||||
@@ -489,16 +490,17 @@ var sliders = {
|
||||
<span id="unsaved-count"></span> image(s) contains unsaved changes
|
||||
</p>
|
||||
</div>
|
||||
<div class="badge-container global-succes-badge" style="display: none;">
|
||||
<div class="badge-container global-succes-badge" style="display: none;">
|
||||
<p class="badge-succes"><i class="icon-attention"></i>
|
||||
Changes saved
|
||||
</p>
|
||||
</div>
|
||||
<div class="badge-container global-error-badge" style="display: none;">
|
||||
<div class="badge-container global-error-badge" style="display: none;">
|
||||
<p class="badge-error"><i class="icon-attention"></i>
|
||||
Error during save
|
||||
</p>
|
||||
</div>
|
||||
<i class="global-save-icon icon-spin6 animate-spin" style="display: none;"></i>
|
||||
<div class="buttonLike action-save-global"><i class="icon-floppy"></i>Save all photos</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2290,6 +2290,7 @@ SELECT path
|
||||
*/
|
||||
function ws_images_setInfo($params, $service)
|
||||
{
|
||||
sleep(5);
|
||||
global $conf;
|
||||
|
||||
if (isset($params['pwg_token']) and get_pwg_token() != $params['pwg_token'])
|
||||
|
||||
Reference in New Issue
Block a user