Commit af09ab8c authored by Klaus-Dieter Quibeldey-Cirkel's avatar Klaus-Dieter Quibeldey-Cirkel 🏀

Merge branch '1376-when-exiting-a-presentation-show-a-pop-up' into 'staging'

Resolve "When exiting a presentation, show a pop-up"

Closes #1376

See merge request arsnova/flashcards!1634
parents 21d5dc63 975aaa2c
......@@ -1796,6 +1796,24 @@
"confirm": "Konto",
"cancel": "Schließen"
}
},
"presentation": {
"end": {
"title": "Willst du die Präsentation beenden?",
"text": "Eine Fortführung der Präsentation aktiviert den Vollbildmodus.",
"button": {
"cancel": "Nein, ich präsentiere weiter!",
"confirm": "Präsentation beenden!"
}
},
"continue": {
"title": "Die Präsentation wurde unterbrochen!",
"text": "Eine Fortführung der Präsentation aktiviert den Vollbildmodus.",
"button": {
"cancel": "Präsentation beenden!",
"confirm": "Präsentation fortführen!"
}
}
}
}
}
......@@ -1938,6 +1938,24 @@
"confirm": "Profile",
"cancel": "Close"
}
},
"presentation": {
"end": {
"title": "Stop the presentation?",
"text": "",
"button": {
"cancel": "I want to continue!",
"confirm": "Stop the presentation!"
}
},
"continue": {
"title": "Stop the presentation?",
"text": "",
"button": {
"cancel": "Stop the presentation!",
"confirm": "I want to continue!"
}
}
}
}
}
......@@ -7,6 +7,7 @@ import * as screenfull from "screenfull";
import {CardIndex} from "./cardIndex";
import {Cards} from "./cards";
import {Cardsets} from "./cardsets";
import {SweetAlertMessages} from "./sweetAlert";
let keyEventsUnlocked = true;
let lastActiveCardString = "lastActiveCard";
......@@ -116,10 +117,13 @@ export let CardNavigation = class CardNavigation {
static switchCard (updateLearningMode = 0, answeredCard = 0, answer = 0) {
let flashcardCarousel = $('#cardCarousel');
flashcardCarousel.on('slide.bs.carousel', function () {
CardVisuals.resizeFlashcard();
CardNavigation.toggleVisibility(false);
flashcardCarousel.off('slide.bs.carousel');
});
flashcardCarousel.on('slid.bs.carousel', function () {
$('.scrollLeft').removeClass('pressed');
$('.scrollRight').removeClass('pressed');
......@@ -132,6 +136,7 @@ export let CardNavigation = class CardNavigation {
}
setTimeout(function () {
CardNavigation.toggleVisibility(true);
flashcardCarousel.off('slid.bs.carousel');
}, 300);
});
}
......@@ -231,7 +236,7 @@ export let CardNavigation = class CardNavigation {
screenfull.on('change', () => {
if (screenfull.element === null && Session.get('fullscreen')) {
if (Route.isPresentation()) {
$(".endPresentation").click();
SweetAlertMessages.continuePresentation();
} else {
$(".toggleFullscreen").click();
}
......
import {Meteor} from "meteor/meteor";
import swal from "sweetalert2";
import * as screenfull from 'screenfull';
export let SweetAlertMessages = class SweetAlertMessages {
static completeProfile () {
......@@ -19,4 +20,46 @@ export let SweetAlertMessages = class SweetAlertMessages {
}
});
}
static continuePresentation () {
swal({
title: TAPi18n.__('sweetAlert.presentation.continue.title'),
html: TAPi18n.__('sweetAlert.presentation.continue.text'),
type: "warning",
showCancelButton: true,
confirmButtonText: TAPi18n.__('sweetAlert.presentation.continue.button.confirm'),
cancelButtonText: TAPi18n.__('sweetAlert.presentation.continue.button.cancel'),
allowOutsideClick: false
}).then((result) => {
if (result.value) {
screenfull.request();
} else {
screenfull.exit();
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
});
}
});
}
static exitPresentation () {
swal({
title: TAPi18n.__('sweetAlert.presentation.end.title'),
html: TAPi18n.__('sweetAlert.presentation.end.text'),
type: "warning",
showCancelButton: true,
confirmButtonText: TAPi18n.__('sweetAlert.presentation.end.button.confirm'),
cancelButtonText: TAPi18n.__('sweetAlert.presentation.end.button.cancel'),
allowOutsideClick: false
}).then((result) => {
if (result.value) {
screenfull.exit();
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
});
} else {
screenfull.request();
}
});
}
};
......@@ -41,6 +41,7 @@ Template.flashcards.onCreated(function () {
});
let resizeInterval;
let windowResizeSensor;
Template.flashcards.onRendered(function () {
if (window.innerWidth <= 1400) {
if (Router.current().route.getName() === "cardsetdetailsid") {
......@@ -71,6 +72,9 @@ Template.flashcards.onRendered(function () {
new ResizeSensor($('#cardCarousel'), function () {
CardVisuals.resizeFlashcard();
});
windowResizeSensor = $(window).resize(function () {
CardVisuals.resizeFlashcard();
});
CardVisuals.resizeFlashcard();
CardVisuals.setTextZoom();
});
......@@ -80,6 +84,9 @@ Template.flashcards.onDestroyed(function () {
clearInterval(resizeInterval);
resizeInterval = undefined;
}
if (windowResizeSensor !== undefined) {
windowResizeSensor.off('resize');
}
});
Template.flashcards.helpers({
......
import "./endPresentation.html";
import {Route} from "../../../../api/route";
import {SweetAlertMessages} from "../../../../api/sweetAlert";
/*
* ############################################################################
......@@ -12,9 +13,7 @@ Template.cardSidebarItemEndPresentation.events({
if (Route.isMakingOf()) {
Router.go('home');
} else {
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
});
SweetAlertMessages.exitPresentation();
}
}
});
......@@ -84,6 +84,9 @@ Template.pomodoroTimerModal.events({
PomodoroTimer.updateSettingsBtn();
},
'click #startPom': function () {
if (Route.isPresentation()) {
CardVisuals.toggleFullscreen();
}
PomodoroTimer.start();
},
'click #cancelPomodoroBtn': function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment