Add time/status selector to events

This commit is contained in:
Brian Miyaji
2016-09-09 18:04:52 +10:00
parent 1da48e5acf
commit 845a1eb8d6
3 changed files with 159 additions and 0 deletions

View File

@@ -775,4 +775,33 @@ jQuery(document).ready(function($){
}
});
});
// Event status selector
$('.sp-edit-event-status').click(function(e) {
e.preventDefault();
$select = $(this).siblings('.sp-event-status-select');
if ( $select.is(':hidden') ) {
$select.slideDown( 'fast', function() {
$select.find( 'input[type="radio"]' ).first().focus();
} );
$(this).hide();
}
});
$('.sp-save-event-status').click(function(e) {
e.preventDefault();
$select = $(this).closest('.sp-event-status-select');
$input = $select.find('input[name=sp_status]:checked');
val = $input.val();
label = $input.data('sp-event-status');
$select.slideUp('fast').siblings('.sp-edit-event-status').show().siblings('.sp-event-status').find('.sp-event-status-display').data('sp-event-status', val).html(label);
});
$('.sp-cancel-event-status').click(function(e) {
e.preventDefault();
$select = $(this).closest('.sp-event-status-select');
val = $select.siblings('.sp-event-status').find('.sp-event-status-display').data('sp-event-status');
$select.find('input[value='+val+']').attr('checked', true);
$select.slideUp('fast').siblings('.sp-edit-event-status').show();
});
});