GitLab steht Mittwoch, den 08. Juli, zwischen 09:00 und 13:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit 734620ec authored by Curtis Adam's avatar Curtis Adam

Update the display for deadlines

parent 8f56d725
......@@ -672,7 +672,10 @@
"description": "Bonus-Mitschriften können nach Ablauf der Abgabe nicht mehr bearbeitet werden.",
"placeholder": "Wähle eine Vorlesung mit Bonusvergabe aus…",
"lecture": "Vorlesung",
"deadline": "Abgabefrist",
"deadline": {
"submission": "Foto-Abgabefrist",
"editing": "Digitale Nachbearbeitungsfrist"
},
"clock": "Uhr",
"until": "bis",
"referencesLecture": {
......@@ -688,8 +691,8 @@
"enable": "Bonus aktivieren",
"lectureTimeEnd": "Freischaltung der Mitschriftenkopplung",
"deadline": {
"submission": "Zeit für die Abgabe",
"editing": "Zeit für die Nachbearbeitung"
"submission": "Zeit für die Foto-Abgabe",
"editing": "Zeit für die digitale Nachbearbeitung"
},
"lectureDates": "Termine für das Bonus-Mitschreiben",
"clock": "Uhr",
......
......@@ -675,8 +675,8 @@
"description": "Gekoppelte Mitschriften können nach Ablauf der Abgabe nicht mehr bearbeitet werden",
"lecture": "Vorlesung",
"deadline": {
"submission": "Zeit für die Abgabe",
"editing": "Zeit für die Nachbearbeitung"
"submission": "Foto-Abgabefrist",
"editing": "Digitale Nachbearbeitungsfrist"
},
"clock": "Uhr",
"until": "bis",
......@@ -692,7 +692,10 @@
"percentage": "Maximale Bonuspunkte",
"enable": "Bonus aktivieren",
"lectureTimeEnd": "Vorlesungsende",
"deadline": "Abgabezeit",
"deadline": {
"submission": "Zeit für die Foto-Abgabe",
"editing": "Zeit für die digitale Nachbearbeitung"
},
"lectureDates": "Termine der Veranstaltungen",
"clock": "Uhr",
"hours": "Stunden",
......
......@@ -93,7 +93,7 @@ export let TranscriptBonusList = class TranscriptBonusList {
static isDeadlineExpired (transcriptBonus, isEditingDeadline = false) {
let deadline;
if (isEditingDeadline) {
deadline = transcriptBonus.deadlineEditing
deadline = transcriptBonus.deadlineEditing;
} else {
deadline = transcriptBonus.deadline;
}
......@@ -135,23 +135,30 @@ export let TranscriptBonusList = class TranscriptBonusList {
}
}
static getLectureName (transcriptBonus, isList = true, displayDeadline = true) {
return transcriptBonus.name + ": " + this.getLectureInfo(transcriptBonus, transcriptBonus.date, isList, displayDeadline);
static getLectureName (transcriptBonus) {
return transcriptBonus.name + ": " + this.getLectureEnd(transcriptBonus, transcriptBonus.date, false);
}
static getLectureInfo (transcriptBonus, date_id, isList = true, displayDeadline = true) {
static getLectureEnd (transcriptBonus, date_id) {
if (transcriptBonus.lectureEnd !== undefined) {
let lectureEnd;
if (isList) {
lectureEnd = this.addLectureEndTime(transcriptBonus, transcriptBonus.dates[date_id]);
} else {
lectureEnd = this.addLectureEndTime(transcriptBonus, date_id);
}
let info = TAPi18n.__('transcriptForm.lecture') + ": " + Utilities.getMomentsDate(lectureEnd, false);
if (displayDeadline) {
info += ", " + TAPi18n.__('transcriptForm.deadline') + ": " + Utilities.getMomentsTime(lectureEnd) + " " + TAPi18n.__('transcriptForm.until') + " " + Utilities.getMomentsDate(lectureEnd.add(transcriptBonus.deadline, 'hours'), true);
}
return info;
let lectureEnd = this.addLectureEndTime(transcriptBonus, date_id);
return TAPi18n.__('transcriptForm.lecture') + ": " + Utilities.getMomentsDate(lectureEnd, false);
}
}
static getDeadline (transcriptBonus, date_id) {
if (transcriptBonus.lectureEnd !== undefined) {
let deadline = this.addLectureEndTime(transcriptBonus, date_id);
deadline.add(transcriptBonus.deadline, 'hours');
return TAPi18n.__('transcriptForm.deadline.submission') + ": " + Utilities.getMomentsDate(deadline, true, true);
}
}
static getDeadlineEditing (transcriptBonus, date_id) {
if (transcriptBonus.lectureEnd !== undefined) {
let deadlineEditing = this.addLectureEndTime(transcriptBonus, date_id);
deadlineEditing.add(transcriptBonus.deadlineEditing, 'hours');
return TAPi18n.__('transcriptForm.deadline.editing') + ": " + Utilities.getMomentsDate(deadlineEditing, true, true);
}
}
};
import {Session} from "meteor/session";
export let Utilities = class Utilities {
static getCalendarString (type = '', minutes = '') {
static getCalendarString (type = '', minutes = '', displayAsDeadline = false) {
let today = '[Today]';
let yesterday = '[Yesterday]';
let tomorrow = '[Tomorrow]';
if (Session.get('activeLanguage') === 'de') {
if (minutes !== '') {
minutes = '[ ]' + minutes;
if (displayAsDeadline) {
minutes = '[ bis ]' + minutes + '[ Uhr ]';
} else {
minutes = '[ ]' + minutes;
}
}
today = '[Heute]';
yesterday = '[Gestern]';
tomorrow = '[Morgen]';
} else {
if (minutes !== '') {
minutes = '[ at ]' + minutes;
if (displayAsDeadline) {
minutes = '[ until ]' + minutes;
} else {
minutes = '[ ]' + minutes;
}
}
}
switch (type) {
......@@ -20,23 +30,39 @@ export let Utilities = class Utilities {
return today + minutes;
case "yesterday":
return yesterday + minutes;
case "nextDay":
return tomorrow + minutes;
default:
return type + minutes;
}
}
static getMomentsDate (date, displayMinutes = false) {
static getMomentsDate (date, displayMinutes = false, displayAsDeadline = false) {
let minutes = "";
let dateFormat = "D. MMMM YYYY";
if (displayMinutes === true) {
dateFormat = "D. MMM YY " + minutes;
minutes = "H:mm";
}
return moment(date).locale(Session.get('activeLanguage')).calendar(null, {
sameDay: this.getCalendarString("today", minutes),
lastDay: this.getCalendarString("yesterday", minutes),
nextWeek: dateFormat,
lastWeek: dateFormat,
sameElse: dateFormat
});
if (displayAsDeadline) {
return moment(date).locale(Session.get('activeLanguage')).calendar(null, {
sameDay: this.getCalendarString("today", minutes, displayAsDeadline),
lastDay: this.getCalendarString("yesterday", minutes, displayAsDeadline),
nextDay: this.getCalendarString("nextDay", minutes, displayAsDeadline),
nextWeek: this.getCalendarString(dateFormat, minutes, displayAsDeadline),
lastWeek: this.getCalendarString(dateFormat, minutes, displayAsDeadline),
sameElse: this.getCalendarString(dateFormat, minutes, displayAsDeadline)
});
} else {
return moment(date).locale(Session.get('activeLanguage')).calendar(null, {
sameDay: this.getCalendarString("today", minutes),
lastDay: this.getCalendarString("yesterday", minutes),
nextDay: this.getCalendarString("nextDay", minutes),
nextWeek: dateFormat,
lastWeek: dateFormat,
sameElse: dateFormat
});
}
}
static getMomentsTime (date) {
......
......@@ -12,7 +12,7 @@ import "./subject.html";
Template.subjectEditor.helpers({
getSubject: function () {
if (CardType.gotLearningUnit(Session.get('cardType')) && Session.get('transcriptBonus') !== undefined && !Session.get('isPrivateTranscript')) {
return TranscriptBonusList.getLectureName(Session.get('transcriptBonus'), false);
return TranscriptBonusList.getLectureName(Session.get('transcriptBonus'));
} else {
return Session.get('subject');
}
......
......@@ -13,8 +13,14 @@
<div class="form-group">
<div class="form-group setdetails name">
<div class="col-xs-12 cardtext editorElement">
<label class="radio-inline"><input type="radio" id="privateTranscript" name="belongsToUnit" value="0" {{getRadioButtonStatus 0}}>{{_ "transcriptForm.referencesLecture.false"}}</label>
<label class="radio-inline"><input type="radio" id="referencesLecture" name="belongsToUnit" value="1" {{getRadioButtonStatus 1}}>{{_ "transcriptForm.referencesLecture.true"}}</label>
<label class="radio-inline"><input type="radio" id="privateTranscript"
name="belongsToUnit"
value="0" {{getRadioButtonStatus 0}}>{{_
"transcriptForm.referencesLecture.false"}}</label>
<label class="radio-inline"><input type="radio" id="referencesLecture"
name="belongsToUnit"
value="1" {{getRadioButtonStatus 1}}>{{_
"transcriptForm.referencesLecture.true"}}</label>
</div>
{{#unless isPrivateTranscript}}
<br>
......@@ -29,23 +35,27 @@
data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false"
value="-1">
{{{getBonusLectureName}}}
{{{getBonusLectureName}}}
</button>
<button type="button"
class="btn btn-raised dropdown-toggle setTranscriptBonusLectureDropdown setTranscriptBonusLectureDropdownCaret"
data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<div class="flex-content">
<span class="caret"></span>
<span class="sr-only"></span>
</div>
<div class="flex-content">
<span class="caret"></span>
<span class="sr-only"></span>
</div>
</button>
<ul class="dropdown-menu btn-raised longButton" value="{{_ "transcriptForm.selectLecture"}}" data="-1">
<ul class="dropdown-menu btn-raised longButton"
value="{{_ "transcriptForm.selectLecture"}}" data="-1">
{{#each getBonusLectures}}
<li class="transcriptBonusLecture" value="{{this.cardset_id}}" data-cardset_id="{{this.cardset_id}}" data-date_id="{{this.date_id}}" data-name="{{this.name}}">
<li class="transcriptBonusLecture" value="{{this.cardset_id}}"
data-cardset_id="{{this.cardset_id}}"
data-date_id="{{this.date_id}}" data-name="{{this.name}}">
<a href="#">
{{this.name}}<br>
<span class="transcript-info-text">{{this.info}}</span>
<div class="transcript-info-text">{{this.info}}
<br>{{this.deadline}}<br>{{this.deadlineEditing}}</div>
<div class="cardset-details">
{{> cardsetLabels}}
</div>
......@@ -53,7 +63,8 @@
</li>
{{/each}}
</ul>
<span id="helpSetTranscriptBonusLecture" class="help-block transcriptBonusLecture"></span>
<span id="helpSetTranscriptBonusLecture"
class="help-block transcriptBonusLecture"></span>
</div>
</div>
{{/unless}}
......
......@@ -27,7 +27,9 @@ Template.selectLearningUnit.helpers({
if (TranscriptBonusList.canBeSubmittedToLecture(transcriptBonus, d)) {
let lecture = {};
lecture.name = cardsets[c].name;
lecture.info = TranscriptBonusList.getLectureInfo(cardsets[c].transcriptBonus, d);
lecture.info = TranscriptBonusList.getLectureEnd(transcriptBonus, cardsets[c].transcriptBonus.dates[d]);
lecture.deadline = TranscriptBonusList.getDeadline(transcriptBonus, cardsets[c].transcriptBonus.dates[d]);
lecture.deadlineEditing = TranscriptBonusList.getDeadlineEditing(transcriptBonus, cardsets[c].transcriptBonus.dates[d]);
lecture.cardset_id = cardsets[c]._id;
lecture.date_id = d;
lecture.shuffled = cardsets[c].shuffled;
......@@ -59,7 +61,7 @@ Template.selectLearningUnit.helpers({
let cardset = Cardsets.findOne({_id: Session.get('transcriptBonus').cardset_id}, {fields: {_id: 1, name: 1}});
let transcriptBonus = Session.get('transcriptBonus');
transcriptBonus.name = cardset.name;
return TranscriptBonusList.getLectureName(transcriptBonus, false, false);
return TranscriptBonusList.getLectureName(transcriptBonus, true);
} else {
return TAPi18n.__('transcriptForm.placeholder');
}
......@@ -112,7 +114,7 @@ Template.selectLearningUnit.onCreated(function () {
Template.selectLearningUnit.onRendered(function () {
if (Session.get('transcriptBonus') !== undefined) {
$('#setTranscriptBonusLecture').html(TranscriptBonusList.getLectureName(Session.get('transcriptBonus').name, Session.get('transcriptBonus'), Session.get('transcriptBonus').date, false));
$('#setTranscriptBonusLecture').html(TranscriptBonusList.getLectureName(Session.get('transcriptBonus'), true));
}
if (Route.isNewTranscript()) {
$('#showSelectLearningUnitModal').modal('show');
......@@ -122,7 +124,7 @@ Template.selectLearningUnit.onRendered(function () {
let cardset = Cardsets.findOne({_id: Session.get('transcriptBonus').cardset_id}, {fields: {_id: 1, name: 1}});
let transcriptBonus = Session.get('transcriptBonus');
transcriptBonus.name = cardset.name;
$('#setTranscriptBonusLecture').html(TranscriptBonusList.getLectureName(transcriptBonus, false, false));
$('#setTranscriptBonusLecture').html(TranscriptBonusList.getLectureName(transcriptBonus, true));
} else {
$('#setTranscriptBonusLecture').html(TAPi18n.__('transcriptForm.placeholder'));
}
......
......@@ -21,7 +21,7 @@
{{/if}}
<div class="resultItem col-xs-12">
<div class="resultItemHeaderWrapper">
<div class="resultItemHeader resultItemHeaderLeftArea resultItemHeaderAuthor resultItemHeaderCardType resultName {{#if isCardsetTranscriptBonusRoute}}col-xs-4 col-sm-4{{else}}col-xs-6 col-sm-6{{/if}} {{getCardsetBackground
<div class="resultItemHeader resultItemHeaderLeftArea resultItemHeaderAuthor resultItemHeaderCardType resultName {{#if isBonusTranscriptsRoute}}resultNameBonusTranscript{{/if}} {{#if isCardsetTranscriptBonusRoute}}col-xs-10 col-sm-4{{else}}col-xs-12 col-sm-6{{/if}} {{getCardsetBackground
this.difficulty this.cardType}}"
data-type="{{this.subject}}">
<a href="/presentation/transcripts/{{#if isBonusTranscriptsRoute}}bonus/{{/if}}{{#if isCardsetTranscriptBonusRoute}}{{getCardsetID}}/{{/if}}{{this._id}}">
......@@ -31,6 +31,11 @@
{{this.subject}}
{{/if}}
</a>
<span class="hidden-xs">
{{#if isBonusTranscriptsRoute}}
<br>{{getBonusLectureDeadline}}
{{/if}}
</span>
</div>
{{#if isCardsetTranscriptBonusRoute}}
<div class="resultItemHeader resultItemHeaderLeftArea resultItemHeaderAuthor resultItemHeaderCardType resultName col-xs-2 col-sm-2 {{getCardsetBackground
......@@ -38,7 +43,7 @@
{{getAuthorName this.owner}}
</div>
{{/if}}
<div class="resultItemHeader resultItemHeaderLeftArea resultItemHeaderAuthor resultItemHeaderCardType resultName col-xs-6 col-sm-3 {{getCardsetBackground
<div class="resultItemHeader resultItemHeaderLeftArea resultItemHeaderAuthor resultItemHeaderCardType resultName hidden-xs col-sm-3 {{getCardsetBackground
this.difficulty this.cardType}}">
{{getMomentsDateShort this.date}}<span class="resultDateRight">{{getMomentsDateShort
this.dateUpdated}}</span>
......
......@@ -38,11 +38,13 @@ Template.filterIndexItemCard.helpers({
let bonusTranscript = TranscriptBonus.findOne({card_id: this._id});
if (bonusTranscript !== undefined) {
bonusTranscript.name = Cardsets.findOne({_id: bonusTranscript.cardset_id}).name;
if (Route.isTranscriptBonus()) {
return TranscriptBonusList.getLectureInfo(bonusTranscript, bonusTranscript.date, false, false);
} else {
return TranscriptBonusList.getLectureName(bonusTranscript, false, false);
}
return TranscriptBonusList.getLectureName(bonusTranscript);
}
},
getBonusLectureDeadline: function () {
let bonusTranscript = TranscriptBonus.findOne({card_id: this._id});
if (bonusTranscript !== undefined) {
return TranscriptBonusList.getDeadlineEditing(bonusTranscript, bonusTranscript.date);
}
},
isMyBonusTranscriptsRouteAndDeadlineExpired: function () {
......
......@@ -80,6 +80,13 @@
padding-right: 30px !important;
}
.resultNameBonusTranscript {
@media(min-width: 768px) {
padding-top: 4px !important;
padding-bottom: 3px !important;
}
}
.authorProfile {
padding-right: 0;
}
......
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