Commit 53db7a0f authored by Curtis Adam's avatar Curtis Adam

Display the server inventory on the welcome page

parent a16dc4af
......@@ -55,6 +55,7 @@
"client": true,
"module": true,
"expect": true,
"Hammer": true
"Hammer": true,
"Counts": true
}
}
......@@ -68,3 +68,4 @@ fastclick
jquery@1.11.10
east5th:package-scan
wtfzn:dompurify
ros:publish-counts
......@@ -142,6 +142,7 @@ reactive-var@1.0.11
reload@1.2.0
retry@1.1.0
rexzh0u:kramed@1.0.3
ros:publish-counts@0.5.1
routepolicy@1.0.13
rzymek:moment-locale-af@2.14.1
rzymek:moment-locale-ar@2.14.1
......
......@@ -147,6 +147,8 @@ $themes: (
$footer_websocket_connecting: map-get($map, "footer_websocket_connecting");
$footer_websocket_disconnected: map-get($map, "footer_websocket_disconnected");
$placeholder: map-get($map, "placeholder");
$inventory_background: map-get($map, "inventory_background");
$inventory_text: map-get($map, "inventory_text");
//info page colors
$info_navigation_text: map-get($map, "info_navigation_text");
$info_navigation_text_active: map-get($map, "info_navigation_text_active");
......@@ -601,6 +603,11 @@ $themes: (
}
}
.serverInventory {
background-color: $inventory_background !important;
color: $inventory_text !important;
}
.panel-heading.info-tab {
color: $info_content_header_text !important;
background-color: $info_content_header_background !important;
......
......@@ -168,6 +168,8 @@
"footer_websocket_connecting": $thm_orange,
"footer_websocket_disconnected": $thm_red,
"placeholder": $thm_orange,
"inventory_background": $thm_gray,
"inventory_text": $thm_orange,
//info page colors
"info_navigation_text": black,
"info_navigation_text_active": white,
......
......@@ -170,6 +170,8 @@
"footer_websocket_connecting": $thm_orange,
"footer_websocket_disconnected": $thm_red,
"placeholder": $thm_orange,
"inventory_background": $thm_gray,
"inventory_text": $thm_orange,
//info page colors
"info_navigation_text": white,
"info_navigation_text_active": $thm_gray,
......
......@@ -1370,6 +1370,12 @@
"login": {
"label": "Melde dich an "
},
"inventory": {
"cardsets": "Karteien",
"cards": "Karten",
"users": "Benutzer",
"usersOnline": "Online"
},
"wozniak": {
"show": "Zeige Antwort",
"skip": "Überspringen",
......
......@@ -1405,6 +1405,12 @@
"login": {
"label": "Log in"
},
"inventory": {
"cardsets": "Cardsets",
"cards": "Cards",
"users": "User",
"usersOnline": "Online"
},
"wozniak": {
"show": "Show answer",
"skip": "Skip",
......
import {Meteor} from "meteor/meteor";
import {Cardsets} from "./cardsets";
import {Cards} from "./cards";
if (Meteor.isServer) {
Meteor.publish('serverInventory', function () {
Counts.publish(this, 'cardsetsCounter', Cardsets.find(), {fastCount: true});
Counts.publish(this, 'cardsCounter', Cards.find(), {fastCount: true});
Counts.publish(this, 'usersCounter', Meteor.users.find(), {fastCount: true});
Counts.publish(this, 'usersOnlineCounter', Meteor.users.find({'status.online': true}), {fastCount: true});
});
}
......@@ -28,6 +28,7 @@ import {Cardsets} from "../../api/cardsets.js";
Meteor.subscribe("Users");
Meteor.subscribe("notifications");
Meteor.subscribe("adminSettings");
Meteor.subscribe("serverStatistics");
Session.setDefault("theme", "default");
Session.setDefault("fullscreen", false);
......
......@@ -28,6 +28,10 @@ $size_navbar_alldecks_border: 3px;
$size_footer_height: 40px;
$font_size_login_label: 16px;
$font_weight_login_label: bold;
$font_size_inventory: 18px;
$font_weight_inventory: bold;
$padding_horizontal_inventory: 15px;
$padding_vertical_inventory: 5px;
//info page
$font_size_info_h1: 20px;
......
......@@ -23,6 +23,7 @@
</div>
<div id="login" class="panel-footer">
{{{getLoginButtons}}}
{{{getServerInventory}}}
</div>
</div>
</div>
......
......@@ -2,14 +2,16 @@
import {Meteor} from "meteor/meteor";
import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import WordCloud from "wordcloud";
import {Cardsets} from "../../api/cardsets.js";
import {getUserLanguage} from "../../startup/client/i18n";
import "./welcome.html";
import {Session} from "meteor/session";
Meteor.subscribe("cardsets");
Meteor.subscribe("cards");
Meteor.subscribe("userData");
Meteor.subscribe("serverInventory");
function setActiveLanguage() {
let language = getUserLanguage();
......@@ -17,6 +19,16 @@ function setActiveLanguage() {
Session.set('activeLanguage', language);
}
function splitLargeNumbers(number) {
let separator;
if (Session.get('activeLanguage') === "de") {
separator = ".";
} else {
separator = ",";
}
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, separator);
}
/**
* This method nserts a hover message for the wordcloud content
* @param {Object} item - Array containing data of the wordcloud object (name, description, kind and color)
......@@ -45,7 +57,7 @@ function createTagCloud() {
} else {
document.getElementById('tag-cloud-container').height = 'unset';
document.getElementById('tag-cloud-canvas').width = document.getElementById('tag-cloud-container').offsetWidth;
document.getElementById('tag-cloud-canvas').height = $(window).height() - ($('.panel-heading').outerHeight(true) + $('#login').outerHeight(true));
document.getElementById('tag-cloud-canvas').height = $(window).height() - ($('.panel-heading').outerHeight(true) + $('#login').outerHeight(true) + $('#serverInventoryContainer').outerHeight(true));
if ($(window).width() > 700 && $(window).height() > 700) {
let textScale = 1.4;
let gridSize = Math.round(16 * $('#tag-cloud-canvas').width() / 1440);
......@@ -191,7 +203,7 @@ Template.welcome.helpers({
'<option id="adminLogin" value="editor">' + admin + '</option>' +
'<option id="proLogin" value="pro">' + pro + '</option>' +
'<option id="lecturerLogin" value="lecturer">' + Meteor.settings.public.university.default + '-' + lecturer + '</option>' +
'<option id="eduLogin" value="university">' + Meteor.settings.public.university.default + '-' + edu + '</option>' +
'<option id="eduLogin" value="university">' + Meteor.settings.public.university.default + '-' + edu + '</option>' +
'<option id="standardLogin" value="standard">' + standard + '</option>' +
'<option id="blockedLogin" value="blocked">' + blocked + '</option>' +
'<option id="firstLogin" value="firstLogin">' + firstLogin + '</option>' +
......@@ -205,6 +217,12 @@ Template.welcome.helpers({
},
getLastTitleWord: function () {
return Meteor.settings.public.welcome.title.last;
},
getServerInventory: function () {
return '<br><span class="serverInventory">' + TAPi18n.__("inventory.cardsets") + "&nbsp;" + splitLargeNumbers(Counts.get('cardsetsCounter')) + "&nbsp;&nbsp;" +
TAPi18n.__("inventory.cards") + "&nbsp;" + splitLargeNumbers(Counts.get('cardsCounter')) + "&nbsp;&nbsp;" +
TAPi18n.__("inventory.users") + "&nbsp;" + splitLargeNumbers(Counts.get('usersCounter')) + "&nbsp;&nbsp;" +
TAPi18n.__("inventory.usersOnline") + "&nbsp;" + splitLargeNumbers(Counts.get('usersOnlineCounter')) + '</span><br><br>';
}
});
......
......@@ -111,3 +111,10 @@
text-shadow: 5px 5px 20px rgba(0, 0, 0, 0.7);
}
.serverInventory {
display: inline-block;
text-align: center;
padding: $padding_vertical_inventory $padding_horizontal_inventory !important;
font-size: $font_size_inventory !important;
font-weight: $font_weight_inventory !important;
}
......@@ -11,6 +11,7 @@ import "../imports/api/cardsets.js";
import "../imports/api/cardsetUserlist.js";
import "../imports/api/colleges_courses.js";
import "../imports/api/courseIterations.js";
import "../imports/api/serverInventory.js";
import "../imports/api/import.js";
import "../imports/api/learned.js";
import "../imports/api/notifications.js";
......
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