diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-06-25 20:14:33 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-08-15 20:02:44 +0200 |
| commit | d5a07c1c2ce3ef3b982a5197b4351d3f39060f42 (patch) | |
| tree | 433942e170fa1f4010bc7366210e781e4fd3dbba | |
| parent | a866f64c2e3d9b0b1096e0f269836ec1c320898f (diff) | |
| download | wvs-vplan-d5a07c1c2ce3ef3b982a5197b4351d3f39060f42.tar.gz wvs-vplan-d5a07c1c2ce3ef3b982a5197b4351d3f39060f42.zip | |
zeige wichtige Vertretungen über dem PDF/Teilenbutton an
| -rw-r--r-- | www/js/index.js | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/www/js/index.js b/www/js/index.js index 8a93757..30b9466 100644 --- a/www/js/index.js +++ b/www/js/index.js @@ -240,7 +240,8 @@ function fillForm(){ } /* benachrichtigt den Benutzer an vdate mit msg */ -function addNotification(vdate, msg, $div){ +function addNotification(vdate, msgarr, $div){ + var msg = msgarr.join('\n'); var title = 'Vertretungen für ' + vdate.format('dddd'); var ndate = vdate.subtract('days', 1).add('days', $('#notifydayflip').val()); // Bei Bedarf einen Tag vorher @@ -263,7 +264,9 @@ function addNotification(vdate, msg, $div){ } /* zeigt einen Button an, mit dem die Vertretung geteilt werden kann */ -function addSocialButton(vdate, msg, $div){ +function addSocialButton(vdate, msgarr, $div){ + var msg = msgarr.join(','); + if(moment().isBefore(vdate)){ var datestr = vdate.format('dddd'); var sharebtns = $('button', $div); @@ -563,11 +566,22 @@ function benutzeVertretungen(pageText, $div){ vdate.set('minute', time[1]); if(vertretungen.length > 0){ - addSocialButton(vdate, vertretungen.join(', '), $div); - addNotification(vdate, vertretungen.join('\n'), $div); + addSocialButton(vdate, vertretungen, $div); + addNotification(vdate, vertretungen, $div); + + var $holder = $('<div />'); + + vertretungen.forEach(function(vertretung){ + var $text = $('<p />'); + + $text.text(vertretung); + $holder.append($text); + }); + + $div.prepend($holder); }else{ if($('#notifynullflip').val() == 'true'){ - addNotification(vdate, 'Keine weiteren Vertretungen', $div); // TODO FIXME Problem bei mehreren Seiten! + addNotification(vdate, ['Keine weiteren Vertretungen'], $div); // TODO FIXME Problem bei mehreren Seiten! } } } |
