Commit ab4708bd authored by Curtis Adam's avatar Curtis Adam

Use Cases: Greet the user with the time of day

parent 4bf044d6
......@@ -531,7 +531,12 @@
"useCases": {
"modal": {
"title": "Wegweiser",
"text": "Hallo __firstName__, willkommen auf 🍅cards! \n\n Was möchtest du tun?",
"text": "__greeting__, __firstName__, willkommen auf 🍅cards! \n\n Was möchtest du tun?",
"greeting": {
"morning": "Guten Morgen",
"afternoon": "Guten Tag",
"evening": "Guten Abend"
},
"noName": "User",
"description": {
"create": "Ich möchte eine Kartei mit Karten von einem bestimmten Typ anlegen:",
......
......@@ -532,7 +532,12 @@
"useCases": {
"modal": {
"title": "Use Cases",
"text": "Hello __firstName__, what would you like to do?",
"text": "__greeting__, __firstName__, what would you like to do?",
"greeting": {
"morning": "Good morning",
"afternoon": "Good afternoon",
"evening": "Good evening"
},
"noName": "User",
"description": {
"create": "I want to create a card index with cards of the type:",
......
......@@ -15,12 +15,12 @@
<thead>
<tr class="hidden-xs">
<th colspan="2">
{{_ "useCases.modal.text" firstName = getFirstName}}
{{getWelcomeMessage getFirstName}}
</th>
</tr>
<tr class="visible-xs">
<th>
{{_ "useCases.modal.text" firstName = getFirstName}}
{{getWelcomeMessage getFirstName}}
</th>
</tr>
</thead>
......
......@@ -60,6 +60,18 @@ Template.useCasesModal.onRendered(function () {
});
Template.useCasesModal.helpers({
getWelcomeMessage: function (firstName) {
let time = moment().format('H');
let greeting = "";
if (time >= 0 && time < 12) {
greeting = TAPi18n.__('useCases.modal.greeting.morning');
} else if (time >= 12 && time < 18) {
greeting = TAPi18n.__('useCases.modal.greeting.afternoon');
} else {
greeting = TAPi18n.__('useCases.modal.greeting.evening');
}
return TAPi18n.__('useCases.modal.text', {greeting: greeting, firstName: firstName});
},
getFirstName: function () {
if (Meteor.user() && Meteor.user().profile.givenname !== undefined && Meteor.user().profile.givenname !== "") {
return Meteor.user().profile.givenname;
......
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