Browse Source

Mark current time on the schedule

Add a grey background on cells matching the current time, to make
it clearer where we are in the day.

Change-Id: Id2d13ae59f63c7059bba8abdf762b25e6339720e
changes/82/751782/1
Thierry Carrez 1 month ago
parent
commit
fc5a649df2
2 changed files with 15 additions and 2 deletions
  1. +2
    -2
      html/ptg.html
  2. +13
    -0
      html/ptg.js

+ 2
- 2
html/ptg.html View File

@@ -112,7 +112,7 @@
<table class="table table-condensed">
<thead><tr><th></th>
{{#each times as |time|}}
<th>{{ displaytime time }}</th>
<th {{ activetime time }}>{{ displaytime time }}</th>
{{/each}}
</tr></thead>
{{#each @root.schedule as |sched room|}}
@@ -121,7 +121,7 @@
<span class="glyphicon glyphicon-{{sched.cap_icon}}"
title="{{sched.cap_desc}}"></span>{{/if}}</td>
{{#each (lookup @root.slots day) as |time|}}
<td>{{ roomcode @root.urls @root.schedule room time.name 0 }}</td>
<td {{ activetime time }}">{{ roomcode @root.urls @root.schedule room time.name 0 }}</td>
{{/each}}
</tr>
{{/if}}


+ 13
- 0
html/ptg.js View File

@@ -120,6 +120,19 @@ Handlebars.registerHelper('displaytime',
return new Handlebars.SafeString(content);
});

// Grey out cell if current time matches the slot hour
Handlebars.registerHelper('activetime',
function(time) {
if (time['realtime'] != undefined) {
var t = new Date(time['realtime']);
var now = new Date();
var diff = now.getTime() - t.getTime();
if (diff > 0 && diff < (1000*60*60)) {
return new Handlebars.SafeString('style="background-color: #eeeeee"');
}
}
return new Handlebars.SafeString('');
});

// What is the day today ?
// Return Monday until Tuesday 1 UTC


Loading…
Cancel
Save