Commit 995fe16d authored by Curtis Adam's avatar Curtis Adam

Transcript bonus info: Add lecture dates

parent 4e35467d
......@@ -549,6 +549,11 @@ $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");
//markdeep editor colors
$markdeep_help_text: map-get($map, "markdeep_help_text");
$markdeep_help_background: map-get($map, "markdeep_help_background");
......@@ -3036,6 +3041,22 @@ $themes: (
color: $transcript_bonus_info_text !important;
background-color: $transcript_bonus_info_background !important;
}
.bonusTranscriptInfoLectureDates {
.past {
color: $transcript_bonus_info_lecture_date_past !important;
}
.active {
color: $transcript_bonus_info_lecture_date_active !important;
}
.future {
color: $transcript_bonus_info_lecture_date_future !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;
}
}
//presentation colors
.clock {
.circle {
......
......@@ -591,6 +591,11 @@
//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,
//markdeep editor colors
"markdeep_help_text": $white,
"markdeep_help_background": $thm_orange,
......
......@@ -643,6 +643,16 @@
}
},
"transcriptForm": {
"info": {
"title": "Über die Bonusschreibphase",
"tooltip": {
"lecture": {
"past": "Der Termin für die Abgabe 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."
}
}
},
"index": {
"create": "Mitschrift anlegen",
"topic": "Thema der Mitschrift",
......@@ -1090,9 +1100,6 @@
},
"cardset": {
"info": {
"title": {
"transcriptBonus": "Über die Bonusschreibphase"
},
"author": "Autor/in",
"multipleAuthors": "Mehrere",
"publisher": "Editor/in",
......
......@@ -646,6 +646,16 @@
}
},
"transcriptForm": {
"info": {
"title": "About the Bonus Writing Phase",
"tooltip": {
"lecture": {
"past": "Der Termin für die Abgabe 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."
}
}
},
"index": {
"create": "Mitschrift erstellen",
"topic": "Thema der Mitschrift",
......@@ -1092,9 +1102,6 @@
},
"cardset": {
"info": {
"title": {
"transcriptBonus": "About the Bonus Writing Phase"
},
"author": "Autor/in",
"multipleAuthors": "Mehrere",
"publisher": "Editor/in",
......
......@@ -37,13 +37,23 @@ export let Utilities = class Utilities {
}
}
static getMomentsDate (date, displayMinutes = false, displayAsDeadline = false) {
static getMomentsDate (date, displayMinutes = false, displayAsDeadline = false, transformToSpeech = true) {
let minutes = "";
let dateFormat = "D. MMMM YYYY";
if (displayMinutes === true) {
dateFormat = "D. MMM YY " + minutes;
minutes = "H:mm";
}
if (!transformToSpeech) {
return moment(date).locale(Session.get('activeLanguage')).calendar(null, {
sameDay: dateFormat,
lastDay: dateFormat,
nextDay: dateFormat,
nextWeek: dateFormat,
lastWeek: dateFormat,
sameElse: dateFormat
});
}
if (displayAsDeadline) {
return moment(date).locale(Session.get('activeLanguage')).calendar(null, {
sameDay: this.getCalendarString("today", minutes, displayAsDeadline),
......
......@@ -673,8 +673,8 @@ Template.registerHelper("getDate", function () {
return moment(date).locale(Session.get('activeLanguage')).format('LL');
});
Template.registerHelper("getMomentsDate", function (date, displayMinutes = false) {
return Utilities.getMomentsDate(date, displayMinutes);
Template.registerHelper("getMomentsDate", function (date, displayMinutes = false, displayAsDeadline = false, transformToSpeech = true) {
return Utilities.getMomentsDate(date, displayMinutes, displayAsDeadline, transformToSpeech);
});
Template.registerHelper("getMomentsDateShort", function (date) {
......
......@@ -578,3 +578,16 @@ th .field-tip {
#exportCSV .glyphicon {
margin-top: -6px !important;
}
.bonusTranscriptInfoLectureDates {
text-align: right;
.active, .past, .future {
display: block;
width: 100%;
padding-top: 3px;
padding-bottom: 3px;
}
.active:hover, .past:hover, .future:hover {
cursor: help;
}
}
\ No newline at end of file
<template name="bonusTranscriptInfoBox">
<div id="collapseBonusTranscriptInfoButton" class="col-xs-12 card card-block collapseButton">
<strong>{{_ "cardset.info.title.transcriptBonus"}}</strong>
<strong>{{_ "transcriptForm.info.title"}}</strong>
<i id="collapseBonusTranscriptInfoIcon" class="glyphicon glyphicon-collapse-down pull-right"></i>
</div>
<div class="collapse" id="collapseBonusTranscriptInfo">
<div class="card card-block">
<table class="table table-condensed table-striped table-hover infoBoxTable">
<tbody>
{{> cardsetInfoBoxItemTranscriptLectureDates}}
{{> cardsetInfoBoxItemTranscriptSubmissionDeadline}}
{{> cardsetInfoBoxItemTranscriptEditDeadline}}
{{> cardsetInfoBoxItemBonusPointsFAQ}}
......
......@@ -3,6 +3,7 @@ import {Template} from "meteor/templating";
import {CardsetVisuals} from "../../../../api/cardsetVisuals";
import "./item/bonusPointsFAQ.js";
import "./item/transcript/editDeadline.js";
import "./item/transcript/lectureDates.js";
import "./item/transcript/submissionDeadline.js";
import "./bonusTranscript.html";
......
<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>
</tr>
</template>
//------------------------ IMPORTS
import {Template} from "meteor/templating";
import {TranscriptBonusList} from "../../../../../../api/transcriptBonus";
import "./lectureDates.html";
/*
* ############################################################################
* cardsetInfoBoxItemTranscriptLectureDates
* ############################################################################
*/
Template.cardsetInfoBoxItemTranscriptLectureDates.helpers({
getLectureDates: function (cardset) {
if (cardset.transcriptBonus !== undefined) {
let results = [];
for (let i = 0; i < cardset.transcriptBonus.dates.length; i++) {
let item = JSON.parse(JSON.stringify(cardset.transcriptBonus));
item.date = new Date(cardset.transcriptBonus.dates[i]);
results.push(item);
}
return results;
}
},
//returnMode 0 = Return class
//returnMode 1 = Return tooltip
getStatus: function (transcriptBonus, returnMode = 0) {
let current = moment();
let lectureDate = moment(transcriptBonus.date);
if (current > lectureDate && !TranscriptBonusList.isDeadlineExpired(transcriptBonus)) {
if (returnMode) {
return TAPi18n.__('transcriptForm.info.tooltip.lecture.active');
} else {
return "active";
}
} else if (current > lectureDate) {
if (returnMode) {
return TAPi18n.__('transcriptForm.info.tooltip.lecture.past');
} else {
return "past";
}
} else {
if (returnMode) {
return TAPi18n.__('transcriptForm.info.tooltip.lecture.future');
} else {
return "future";
}
}
}
});
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