Skip to content
Snippets Groups Projects
Commit fa94ef62 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fix deleting of tour steps, fixes #760

parent ac137b4c
No related branches found
No related tags found
No related merge requests found
......@@ -402,8 +402,8 @@ class TourController extends AuthenticatedController
$this->response->add_header('X-Action', 'question');
return (string) QuestionBox::create(
sprintf(_('Wollen Sie Schritt %s wirklich löschen?'), $step_nr),
$this->url_for('tour/admin_overview', ['confirm_delete_tour_step' => $step_nr, 'tour_id' => $tour_id, 'step_nr' => $step_nr]),
$this->url_for('tour/admin_overview')
$this->url_for("tour/admin_details/{$tour_id}", ['confirm_delete_tour_step' => $step_nr]),
$this->url_for("tour/admin_details/{$tour_id}")
);
}
return '';
......
......@@ -447,14 +447,28 @@ const Tour = {
jQuery('.tour_focus_box').removeClass('tour_focus_box');
}
jQuery('body').prepend(html);
jQuery('.modaloverlay').find('.ui-dialog-titlebar-close, .cancel.button').click(event => {
event.preventDefault();
event.stopPropagation();
if (Tour.started) {
jQuery('#tour_controls').show();
jQuery('#tour_tip').show();
jQuery('#tour_tip_interactive').show();
jQuery('#tour_selector_overlay').show();
}
$('.modaloverlay').remove();
});
jQuery('.modaloverlay form').on('click', function(event) {
jQuery(this).data('clicked', jQuery(event.target));
});
jQuery('.modaloverlay form').on('submit', function(event) {
event.preventDefault();
Tour.deleteStep(
jQuery('.modaloverlay form input[name=tour_id]').val(),
jQuery('.modaloverlay form input[name=step_nr]').val(),
tour_id,
step_nr,
jQuery(this)
.data('clicked')
.attr('name')
......@@ -463,9 +477,7 @@ const Tour = {
});
} else if (xhr.getResponseHeader('X-Action') === 'complete') {
if (Tour.started) {
Tour.showControlButtons();
Tour.setTooltip(Tour.options.data[Tour.step]);
Tour.started = false;
Tour.destroy();
if (step_nr > 1 && step_nr - Tour.options.route_step_nr >= Tour.steps - 1) {
Tour.init(tour_id, step_nr - 1);
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment