Skip to content

Commit 030403b

Browse files
feat: redirect user once staging is created
1 parent af86c8a commit 030403b

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

assets/js/admin.js

+28-24
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@
145145
// Show image comparison
146146
var html = '<div class="stl-image-comparison">';
147147
html += '<h3>Image Comparison</h3>';
148-
148+
149149
html += '<div class="stl-image-container">';
150-
150+
151151
// Production image
152152
html += '<div class="stl-image-side">';
153153
html += '<h4>Production Version</h4>';
@@ -160,7 +160,7 @@
160160
html += '<div class="stl-image-missing">Image does not exist in production</div>';
161161
}
162162
html += '</div>';
163-
163+
164164
// Staging image
165165
html += '<div class="stl-image-side">';
166166
html += '<h4>Staging Version</h4>';
@@ -173,12 +173,12 @@
173173
html += '<div class="stl-image-missing">Image does not exist in staging</div>';
174174
}
175175
html += '</div>';
176-
176+
177177
html += '</div>'; // Close stl-image-container
178178
html += '</div>'; // Close stl-image-comparison
179-
179+
180180
$fileDiffModal.find('.stl-modal-body').html(html);
181-
181+
182182
// Make the modal wider for image comparison
183183
$fileDiffModal.find('.stl-modal-content').addClass('stl-modal-wide');
184184
} else {
@@ -201,27 +201,27 @@
201201
html += '</div>';
202202

203203
$fileDiffModal.find('.stl-modal-body').html(html);
204-
204+
205205
// Reset modal width
206206
$fileDiffModal.find('.stl-modal-content').removeClass('stl-modal-wide');
207207
}
208208
} else {
209209
// Show diff for text files
210210
$fileDiffModal.find('.stl-modal-body').html('<div class="stl-diff">' + response.data.diff + '</div>');
211-
211+
212212
// Reset modal width
213213
$fileDiffModal.find('.stl-modal-content').removeClass('stl-modal-wide');
214214
}
215215
} else {
216216
$fileDiffModal.find('.stl-modal-body').html('<div class="notice notice-error"><p>' + response.data.message + '</p></div>');
217-
217+
218218
// Reset modal width
219219
$fileDiffModal.find('.stl-modal-content').removeClass('stl-modal-wide');
220220
}
221221
},
222222
error: function() {
223223
$fileDiffModal.find('.stl-modal-body').html('<div class="notice notice-error"><p>Error fetching file diff.</p></div>');
224-
224+
225225
// Reset modal width
226226
$fileDiffModal.find('.stl-modal-content').removeClass('stl-modal-wide');
227227
}
@@ -335,11 +335,11 @@
335335
// Toggle group content visibility
336336
$(document).on('click', '.stl-toggle-group', function(e) {
337337
e.preventDefault();
338-
338+
339339
var groupId = $(this).data('group-id');
340340
var $content = $('#group-content-' + groupId);
341341
var $button = $(this);
342-
342+
343343
if ($content.is(':visible')) {
344344
$content.slideUp(200);
345345
$button.text(stl_admin.i18n.show_details || 'Show Details');
@@ -412,14 +412,14 @@
412412
var isChecked = $(this).prop('checked');
413413
var table = $(this).data('table');
414414
var group = $(this).data('group');
415-
415+
416416
// Select/deselect all checkboxes for this table in this group
417417
$('.stl-group-item[data-group="' + group + '"][data-table="' + table + '"]').prop('checked', isChecked);
418-
418+
419419
// Update selected DB entries
420420
updateSelectedDBEntries();
421421
updateSyncButtonState();
422-
422+
423423
// Check if all tables are selected/deselected and update group checkbox
424424
updateGroupCheckboxState(group);
425425
});
@@ -428,13 +428,13 @@
428428
$(document).on('change', '.stl-select-group', function() {
429429
var isChecked = $(this).prop('checked');
430430
var groupId = $(this).data('group-id');
431-
431+
432432
// Select/deselect all checkboxes in this group
433433
$('.stl-group-item[data-group="' + groupId + '"]').prop('checked', isChecked);
434-
434+
435435
// Also update the "select all table" checkboxes in this group
436436
$('.stl-select-all-table[data-group="' + groupId + '"]').prop('checked', isChecked);
437-
437+
438438
// Update selected DB entries
439439
updateSelectedDBEntries();
440440
updateSyncButtonState();
@@ -445,15 +445,15 @@
445445
// Update selected DB entries
446446
updateSelectedDBEntries();
447447
updateSyncButtonState();
448-
448+
449449
// If this is part of a group, update the group and table checkbox states
450450
if ($(this).hasClass('stl-group-item')) {
451451
var group = $(this).data('group');
452452
var table = $(this).data('table');
453-
453+
454454
// Update the table checkbox state
455455
updateTableCheckboxState(group, table);
456-
456+
457457
// Update the group checkbox state
458458
updateGroupCheckboxState(group);
459459
} else {
@@ -471,7 +471,7 @@
471471
var $tableItems = $('.stl-group-item[data-group="' + group + '"][data-table="' + table + '"]');
472472
var $checkedItems = $tableItems.filter(':checked');
473473
var allChecked = $tableItems.length === $checkedItems.length;
474-
474+
475475
$('.stl-select-all-table[data-group="' + group + '"][data-table="' + table + '"]').prop('checked', allChecked);
476476
}
477477

@@ -482,7 +482,7 @@
482482
var $groupItems = $('.stl-group-item[data-group="' + group + '"]');
483483
var $checkedItems = $groupItems.filter(':checked');
484484
var allChecked = $groupItems.length === $checkedItems.length;
485-
485+
486486
$('.stl-select-group[data-group-id="' + group + '"]').prop('checked', allChecked);
487487
}
488488

@@ -522,7 +522,7 @@
522522
if (group && checkedGroups[group]) {
523523
try {
524524
var data = JSON.parse($(this).val());
525-
525+
526526
// Only add if it's checked or part of a group with other checked items
527527
if ($(this).prop('checked')) {
528528
// Add the group info to the data
@@ -725,6 +725,10 @@ jQuery(document).ready(function(){
725725
.css( { "float":"right", "visibility":"none" } );
726726

727727
jQuery( "a#create-staging" ).css( { "pointer-events":"unset", "color":"#fff" } );
728+
729+
setTimeout(function() {
730+
location.reload();
731+
}, 5000);
728732
}
729733
});
730734
});

assets/js/admin.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)