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

Merge branch...

Merge branch '1399-remember-last-card-in-the-presentation-to-go-there-after-page-call-to-the-web' into 'staging'

Resolve "Remember last card in the presentation to go there after page call to the web"

Closes #1399

See merge request arsnova/flashcards!1647
parents a1783e3a e2748d9e
......@@ -23,4 +23,5 @@
@import '../imports/ui/access_denied/access_denied.scss';
@import '../imports/ui/markdeep/content.scss';
@import '../imports/ui/main/sweetAlert2.scss';
@import '../imports/ui/loadingScreen/loadingScreen.scss';
@import 'noscript.scss';
......@@ -458,6 +458,8 @@ $themes: (
$wordcloud_tooltip_backgroud: map-get($map, "wordcloud_tooltip_backgroud");
$wordcloud_tooltip_border: map-get($map, "wordcloud_tooltip_border");
$wordcloud_tooltip_divider: map-get($map, "wordcloud_tooltip_divider");
//loading screen
$loading_screen_icon: map-get($map, "loading_screen_icon");
background-image: $background_image !important;
.star-ratings .current-rating {
......@@ -2622,5 +2624,10 @@ $themes: (
.showArsnovaClick {
background-color: $white !important;
}
//loading screen
.loadingScreenContainer .fa {
color: $loading_screen_icon !important;
}
}
}
......@@ -459,6 +459,8 @@
"wordcloud_tooltip_text": $white,
"wordcloud_tooltip_backgroud": $thm_gray,
"wordcloud_tooltip_border": $white,
"wordcloud_tooltip_divider": $white
"wordcloud_tooltip_divider": $white,
//loading screen
"loading_screen_icon": black
);
}
......@@ -457,10 +457,12 @@
"sweet_alert_2_icon_info_text": $thm_dark_blue,
"sweet_alert_2_icon_question_border": $thm_gray,
"sweet_alert_2_icon_question_text": $thm_gray,
//wordcloud tooltip
//wordcloud tooltip
"wordcloud_tooltip_text": $white,
"wordcloud_tooltip_backgroud": $thm_gray,
"wordcloud_tooltip_border": $white,
"wordcloud_tooltip_divider": $white
"wordcloud_tooltip_divider": $white,
//loading screen
"loading_screen_icon": $thm_orange
);
}
......@@ -9,6 +9,7 @@ import {Cards} from "./cards";
import {Cardsets} from "./cardsets";
let keyEventsUnlocked = true;
let lastActiveCardString = "lastActiveCard";
export let CardNavigation = class CardNavigation {
......@@ -141,6 +142,13 @@ export let CardNavigation = class CardNavigation {
} else {
Session.set('activeCard', $(".item.active").data('id'));
}
if (Route.isPresentation() || Route.isCardset()) {
let lastActiveCard = {
_id: Session.get('activeCard'),
cardset_id: Router.current().params._id
};
localStorage.setItem(lastActiveCardString, JSON.stringify(lastActiveCard));
}
let cardset_id;
if (Session.get('activeCard') === -1) {
Session.set('activeCardsetName', Cardsets.findOne({_id: Router.current().params._id}).name);
......@@ -150,6 +158,19 @@ export let CardNavigation = class CardNavigation {
}
}
static restoreActiveCard () {
if (Route.isPresentation() || Route.isCardset()) {
if (localStorage.getItem(lastActiveCardString) !== undefined && localStorage.getItem(lastActiveCardString) !== null) {
let lastActiveCard = JSON.parse(localStorage.getItem(lastActiveCardString));
if (Router.current().params._id === lastActiveCard.cardset_id && Cards.findOne({_id: lastActiveCard._id})) {
Session.set('activeCard', lastActiveCard._id);
} else {
localStorage.removeItem(lastActiveCardString);
}
}
}
}
static isVisible () {
return Session.get('navigationVisible');
}
......
This diff is collapsed.
......@@ -35,6 +35,9 @@ Template.flashcards.onCreated(function () {
Session.set('reverseViewOrder', false);
Session.set('selectedHint', undefined);
Session.set('isQuestionSide', true);
if (Session.get('activeCard') === undefined) {
CardNavigation.restoreActiveCard();
}
});
let resizeInterval;
......
......@@ -407,7 +407,7 @@ Template.cardsetList.events({
Session.set('cardType', $(evt.target).data('card-type'));
Session.set('activeCardContentId', cubeSides[0].contentId);
if (Router.current().route.getName() === "cardsetlistid" || Router.current().route.getName() === "presentationlist" || Router.current().route.getName() === "demolist" || Router.current().route.getName() === "makinglist") {
Session.set('activeCard', $(evt.target).data('id'));
CardNavigation.setActiveCardData($(evt.target).data('id'));
if (Router.current().route.getName() === "presentationlist") {
Router.go('presentation', {
_id: Router.current().params._id
......
......@@ -27,6 +27,10 @@ Template.learnAlgorithms.onCreated(function () {
CardNavigation.toggleVisibility(true);
});
Template.learnAlgorithms.onDestroyed(function () {
Session.set('activeCard', undefined);
});
Template.learnAlgorithms.onRendered(function () {
$('.pomodoroTimer').click();
});
......
<template name="loadingScreen">
<div class="loadingScreenContainer">
<i class="fa fa-spinner fa-spin"></i>
</div>
</template>
//------------------------ IMPORTS
import "./loadingScreen.html";
.loadingScreenContainer {
margin-top: 25%;
text-align: center;
.fa {
font-size: $loading_screen_size !important;
}
}
\ No newline at end of file
......@@ -28,6 +28,7 @@ import "../../api/groundDB.js";
import "../../api/cardIndex.js";
import "./overlays/zoomText.js";
import "../card/sidebar/sidebar.js";
import "../loadingScreen/loadingScreen.js";
import {Cardsets} from "../../api/cardsets.js";
import {Route} from "../../api/route";
import {CardVisuals} from "../../api/cardVisuals";
......
......@@ -172,6 +172,9 @@ $zoom_slider_handle_width: 70px;
$zoom_slider_handle_height: 30px;
$zoom_slider_handle_offset: -25px;
//loading screen
$loading_screen_size: 150px;
html {
position: relative;
min-height: 100%;
......
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