Commit ad43ee1b authored by Curtis Adam's avatar Curtis Adam

Change the app title to be set inside /imports/config and allow different...

Change the app title to be set inside /imports/config and allow different backgrounds per installation
parent 7df8d0ea
// STARTUP IMPORTS
import {Meteor} from "meteor/meteor";
import "../imports/startup/client/i18n.js";
import "../imports/startup/client/registerhelper.js";
import "../imports/startup/client/registerServiceWorker";
import "../imports/startup/client/routes.js";
import "../imports/ui/main/main.js";
import {ServerStyle} from "../imports/api/styles.js";
window.addEventListener("load", function () {
window.cookieconsent.initialise({
......@@ -23,7 +23,7 @@ window.addEventListener("load", function () {
"position": "bottom-right",
"content": {
"message": Meteor.settings.public.welcome.title.first + "." + Meteor.settings.public.welcome.title.last + " verwendet Cookies. Wenn du auf dieser Seite bleibst, stimmst du der Cookie-Nutzung zu.",
"message": ServerStyle.getFirstAppTitle() + "." + ServerStyle.getLastAppTitle() + " verwendet Cookies. Wenn du auf dieser Seite bleibst, stimmst du der Cookie-Nutzung zu.",
"dismiss": "Ich stimme zu",
"link": "→ Datenschutz",
"href": "/datenschutz"
......
......@@ -10,20 +10,13 @@ $themes: (
@each $theme, $map in $themes {
.#{$theme} {
//background
$background_default: map-get($map, "background_default");
$background_default_image: map-get($map, "background_default_image");
$background_default_frontend: map-get($map, "background_default_frontend");
$background_default_frontend_image: map-get($map, "background_default_frontend_image");
$background_default_backend: map-get($map, "background_default_backend");
$background_default_backend_image: map-get($map, "background_default_backend_image");
$background_landing_page: map-get($map, "background_landing_page");
$background_internal: map-get($map, "background_internal");
$background_demo: map-get($map, "background_demo");
$background_demo_image: map-get($map, "background_demo_image");
$background_editor: map-get($map, "background_editor");
$background_editor_image: map-get($map, "background_editor_image");
$background_presentation: map-get($map, "background_presentation");
$background_presentation_image: map-get($map, "background_presentation_image");
$background_learning_mode: map-get($map, "background_learning_mode");
$background_learning_mode_image: map-get($map, "background_learning_mode_image");
$background_learning: map-get($map, "background_learning");
$background_backend: map-get($map, "background_backend");
$background_editor: map-get($map, "background_editor");
//global colors
$thm_dark_blue: map-get($map, "thm_dark_blue");
$thm_blue: map-get($map, "thm_blue");
......@@ -562,39 +555,32 @@ $themes: (
$landing_page_wordcloud_button_opacity_hover: map-get($map, "landing_page_wordcloud_button_opacity_hover");
$landing_page_label: map-get($map, "landing_page_label");
body.default {
background-color: $background_default !important;
background-image: $background_default_image !important;
body.landing-page {
background-color: $background_landing_page !important;
}
body.default-frontend {
background-color: $background_default_frontend !important;
background-image: $background_default_frontend_image !important;
body.internal {
background-color: $background_internal !important;
}
body.default-backend {
background-color: $background_default_backend !important;
background-image: $background_default_backend_image !important;
body.demo {
background-color: $background_demo !important;
}
body.presentation {
background-color: $background_presentation !important;
background-image: $background_presentation_image !important;
}
body.learning-mode {
background-color: $background_learning_mode !important;
background-image: $background_learning_mode_image !important;
body.learning {
background-color: $background_learning !important;
}
body.demo {
background-color: $background_demo !important;
background-image: $background_demo_image !important;
body.backend {
background-color: $background_backend !important;
}
body.editor {
background-color: $background_editor !important;
background-image: $background_editor_image !important;
}
button:hover, button:focus, .btn:hover, .btn:focus {
......
......@@ -38,23 +38,15 @@
$input_textarea_text_inactive: $primary_text;
$item_icon_hover: $thm_orange;
$default_background: rgb(153, 153, 153);
$default_background_image: url('');
@return (
//background (Deactivate the image with "none" if you want to use the background-color)
"background_default" : $default_background,
"background_default_image" : "none",
"background_default_frontend" : $default_background,
"background_default_frontend_image" : "none",
"background_default_backend" : $default_background,
"background_default_backend_image" : "none",
"background_landing_page" : $default_background,
"background_internal" : $default_background,
"background_demo": $default_background,
"background_demo_image": "none",
"background_editor": $default_background,
"background_editor_image": "none",
"background_presentation": $default_background,
"background_presentation_image": "none",
"background_learning_mode": $default_background,
"background_learning_mode_image": "none",
"background_learning": $default_background,
"background_backend" : $default_background,
"background_editor": $default_background,
//global colors
"thm_dark_blue":$thm_dark_blue,
"thm_blue":$thm_blue,
......
......@@ -40,26 +40,16 @@
$input_textarea_text_inactive: black;
$item_icon_hover: midnightblue;
$default_background: lightslategray;
$default_background_image: url('/img/background/Piccadilly_Book_Stall.jpg');
$frontend_image: url('/img/background/Buchladen.jpg');
$demo_image: url('/img/background/Piccadilly_Book_Stall.jpg');
@return (
//background (Deactivate the image with "none" if you want to use the background-color)
"background_default" : $default_background,
"background_default_image" : $default_background_image,
"background_default_frontend" : $default_background,
"background_default_frontend_image" : $frontend_image,
"background_default_backend" : $default_background,
"background_default_backend_image" : "none",
"background_landing_page" : $default_background,
"background_internal" : $default_background,
"background_demo": $default_background,
"background_demo_image": $demo_image,
"background_editor": $default_background,
"background_editor_image": "none",
"background_presentation": $default_background,
"background_presentation_image": "none",
"background_learning_mode": steelblue,
"background_learning_mode_image": "none",
"background_learning": steelblue,
"background_backend" : $default_background,
"background_editor": $default_background,
//global colors
"thm_dark_blue":$thm_dark_blue,
"thm_blue":$thm_blue,
......
import {Meteor} from "meteor/meteor";
import * as serverConf from "../config/server.js";
import * as backgroundsConf from "../config/backgrounds.js";
import {Session} from "meteor/session";
export let ServerStyle = class ServerStyle {
static getFirstAppTitle () {
return this.getConfig().welcome.title.first;
}
static getLastAppTitle () {
return this.getConfig().welcome.title.last;
}
static getAppSlogan () {
return this.getConfig().welcome.title.slogan;
}
static getConfig () {
switch (Meteor.settings.public.dynamicSettings) {
case "debug":
return serverConf.debug;
case "informatik":
return serverConf.informatik;
case "linux":
return serverConf.linux;
case "review":
return serverConf.review;
case "staging":
return serverConf.staging;
default:
return serverConf.defaultSettings;
}
}
static getBackground (type) {
if (Session.get('theme') !== "default") {
return "none";
}
let backgrounds;
let backgroundSring = "";
switch (this.getConfig().backgrounds) {
case "linux":
backgrounds = backgroundsConf.linuxBackgrounds;
break;
default:
backgrounds = backgroundsConf.defaultBackgrounds;
}
switch (type) {
case "landing-page":
backgroundSring = backgrounds["landing-page"];
break;
case "internal":
backgroundSring = backgrounds.internal;
break;
case "demo":
backgroundSring = backgrounds.demo;
break;
case "presentation":
backgroundSring = backgrounds.presentation;
break;
case "learning":
backgroundSring = backgrounds.learning;
break;
case "backend":
backgroundSring = backgrounds.backend;
break;
case "editor":
backgroundSring = backgrounds.editor;
}
if (backgroundSring === "none") {
return backgroundSring;
} else {
return "url('" + backgroundSring + "')";
}
}
};
// Background-Image settings for the default theme:
// - Set the Background-Colors inside the Theme Switcher files.
// - Set the Background-Image to "none" to enable the Background-Color.
// - Change the setting "backgrounds" in "/import/config/server.js" to select the background setting that the server should use.
// Setting "default"
let defaultBackgrounds = {
"landing-page": "/img/background/Piccadilly_Book_Stall.jpg",
"internal": "/img/background/Buchladen.jpg",
"demo": "/img/background/Piccadilly_Book_Stall.jpg",
"presentation": "none",
"learning": "none",
"backend": "none",
"editor": "none"
};
// Setting "linux"
let linuxBackgrounds = {
"landing-page": "/img/background/Piccadilly_Book_Stall.jpg",
"internal": "/img/background/Buchladen.jpg",
"demo": "/img/background/Piccadilly_Book_Stall.jpg",
"presentation": "none",
"learning": "none",
"backend": "none",
"editor": "none"
};
module.exports = {
defaultBackgrounds,
linuxBackgrounds
};
let defaultSettings = {
"welcome": {
"title": {
"first": "default",
"last": "cards",
"slogan": "ORGANIZE. LEARN. MEMORIZE."
}
},
"backgrounds": "default"
};
let debug = {
"welcome": {
"title": {
"first": "debug",
"last": "cards",
"slogan": "ORGANIZE. LEARN. MEMORIZE."
}
},
"backgrounds": "default"
};
let informatik = {
"welcome": {
"title": {
"first": "informatik",
"last": "cards",
"slogan": "ORGANIZE. LEARN. MEMORIZE."
}
},
"backgrounds": "default"
};
let linux = {
"welcome": {
"title": {
"first": "Linux",
"last": "cards",
"slogan": "Effiziente Vorbereitung auf die LPIC-Prüfungen"
}
},
"backgrounds": "linux"
};
let review = {
"welcome": {
"title": {
"first": "review",
"last": "cards",
"slogan": "ORGANIZE. LEARN. MEMORIZE."
}
},
"backgrounds": "default"
};
let staging = {
"welcome": {
"title": {
"first": "staging",
"last": "cards",
"slogan": "ORGANIZE. LEARN. MEMORIZE."
}
},
"backgrounds": "default"
};
module.exports = {
defaultSettings,
informatik,
linux,
debug,
review,
staging
};
......@@ -17,6 +17,7 @@ import {BonusForm} from "../../api/bonusForm";
import {MarkdeepContent} from "../../api/markdeep";
import {NavigatorCheck} from "../../api/navigatorCheck";
import {isNewCardset} from "../../ui/forms/cardsetForm";
import {ServerStyle} from "../../api/styles.js";
Meteor.subscribe("collegesCourses");
......@@ -35,15 +36,15 @@ Template.registerHelper('isSelectingCardsetToLearn', function () {
});
Template.registerHelper('getFirstAppTitle', function () {
return Meteor.settings.public.welcome.title.first;
return ServerStyle.getFirstAppTitle();
});
Template.registerHelper('getLastAppTitle', function () {
return Meteor.settings.public.welcome.title.last;
return ServerStyle.getLastAppTitle();
});
Template.registerHelper('getAppSlogan', function () {
return Meteor.settings.public.welcome.title.slogan;
return ServerStyle.getAppSlogan();
});
Template.registerHelper('isInBonus', function () {
......
......@@ -9,6 +9,7 @@ import {MarkdeepEditor} from "../../api/markdeepEditor";
import {WebPushNotifications} from "../../api/webPushSubscriptions";
import {UserPermissions} from "../../api/permissions";
import {MainNavigation} from "../../api/mainNavigation";
import {ServerStyle} from "../../api/styles.js";
let loadingScreenTemplate = 'loadingScreen';
......@@ -965,10 +966,10 @@ export function firstLoginBertAlert() {
Bert.defaults.hideDelay = 97200;
Bert.alert({
title: TAPi18n.__('bertAlert.firstLogin.title', {
firstAppTitle: Meteor.settings.public.welcome.title.first,
lastAppTitle: Meteor.settings.public.welcome.title.last
firstAppTitle: ServerStyle.getFirstAppTitle(),
lastAppTitle: ServerStyle.getLastAppTitle()
}),
message: TAPi18n.__('bertAlert.firstLogin.message', {lastAppTitle: Meteor.settings.public.welcome.title.last}),
message: TAPi18n.__('bertAlert.firstLogin.message', {lastAppTitle: ServerStyle.getLastAppTitle()}),
type: 'info',
style: 'growl-top-left',
icon: 'fa-remove'
......@@ -1025,22 +1026,30 @@ var goToCreated = function () {
var setBackground = function () {
let body = $('body');
body.removeAttr('class');
body.removeAttr('style');
if (Route.isPresentation()) {
body.addClass('presentation');
body.css('background-image', ServerStyle.getBackground("presentation"));
} else if (Route.isBox() || Route.isMemo()) {
body.addClass('learning-mode');
body.addClass('learning');
body.css('background-image', ServerStyle.getBackground("learning"));
} else if (Route.isEditMode()) {
body.addClass('editor');
body.css('background-image', ServerStyle.getBackground("editor"));
} else if (Route.isDemo() | Route.isMakingOf()) {
body.addClass('demo');
body.css('background-image', ServerStyle.getBackground("demo"));
} else if (Meteor.user()) {
if (Route.isBackend()) {
body.addClass('default-backend');
body.addClass('backend');
body.css('background-image', ServerStyle.getBackground("backend"));
} else {
body.addClass('default-frontend');
body.addClass('internal');
body.css('background-image', ServerStyle.getBackground("internal"));
}
} else {
body.addClass('default');
body.addClass('landing-page');
body.css('background-image', ServerStyle.getBackground("landing-page"));
}
this.next();
};
......
......@@ -34,6 +34,7 @@ import "./item/search.js";
import "./modal/item/closeIcon.js";
import "./main.html";
import {NavigatorCheck} from "../../api/navigatorCheck";
import {ServerStyle} from "../../api/styles.js";
Meteor.subscribe("Users");
Meteor.subscribe("notifications");
......@@ -202,7 +203,7 @@ Template.main.helpers({
Template.main.onCreated(function () {
MarkdeepContent.initializeStylesheet();
document.title = Meteor.settings.public.welcome.title.first + "." + Meteor.settings.public.welcome.title.last;
document.title = ServerStyle.getFirstAppTitle() + "." + ServerStyle.getLastAppTitle();
});
Template.main.onRendered(function () {
......
......@@ -233,12 +233,6 @@ Template.welcomeWordcloudButton.events({
* ############################################################################
*/
Template.welcomeTitle.helpers({
getFirstTitleWord: function () {
return Meteor.settings.public.welcome.title.first;
},
getLastTitleWord: function () {
return Meteor.settings.public.welcome.title.last;
},
isFirstTimeVisit: function () {
return Route.isFirstTimeVisit();
}
......
......@@ -6,6 +6,7 @@ import {Notifications} from "./notifications.js";
import {AdminSettings} from "../imports/api/adminSettings.js";
import {Cardsets} from "../imports/api/cardsets.js";
import {getAuthorName} from "../imports/api/userdata";
import {ServerStyle} from "../imports/api/styles";
/**
* Class used for sending the newsletter mail
......@@ -57,7 +58,7 @@ export class MailNotifier {
var notifier = new Notifications();
var firstName = getAuthorName(user_id, false, true);
var cards = notifier.getActiveCardsCount(cardset._id, user_id);
var subject = TAPi18n.__('mailNotification.subjectTitle', {lastAppTitle: Meteor.settings.public.welcome.title.last}, Meteor.settings.mail.language);
var subject = TAPi18n.__('mailNotification.subjectTitle', {lastAppTitle: ServerStyle.getLastAppTitle()}, Meteor.settings.mail.language);
var name = TAPi18n.__('mailNotification.textIntro', {firstName: firstName[0]}, Meteor.settings.mail.language);
var text = TAPi18n.__('mailNotification.textIntro1', null, Meteor.settings.mail.language) + TAPi18n.__('mailNotification.newCards1', null, Meteor.settings.mail.language);
var bold;
......@@ -107,9 +108,9 @@ export class MailNotifier {
var datenschutz = TAPi18n.__('contact.datenschutz', null, Meteor.settings.mail.language);
var agb = TAPi18n.__('contact.agb', null, Meteor.settings.mail.language);
var impressum = TAPi18n.__('contact.impressum', null, Meteor.settings.mail.language);
var service = TAPi18n.__('mailNotification.service', {lastAppTitle: Meteor.settings.public.welcome.title.last}, Meteor.settings.mail.language);
var service = TAPi18n.__('mailNotification.service', {lastAppTitle: ServerStyle.getLastAppTitle()}, Meteor.settings.mail.language);
var unsubscribe = TAPi18n.__('mailNotification.unsubscribe', null, Meteor.settings.mail.language);
var copyright = TAPi18n.__('mailNotification.copyright', {lastAppTitle: Meteor.settings.public.welcome.title.last}, Meteor.settings.mail.language);
var copyright = TAPi18n.__('mailNotification.copyright', {lastAppTitle: ServerStyle.getLastAppTitle()}, Meteor.settings.mail.language);
var myCardset = TAPi18n.__('mailNotification.my-cardset', null, Meteor.settings.mail.language);
var autoGenerated = TAPi18n.__('mailNotification.auto-generated', null, Meteor.settings.mail.language);
if (!Meteor.isServer) {
......@@ -135,8 +136,8 @@ export class MailNotifier {
copyright: copyright,
cardset: myCardset,
autoGenerated: autoGenerated,
firstAppTitle: Meteor.settings.public.welcome.title.first,
lastAppTitle: Meteor.settings.public.welcome.title.last
firstAppTitle: ServerStyle.getFirstAppTitle(),
lastAppTitle: ServerStyle.getLastAppTitle()
});
Email.send({
from: Meteor.settings.mail.senderAddress,
......
{
"public": {
"rooturl": "http://localhost:3000",
"dynamicSettings": "default",
"cas": {
"loginUrl": "https://cas.thm.de/cas/login",
"serviceParam": "service",
......@@ -27,11 +28,6 @@
"default": "THM"
},
"welcome": {
"title": {
"first": "informatik",
"last": "cards",
"slogan": "ORGANIZE. LEARN. MEMORIZE."
},
"fakeStatistics": false
},
"env": "Sandbox",
......
{
"public": {
"rooturl": "http://localhost:3000",
"dynamicSettings": "debug",
"cas": {
"loginUrl": "https://cas.thm.de/cas/login",
"serviceParam": "service",
......@@ -27,11 +28,6 @@
"default": "THM"
},
"welcome": {
"title": {
"first": "debug",
"last": "cards",
"slogan": "ORGANIZE. LEARN. MEMORIZE."
},
"fakeStatistics": false
},
"env": "Sandbox",
......
{
"public": {
"rooturl": "http://localhost:<branch-port>",
"dynamicSettings": "review",
"cas": {
"loginUrl": "https://cas.thm.de/cas/login",
"serviceParam": "service",
......@@ -27,11 +28,6 @@
"default": "THM"
},
"welcome": {
"title": {
"first": "review",
"last": "cards",
"slogan": "ORGANIZE. LEARN. MEMORIZE."
},
"fakeStatistics": false
},
"env": "Sandbox",
......
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