Browse Source

Single table for scheduled and additional rooms

Collapse the "scheduled" and "additional" tracks tables into
a single table. This extends the "roomcode" helper to be
smart enough to guess what the cell should contain.

Change-Id: I60887d5da0878820817f17c9f4fd1aa20f546aac
changes/80/542180/1
Thierry Carrez 4 years ago
parent
commit
adbd5e4957
  1. 41
      html/ptg.html
  2. 36
      html/ptg.js

41
html/ptg.html

@ -78,45 +78,10 @@
{{/each}}
</tr></thead>
{{#each @root.scheduled as |schedule room|}}
{{#if (roomactive @root.scheduled @root.additional room times)}}
<tr><td>{{room}}</td>
{{#each (lookup @root.slots day) as |time|}}
<td><span class="label label-primary {{lookup schedule time.name}}">{{lookup schedule time.name}}</td>
{{/each}}
</tr>
{{/each}}
</table>
</div>
{{/each}}
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Additional tracks</h3></div>
<div class="panel-body">
<ul class="nav nav-tabs" role="tablist">
{{#each slots as |times day|}}
<li role="presentation"><a id='at{{day}}' href="#a{{day}}" aria-controls="a{{day}}" role="tab" data-toggle="tab">{{day}}</a></li>
{{/each}}
</ul>
<!-- Tab panes -->
<div class="tab-content">
{{#each slots as |times day|}}
<div role="tabpanel" class="tab-pane" id="a{{day}}">
<table class="table table-condensed">
<thead><tr><th></th>
{{#each times as |time|}}
<th>{{time.desc}}</th>
{{/each}}
</tr></thead>
{{#each @root.additional as |schedule room|}}
{{#if (roomactive schedule times)}}
<tr><td>{{room}}</td>
{{#each (lookup @root.slots day) as |time|}}
{{#if (lookup schedule time.name)}}
<td><span class="label label-primary {{lookup schedule time.name}}">{{lookup schedule time.name}}</td>
{{else}}
<td><small><i>{{roomcode schedule room time.name}}</i></small></td>
{{/if}}
<td>{{ roomcode @root.scheduled @root.additional room time.name }}</td>
{{/each}}
</tr>
{{/if}}
@ -125,7 +90,7 @@
</div>
{{/each}}
</div>
<small><i>Use #TRACK book SLOTREF to book one of those empty slots</i></small></td>
<small><i>Use '#TRACK book SLOTREF' to book one of the empty slots with the ptgbot</i></small>
</div>
</div>
<p class="text-muted">Content on this page is being driven by room operators through the openstackptg bot on the #openstack-ptg IRC channel. It was last refreshed on {{timestamp}}.</p>

36
html/ptg.js

@ -18,20 +18,44 @@ Handlebars.registerHelper('hashtag', function(options) {
return new Handlebars.SafeString(sentence);
});
Handlebars.registerHelper('roomactive', function(schedule, times) {
Handlebars.registerHelper('roomactive',
function(scheduled, additional, room, times) {
for (var i=0; i<times.length; i++) {
if (schedule[times[i]['name']] != undefined) {
if (scheduled[room][times[i]] != "") {
return true;
}
if (additional[room]) {
if (additional[room][times[i]['name']] != undefined) {
return true;
}
}
}
return false;
});
Handlebars.registerHelper('roomcode', function(schedule, room, timecode) {
if (schedule[timecode] == "") {
return room + "-" + timecode;
Handlebars.registerHelper('roomcode',
function(scheduled, additional, room, timecode) {
var cell = '';
content = scheduled[room][timecode];
if ((content != undefined) && (content != '')) {
cell = '<span class="label label-primary ' + scheduled[room][timecode] +
'">' + scheduled[room][timecode];
return new Handlebars.SafeString(cell);
} else {
if (additional[room]) {
console.log(additional[room][timecode]);
if (additional[room][timecode] != undefined) {
if (additional[room][timecode] == "") {
cell = '<small><i>' + room + "-" + timecode + '</i></small>';
} else {
cell = '<span class="label label-primary ' +
additional[room][timecode] +
'">' + additional[room][timecode];
}
}
}
}
return "";
return new Handlebars.SafeString(cell);
});
// What is the day today ?

Loading…
Cancel
Save