Commit db54ceea authored by Curtis Adam's avatar Curtis Adam

Transcript Bonus info: Format dates

parent 9b527ac8
......@@ -549,11 +549,19 @@ $themes: (
//transcript bonus colors
$transcript_bonus_info_text: map-get($map, "transcript_bonus_info_text");
$transcript_bonus_info_background: map-get($map, "transcript_bonus_info_background");
$transcript_bonus_info_lecture_date_past: map-get($map, "transcript_bonus_info_lecture_date_past");
$transcript_bonus_info_lecture_date_active: map-get($map, "transcript_bonus_info_lecture_date_active");
$transcript_bonus_info_lecture_date_future: map-get($map, "transcript_bonus_info_lecture_date_future");
$transcript_bonus_info_lecture_date_hover_text: map-get($map, "transcript_bonus_info_lecture_date_hover_text");
$transcript_bonus_info_lecture_date_hover_background: map-get($map, "transcript_bonus_info_lecture_date_hover_background");
$transcript_bonus_info_lecture_date_year_text: map-get($map, "transcript_bonus_info_lecture_date_year_text");
$transcript_bonus_info_lecture_date_year_background: map-get($map, "transcript_bonus_info_lecture_date_year_background");
$transcript_bonus_info_lecture_date_month_text: map-get($map, "transcript_bonus_info_lecture_date_month_text");
$transcript_bonus_info_lecture_date_month_background: map-get($map, "transcript_bonus_info_lecture_date_month_background");
$transcript_bonus_info_lecture_date_day_border: map-get($map, "transcript_bonus_info_lecture_date_day_border");
$transcript_bonus_info_lecture_date_day_past_text: map-get($map, "transcript_bonus_info_lecture_date_day_past_text");
$transcript_bonus_info_lecture_date_day_past_background: map-get($map, "transcript_bonus_info_lecture_date_day_past_background");
$transcript_bonus_info_lecture_date_day_active_text: map-get($map, "transcript_bonus_info_lecture_date_day_active_text");
$transcript_bonus_info_lecture_date_day_active_background: map-get($map, "transcript_bonus_info_lecture_date_day_active_background");
$transcript_bonus_info_lecture_date_day_future_text: map-get($map, "transcript_bonus_info_lecture_date_day_future_text");
$transcript_bonus_info_lecture_date_day_future_background: map-get($map, "transcript_bonus_info_lecture_date_day_future_background");
$transcript_bonus_info_lecture_date_day_hover_text: map-get($map, "transcript_bonus_info_lecture_date_day_hover_text");
$transcript_bonus_info_lecture_date_day_hover_background: map-get($map, "transcript_bonus_info_lecture_date_day_hover_background");
//markdeep editor colors
$markdeep_help_text: map-get($map, "markdeep_help_text");
$markdeep_help_background: map-get($map, "markdeep_help_background");
......@@ -3043,18 +3051,32 @@ $themes: (
}
.bonusTranscriptInfoLectureDates {
.year {
color: $transcript_bonus_info_lecture_date_year_text !important;
background-color: $transcript_bonus_info_lecture_date_year_background !important;
}
.month {
color: $transcript_bonus_info_lecture_date_month_text !important;
background-color: $transcript_bonus_info_lecture_date_month_background !important;
}
.day {
border-color: $transcript_bonus_info_lecture_date_day_border !important;
}
.past {
color: $transcript_bonus_info_lecture_date_past !important;
color: $transcript_bonus_info_lecture_date_day_past_text !important;
background-color: $transcript_bonus_info_lecture_date_day_past_background !important;
}
.active {
color: $transcript_bonus_info_lecture_date_active !important;
color: $transcript_bonus_info_lecture_date_day_active_text !important;
background-color: $transcript_bonus_info_lecture_date_day_active_background !important;
}
.future {
color: $transcript_bonus_info_lecture_date_future !important;
color: $transcript_bonus_info_lecture_date_day_future_text !important;
background-color: $transcript_bonus_info_lecture_date_day_future_background !important;
}
.past:hover, .active:hover, .future:hover {
color: $transcript_bonus_info_lecture_date_hover_text !important;
background-color: $transcript_bonus_info_lecture_date_hover_background !important;
color: $transcript_bonus_info_lecture_date_day_hover_text !important;
background-color: $transcript_bonus_info_lecture_date_day_hover_background !important;
}
}
//presentation colors
......
......@@ -591,11 +591,19 @@
//transcript bonus colors
"transcript_bonus_info_text": white,
"transcript_bonus_info_background": $thm_red,
"transcript_bonus_info_lecture_date_past": $thm_red,
"transcript_bonus_info_lecture_date_active": $thm_green,
"transcript_bonus_info_lecture_date_future": $thm_gray,
"transcript_bonus_info_lecture_date_hover_text": black,
"transcript_bonus_info_lecture_date_hover_background": LightGoldenRodYellow,
"transcript_bonus_info_lecture_date_year_text": white,
"transcript_bonus_info_lecture_date_year_background": $thm_orange,
"transcript_bonus_info_lecture_date_month_text": white,
"transcript_bonus_info_lecture_date_month_background": $thm_gray,
"transcript_bonus_info_lecture_date_day_border": white,
"transcript_bonus_info_lecture_date_day_past_text": white,
"transcript_bonus_info_lecture_date_day_past_background": rgba($thm_red, 0.5),
"transcript_bonus_info_lecture_date_day_active_text": white,
"transcript_bonus_info_lecture_date_day_active_background": $thm_green,
"transcript_bonus_info_lecture_date_day_future_text": white,
"transcript_bonus_info_lecture_date_day_future_background": rgba($thm_gray, 0.5),
"transcript_bonus_info_lecture_date_day_hover_text": black,
"transcript_bonus_info_lecture_date_day_hover_background": LightGoldenRodYellow,
//markdeep editor colors
"markdeep_help_text": $white,
"markdeep_help_background": $thm_orange,
......
......@@ -650,7 +650,7 @@
"median": "Durchschnittliche Anzahl der Mitschriften pro Teilnehmer",
"tooltip": {
"lecture": {
"past": "Der Termin für die Abgabe ist bereits abgelaufen.",
"past": "Der Termin für die Foto-Abgabefrist ist bereits abgelaufen.",
"active": "Der Termin für die Foto-Abgabefrist ist momentan aktiv.",
"future": "Der Termin für die Foto-Abgabefrist wurde noch nicht freigeschaltet."
}
......
......@@ -653,7 +653,7 @@
"median": "Average number of transcripts per participant",
"tooltip": {
"lecture": {
"past": "Der Termin für die Abgabe ist bereits abgelaufen.",
"past": "Der Termin für die Foto-Abgabefrist ist bereits abgelaufen.",
"active": "Der Termin für die Foto-Abgabefrist ist momentan aktiv.",
"future": "Der Termin für die Foto-Abgabefrist wurde noch nicht freigeschaltet."
}
......
......@@ -45,7 +45,7 @@ export let Utilities = class Utilities {
minutes = "H:mm";
}
if (!transformToSpeech) {
dateFormat = "D. MMMM";
dateFormat = "DD";
return moment(date).locale(Session.get('activeLanguage')).calendar(null, {
sameDay: dateFormat,
lastDay: dateFormat,
......
......@@ -580,13 +580,21 @@ th .field-tip {
}
.bonusTranscriptInfoLectureDates {
.active, .past, .future {
display: block;
width: 100%;
padding-top: 3px;
padding-bottom: 3px;
.day, .month, .year {
padding-top: 5px;
padding-bottom: 5px;
}
.day {
border: 3px solid;
text-align: center;
}
.active:hover, .past:hover, .future:hover {
.day:hover {
cursor: help;
}
.month {
margin-top: 15px;
}
.year + .month {
margin-top: 5px;
}
}
\ No newline at end of file
<template name="cardsetInfoBoxItemTranscriptLectureDates">
<tr>
<td>{{_ "transcriptForm.bonus.form.lectureDates"}}:</td>
<td class="bonusTranscriptInfoLectureDates">
{{#each getLectureDates this}}
<div class="{{getStatus this 0}}" title="{{getStatus this 1}}">{{getMomentsDate this.date false false false}}</div>
{{/each}}
<td colspan="2">{{_ "transcriptForm.bonus.form.lectureDates"}}:<br>
<div class="bonusTranscriptInfoLectureDates">
{{#each getLectureDates this}}
{{#if isNewYear this}}
<div class="col-xs-12 year">{{getYear}}</div>
{{/if}}
{{#if isNewMonth this}}
<div class="col-xs-12 month">{{getMonth}}</div>
{{/if}}
<div class="{{getStatus this 0}} col-xs-2 day" title="{{getStatus this 1}}">{{getMomentsDate this.date false false false}}</div>
{{/each}}
</div>
</td>
</tr>
</template>
//------------------------ IMPORTS
import {Template} from "meteor/templating";
import {TranscriptBonusList} from "../../../../../../api/transcriptBonus";
import {Session} from "meteor/session";
import "./lectureDates.html";
/*
......@@ -9,6 +10,8 @@ import "./lectureDates.html";
* ############################################################################
*/
let lastMonth;
let lastYear;
Template.cardsetInfoBoxItemTranscriptLectureDates.helpers({
getLectureDates: function (cardset) {
if (cardset.transcriptBonus !== undefined) {
......@@ -21,6 +24,26 @@ Template.cardsetInfoBoxItemTranscriptLectureDates.helpers({
return results;
}
},
isNewMonth: function (transcriptBonus) {
let currentMonth = moment(transcriptBonus.date).month();
if (currentMonth !== lastMonth) {
lastMonth = currentMonth;
return true;
}
},
isNewYear: function (transcriptBonus) {
let currentYear = moment(transcriptBonus.date).year();
if (currentYear !== lastYear) {
lastYear = currentYear;
return true;
}
},
getMonth: function () {
return moment().month(lastMonth).locale(Session.get('activeLanguage')).format('MMMM');
},
getYear: function () {
return lastYear;
},
//returnMode 0 = Return class
//returnMode 1 = Return tooltip
getStatus: function (transcriptBonus, returnMode = 0) {
......@@ -47,3 +70,8 @@ Template.cardsetInfoBoxItemTranscriptLectureDates.helpers({
}
}
});
Template.cardsetInfoBoxItemTranscriptLectureDates.onCreated(function () {
lastMonth = undefined;
lastYear = undefined;
});
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