Commit 0c02ab84 authored by Curtis Adam's avatar Curtis Adam

With starting construction of the cloud show a modal with a hint to clicking...

With starting construction of the cloud show a modal with a hint to clicking for description of the card index
parent 2c02d743
......@@ -58,6 +58,12 @@
}
}
},
"wordcloud": {
"modal": {
"title": "Best in \uD83C\uDF45cards",
"button": "Schließen"
}
},
"pomodoro": {
"tooltip": "Pomodoro-Timer für dein Zeitmanagement – »Pomodoro« ist italienisch für \uD83C\uDF45",
"name": "Pomodoro",
......
......@@ -59,6 +59,12 @@
}
}
},
"wordcloud": {
"modal": {
"title": "Best in \uD83C\uDF45cards",
"button": "Close"
}
},
"pomodoro": {
"tooltip": "Pomodoro-Timer für dein Zeitmanagement – »Pomodoro« ist italienisch für \uD83C\uDF45",
"name": "Pomodoro",
......
......@@ -25,4 +25,11 @@ export let Icons = class Icons {
return config.useCasesIcons.myCardsets;
}
}
static getNavigationIcon (type) {
switch (type) {
case "wordcloud":
return config.landingPageNavigation.wordcloud;
}
}
};
......@@ -9,8 +9,12 @@ import {PomodoroTimer} from "./pomodoroTimer";
import {FilterNavigation} from "./filterNavigation";
import {NavigatorCheck} from "./navigatorCheck";
import * as config from "../config/wordcloud.js";
import {Route} from "./route";
Session.setDefault('firstTimeWordcloudModalLandingPage', true);
Session.setDefault('firstTimeWordcloudModalFilter', true);
let canvasSettings;
let firstTimeWordcloudModalLandingPage = 'isFirstTimeWordcloudModalLandingPage';
let firstTimeWordcloudModalFilter = 'isFirstTimeWordcloudModalFilter';
export let WordcloudCanvas = class WordcloudCanvas {
......@@ -22,6 +26,44 @@ export let WordcloudCanvas = class WordcloudCanvas {
}
}
static displayHelpModal () {
if (Route.isHome() && config.displayHelpModalSettings.landingPage.active) {
switch (config.displayHelpModalSettings.landingPage.type) {
case 0:
if (localStorage.getItem(firstTimeWordcloudModalLandingPage) === undefined || localStorage.getItem(firstTimeWordcloudModalLandingPage) === null) {
localStorage.setItem(firstTimeWordcloudModalLandingPage, "true");
return true;
}
break;
case 1:
if (Session.get('firstTimeWordcloudModalLandingPage')) {
Session.set('firstTimeWordcloudModalLandingPage');
return true;
}
break;
case 2:
return true;
}
} else if (Route.isFilterIndex() && config.displayHelpModalSettings.filter.active) {
switch (config.displayHelpModalSettings.filter.type) {
case 0:
if (localStorage.getItem(firstTimeWordcloudModalFilter) === undefined || localStorage.getItem(firstTimeWordcloudModalFilter) === null) {
localStorage.setItem(firstTimeWordcloudModalFilter, "true");
return true;
}
break;
case 1:
if (Session.get('firstTimeWordcloudModalFilter')) {
Session.set('firstTimeWordcloudModalFilter');
return true;
}
break;
case 2:
return true;
}
}
}
static draw () {
if (document.getElementById('wordcloud-canvas') !== null) {
this.setCanvasSize();
......
......@@ -11,7 +11,8 @@ let footerNavigation = {
};
let landingPageNavigation = {
mobileInfo: "<i class='glyphicon glyphicon-info-sign'></i>"
mobileInfo: "<i class='glyphicon glyphicon-info-sign'></i>",
wordcloud: "<i class='fa fa-archive'></i>"
};
//Only used for the active route display on mobile. Will be carried over to desktop after the main template got refactored.
......
let wordcloudPomodoroSize = 0.6;
let defaultToFilterWordcloudThreshold = 100;
//type
//0: Show once (local storage)
//1: Show once per session
//2: Show each time on wordcloud construction
let displayHelpModalSettings = {
"landingPage": {
"active": true,
"type": 2
},
"filter": {
"active": true,
"type": 1
}
};
let wordcloudLandingPage = {
"clearCanvas": true,
"drawOutOfBound": false,
......@@ -29,5 +46,6 @@ module.exports = {
wordcloudPomodoroSize,
defaultToFilterWordcloudThreshold,
wordcloudLandingPage,
wordcloudDefault
wordcloudDefault,
displayHelpModalSettings
};
......@@ -395,6 +395,10 @@ Template.registerHelper("isLecturerOrPro", function () {
}
});
Template.registerHelper("getNavigationIcon", function (type) {
return Icons.getNavigationIcon(type);
});
Template.registerHelper("canCreateContent", function () {
return UserPermissions.canCreateContent();
});
......
......@@ -21,7 +21,7 @@
{{#if gotFeatureSupport 1}}
<div class="hidden-xs">
<div class="toggle-wordcloud" title="{{_ "landingPage.buttons.tooltip.wordcloud"}}">
<div class="flex-content"><i class="fa fa-archive"></i></div>
<div class="flex-content">{{{getNavigationIcon "wordcloud"}}}</div>
<label>{{_ "landingPage.buttons.wordcloud"}}</label>
</div>
</div>
......
<template name="wordcloudHelpContentDE">
</template>
<template name="wordcloudHelpContentEN">
</template>
<template name="wordcloudHelpModal">
<div class="modal fade" id="wordcloudHelpModal" tabindex="-1" role="dialog"
aria-labelledby="wordcloudHelpModalTitle">
<div class="modal-dialog">
<div class="modal-content modal-content-for-buttons">
<div class="modal-header">
<span class="modal-icon">
{{{getNavigationIcon "wordcloud"}}}
</span>
{{> mainModalItemCloseIcon}}
</div>
<div class="modal-body">
<h4 id="wordcloudHelp" class="modal-title">{{_ "wordcloud.modal.title"}}
</h4>
{{#markdeep}}
{{#if isActiveLanguage 'de'}}
{{> wordcloudHelpContentDE}}
{{else}}
{{> wordcloudHelpContentEN}}
{{/if}}
{{/markdeep}}
<button class="btn btn-raised btn-default btn-block"
id="wordcloudHelpConfirm">{{_ "wordcloud.modal.button"}}</button>
</div>
</div>
</div>
</div>
</template>
import {Template} from "meteor/templating";
import {WordcloudCanvas} from "../../../api/wordcloudCanvas";
import "./de/content.js";
import "./en/content.js";
import "./help.html";
Template.wordcloudHelpModal.events({
"click #wordcloudHelpConfirm": function () {
$('#wordcloudHelpModal').modal('hide');
}
});
Template.wordcloudHelpModal.onRendered(function () {
if (WordcloudCanvas.displayHelpModal()) {
$('#wordcloudHelpModal').modal('show');
}
});
<template name="wordcloud">
{{#if displayHelpModal}}
{{> wordcloudHelpModal}}
{{/if}}
{{> wordcloudModal}}
<div id="wordcloud-container" class="col-xs-12">
<canvas id="wordcloud-canvas" class="needsclick"></canvas>
......
import {WordcloudCanvas} from "../../api/wordcloudCanvas";
import "./wordcloud.html";
import ResizeSensor from "../../../client/thirdParty/resizeSensor/ResizeSensor";
import {Cardsets} from "../../api/cardsets.js";
import {Session} from "meteor/session";
import {Template} from "meteor/templating";
import "./help/help.js";
import "./wordcloud.html";
import {NavigatorCheck} from "../../api/navigatorCheck";
import {Route} from "../../api/route";
/*
* ############################################################################
......@@ -11,6 +14,15 @@ import {Template} from "meteor/templating";
* ############################################################################
*/
Template.wordcloud.helpers({
displayHelpModal: function () {
if (!NavigatorCheck.isSmartphone()) {
return !(Route.isHome() && Session.get('isLandingPagePomodoroActive'));
}
return false;
}
});
Template.wordcloud.onRendered(function () {
WordcloudCanvas.draw();
new ResizeSensor($('#wordcloud-container'), function () {
......@@ -21,6 +33,8 @@ Template.wordcloud.onRendered(function () {
});
});
/*
* ############################################################################
* wordcloudModal
......
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