Skip to content

Commit

Permalink
jQuery fixes and update compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Feb 2, 2021
1 parent 38b8d78 commit 92eff0d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
9 changes: 4 additions & 5 deletions admin/handlers.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,12 @@ function gigpress_update_show() {
$updateshow = $wpdb->update(GIGPRESS_SHOWS, $show, $where, $format, $where_format);

// Was the query successful?
if($updateshow != FALSE)
{
if ( false === $updateshow ) { ?>
<div id="message" class="error fade"><p><?php _e("There was an issue saving this show - please try again", "gigpress"); ?></p></div>
<?php } else {
$gpo = get_option('gigpress_settings');
?>
<div id="message" class="updated fade"><p><?php echo __("Your show on", "gigpress") . ' ' . mysql2date($gpo['date_format_long'], $show['show_date']) . ' ' . __("was successfully updated.", "gigpress"); if($show['show_related']) echo(' <a href="' . admin_url('post.php?action=edit&amp;post=' . $show['show_related']) . '">' . __("Edit the related post", "gigpress"). '.</a>'); ?></p>
<div id="message" class="updated fade"><p><?php echo __("Your show on", "gigpress") . ' ' . mysql2date($gpo['date_format_long'], $show['show_date']) . ' ' . __("was successfully updated.", "gigpress"); if($show['show_related']) {echo(' <a href="' . admin_url('post.php?action=edit&amp;post=' . $show['show_related']) . '">' . __("Edit the related post", "gigpress"). '.</a>');} ?></p>
<?php
global $errors; if($errors) {
foreach($errors as $error) {
Expand All @@ -334,8 +335,6 @@ function gigpress_update_show() {
unset($errors);
?>
</div>
<?php } elseif($updateshow === FALSE) { ?>
<div id="message" class="error fade"><p><?php _e("Something ain't right - try again?", "gigpress"); ?></p></div>
<?php }
unset($_POST, $show, $where, $format, $where_format, $updateshow);
}
Expand Down
2 changes: 1 addition & 1 deletion admin/new.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function gigpress_add() {

<h1><?php _e("Edit this show", "gigpress"); ?></h1>

<form method="post" action="<?php echo admin_url('admin.php?page=gigpress'); ?>">
<form method="post" action="<?php echo admin_url('admin.php?page=gigpress&gpaction=edit&show_id=' . (int) $show_id ); ?>">
<?php wp_nonce_field('gigpress-action') ?>
<input type="hidden" name="gpaction" value="update" />
<input type="hidden" name="show_id" value="<?php echo $show_id; ?>" />
Expand Down
4 changes: 3 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: theeventscalendar, brianjessee, camwynsp, paulkim, sc0ttkclark, aguseo, bordoni, borkweb, GeoffBel, jentheo, leahkoerper, lucatume, neillmcshea, patriciahillebrandt, vicskf, zbtirrell, juanfra
Tags: concerts, bands, tours, shows, record labels, music, musicians, performers, artists
Requires at least: 4.5
Tested up to: 5.4
Tested up to: 5.6
Stable tag: 2.3.25

GigPress is a live performance listing and management plugin that's been serving musicians and performers since 2007.
Expand Down Expand Up @@ -38,6 +38,8 @@ If you want to go beyond GigPress, we also have other plugins that could work gr

= 2.3.25 [2021-02-01] =

* Fix - When saving an existing show, it now correctly loads the show edit form again with success message.
* Fix - A few jQuery problems for WordPress 5.6 compatibility.
* Fix - Support differently named plugin folders instead of hardcoding checks for `/gigpress/`. [GP-8]
* Fix - Prevent PHP warnings for CSV exports. [GP-9]
* Tweak - Added the possibility to view and restore deleted shows. [GP-6]
Expand Down
36 changes: 18 additions & 18 deletions scripts/gigpress-admin.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
$gp=jQuery.noConflict();

$gp(document).ready(function()
$gp(function()
{
// If we're using the 12-hour clock, then do this magic
if ( $gp('select#gp_hh.twelve').length > 0 ) {
var time = $gp('select#gp_hh option:selected').parent().attr('label');
$gp('span#ampm').text(time);
$gp('select#gp_hh.twelve').change(function()

$gp('select#gp_hh.twelve').on('change',function()
{
var time = $gp('select#gp_hh option:selected').parent().attr('label');
$gp('span#ampm').text(time);
}
);
}

$gp('tr.gigpress-inactive, tbody.gigpress-inactive').hide();
$gp('input#show_multi').click(function()

$gp('input#show_multi').on('click',function()
{
// $gp('tr#expire').toggle();
// Workaround for IE 8 nonsense
$gp('tr#expire').toggle($gp('tr#expire').css('display') == 'none');
this.blur();
}
);
$gp('select.can-add-new').change(function()

$gp('select.can-add-new').on('change',function()
{
var scope = $gp(this);
var target = $gp(this).attr('id') + '_new';
Expand All @@ -37,32 +37,32 @@ $gp(document).ready(function()
}
}
);

// Return a helper with preserved width of cells
var fixHelper = function(e, ui) {
ui.children().each(function() {
$gp(this).width($gp(this).width());
});
return ui;
};

// Sortable artist table
$gp('img.gp-sort-handle').show();
$gp('.gigpress-artist-sort').sortable({
handle: '.gp-sort-handle',
handle: '.gp-sort-handle',
axis: 'y',
helper: fixHelper,
update : function () {
update : function () {
var order = $gp('.gigpress-artist-sort').sortable('serialize');
$gp("#artist-sort-update").load(ajaxurl, order + '&action=gigpress_reorder_artists&cachebuster=' + Math.floor(Math.random()*99999), function()
{
$gp("#artist-sort-update").fadeIn(100, function(){$gp(this).fadeOut(1500)});
$gp("#artist-sort-update").fadeIn(100, function(){$gp(this).fadeOut(1500)});
}
);
}
);
}
});
// Remove the "Manual Offset" optgroup from the timezone menu
$gp('select[name="gigpress_settings[timezone]"] optgroup').last().remove();

// Remove the "Manual Offset" optgroup from the timezone menu
$gp('select[name="gigpress_settings[timezone]"] optgroup').last().remove();
}
);
10 changes: 5 additions & 5 deletions scripts/gigpress.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
jQuery(document).ready(function($) {
jQuery(function($) {
$.fn.fadeToggle = function(speed, easing, callback) {
return this.animate({opacity: "toggle"}, speed, easing, callback);
};
$("a.gigpress-links-toggle").click(function() {
return this.animate({opacity: "toggle"}, speed, easing, callback);
};
$("a.gigpress-links-toggle").on('click',function() {
target = $(this).attr("href").replace(document.location.href,'');
$(target).fadeToggle("fast");
$(this).toggleClass("gigpress-link-active");
return false;
});
$("select.gigpress_menu").change(function()
$("select.gigpress_menu").on('change',function()
{
window.location = $(this).val();
});
Expand Down

0 comments on commit 92eff0d

Please sign in to comment.