Added glc to london
added alert messages added some delay messages, i hope.
This commit is contained in:
parent
c932fef30b
commit
e889947777
@ -58,7 +58,7 @@ li {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.down, .delayed, .trendDown {
|
.down, .delayed, .trendDown {
|
||||||
color: mui-color('red') !important;
|
color: $mui-text-danger; !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nochange {
|
.nochange {
|
||||||
|
@ -16,7 +16,9 @@ const { RouteModel, RouteView } = require('./route');
|
|||||||
{ 'from': 'glq', 'to': 'dbe' },
|
{ 'from': 'glq', 'to': 'dbe' },
|
||||||
{ 'from': 'pyg', 'to': 'glc' },
|
{ 'from': 'pyg', 'to': 'glc' },
|
||||||
{ 'from': 'glc', 'to': 'ptk' },
|
{ 'from': 'glc', 'to': 'ptk' },
|
||||||
{ 'from': 'ptk', 'to': 'dbe' }
|
{ 'from': 'ptk', 'to': 'dbe' },
|
||||||
|
{ 'from': 'glc', 'to': 'eus' },
|
||||||
|
{ 'from': 'eus', 'to': 'glc' }
|
||||||
],
|
],
|
||||||
'views':{}
|
'views':{}
|
||||||
|
|
||||||
|
@ -16,8 +16,10 @@ const RouteModel = Backbone.Model.extend({
|
|||||||
this.set('interval', null);
|
this.set('interval', null);
|
||||||
this.update();
|
this.update();
|
||||||
},
|
},
|
||||||
'update': function () {
|
'update': function (m) {
|
||||||
console.log('Route model update');
|
console.log('Route model update');
|
||||||
|
console.log(this.changedAttributes());
|
||||||
|
console.log(_.keys(this.changedAttributes()));
|
||||||
if (!this.get('to'))
|
if (!this.get('to'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -112,26 +114,19 @@ const RouteView = Backbone.View.extend({
|
|||||||
|
|
||||||
console.log(route);
|
console.log(route);
|
||||||
|
|
||||||
const thead = `<div class="mui--text-center mui--text-accent">${route.locationName} TO ${route.filterLocationName}</div>
|
|
||||||
<table class="mui-table mui-table-bordered">
|
|
||||||
<thead><tr><th>Destination</th>
|
|
||||||
<th>Time</th>
|
|
||||||
<th>Status</th>
|
|
||||||
<th>Platform</th></tr></thead>
|
|
||||||
|
|
||||||
`;
|
|
||||||
|
|
||||||
let ws = '';
|
let ws = '';
|
||||||
const services = [];
|
const services = [];
|
||||||
if (typeof route.trainServices === 'object' && route.trainServices !== null)
|
if (typeof route.trainServices === 'object' && route.trainServices !== null)
|
||||||
for (const item of route.trainServices) {
|
for (const item of route.trainServices) {
|
||||||
const dest = item.destination[0];
|
const dest = item.destination[0];
|
||||||
const via = dest.via !== null ? `<em class="mui--text-accent">${dest.via}</em>` : '';
|
const via = dest.via !== null ? `<em class="mui--text-accent">${dest.via}</em>` : '';
|
||||||
const platform = item.platform !== null ? item.platform : '💠';
|
const platform = item.platform !== null ? item.platform : '🚉';
|
||||||
const time = item.sta !== null ? item.sta : `D ${item.std}`;
|
// 🚉 💠
|
||||||
|
const time = item.sta !== null ? item.sta : `<em class="mui--text-accent-secondary">D</em> ${item.std}`;
|
||||||
const status = item.eta !== null ? item.eta : item.etd;
|
const status = item.eta !== null ? item.eta : item.etd;
|
||||||
|
|
||||||
const statusMode = (item.eta.toLowerCase() === 'on time') ? 'ontime' : 'delayed';
|
const statusMode = (status.toLowerCase() === 'on time') ? 'ontime' : 'delayed';
|
||||||
|
const delayReason = (item.delayReason !== null) ? '<tr><td colspan="4" class="mui--bg-danger mui--text-white" style="padding-bottom:2px;">${item.delayReason}</td></tr>' : '';
|
||||||
|
|
||||||
services.push({ 'location':dest.locationName, 'time':time, 'status':status, 'platform':platform, 'cancel':item.cancelReason, 'type':'train' });
|
services.push({ 'location':dest.locationName, 'time':time, 'status':status, 'platform':platform, 'cancel':item.cancelReason, 'type':'train' });
|
||||||
if (!item.isCancelled)
|
if (!item.isCancelled)
|
||||||
@ -139,7 +134,7 @@ const RouteView = Backbone.View.extend({
|
|||||||
<td class="mui--text-center">${time}</td>
|
<td class="mui--text-center">${time}</td>
|
||||||
<td class="mui--text-center ${statusMode}">${status}</td>
|
<td class="mui--text-center ${statusMode}">${status}</td>
|
||||||
<td class="mui--text-center">${platform}</td>
|
<td class="mui--text-center">${platform}</td>
|
||||||
</tr>`;
|
</tr>${delayReason}`;
|
||||||
else
|
else
|
||||||
ws = `${ws }<tr><td>${dest.locationName} ${via}</td><td>${time}</td>
|
ws = `${ws }<tr><td>${dest.locationName} ${via}</td><td>${time}</td>
|
||||||
<td colspan="2" class="delayed">❌ ${item.cancelReason}</td></tr>`;
|
<td colspan="2" class="delayed">❌ ${item.cancelReason}</td></tr>`;
|
||||||
@ -157,6 +152,24 @@ const RouteView = Backbone.View.extend({
|
|||||||
ws = `${ws }<tr><td>🚌 ${dest.locationName} ${via}</td><td>${time}</td><td>${status}</td><td>${platform}</td></tr>`;
|
ws = `${ws }<tr><td>🚌 ${dest.locationName} ${via}</td><td>${time}</td><td>${status}</td><td>${platform}</td></tr>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let nrMessages = '';
|
||||||
|
if (typeof route.nrccMessages === 'object' && route.nrccMessages !== null)
|
||||||
|
// we have national rail messages so put a box at the top
|
||||||
|
// <div class="mui--bg-danger .mui--text-white" style="height:10px;"></div>
|
||||||
|
for (const item of route.nrccMessages) {
|
||||||
|
const msg = item.value;
|
||||||
|
|
||||||
|
nrMessages = `${nrMessages}<div class="mui--bg-danger mui--text-white" style="padding:2px;">${msg}</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const thead = `<div class="mui--text-center mui--text-accent">${route.locationName} TO ${route.filterLocationName}</div>
|
||||||
|
${nrMessages}
|
||||||
|
<table class="mui-table mui-table-bordered">
|
||||||
|
<thead><tr><th>Destination</th>
|
||||||
|
<th>Time</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Platform</th></tr></thead>`;
|
||||||
|
|
||||||
ws = `${thead}${ws}</table>`;
|
ws = `${thead}${ws}</table>`;
|
||||||
this.$traintext.empty().html(ws);
|
this.$traintext.empty().html(ws);
|
||||||
this.$traintext.removeClass('mui--hide').addClass('mui--show');
|
this.$traintext.removeClass('mui--hide').addClass('mui--show');
|
||||||
|
Loading…
Reference in New Issue
Block a user