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

fix deleting of tour steps, fixes #760

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