Skip to content

Commit

Permalink
added highlighting and keypress for dropoff and pickup
Browse files Browse the repository at this point in the history
  • Loading branch information
landonreed committed Mar 20, 2015
1 parent 5e81c8a commit d0ed931
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions public/javascripts/views/trip-pattern-schedule-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ var GtfsEditor = GtfsEditor || {};
// delete trip (also requires shift key, as coded in the function)
deleteTrip: 46,
// also backspace, for laptop users with no delete key...
deleteTripAlternate: 8
deleteTripAlternate: 8,
// pickup only
pickup: 80,
// dropoff only
dropoff: 68
};

/**
Expand Down Expand Up @@ -74,6 +78,8 @@ var GtfsEditor = GtfsEditor || {};
// TODO: single-time view
// time is seconds since midnight
var text;

console.log(value.get('stopTime'));
if (value.get('stopTime') === null) {
text = '<span class="time no-stop">-</span>';
} else {
Expand All @@ -82,7 +88,9 @@ var GtfsEditor = GtfsEditor || {};
var st = value.get('stopTime');
var time = arr ? st.arrivalTime : st.departureTime;
var spTime = splitTime(time);

if (time < 30000){
td.style.backgroundColor = 'yellow';
}
if (spTime === null) {
// time is to be interpolated by consumer
text = '';
Expand Down Expand Up @@ -554,6 +562,33 @@ var GtfsEditor = GtfsEditor || {};
instance.collection.trigger('change');
});

// p: specify pickup only
}
else if (e.keyCode == keyCodes.pickup) {
if (_.isUndefined(sel) || sel[1] < 4)
return;

this.getInput('Pickup only?', function(input) {
instance.offsetTimes(sel, input);
instance.collection.trigger('change');
});
console.log('pickup!')
console.log(sel)
// d: specify dropoff only
} else if (e.keyCode == keyCodes.dropoff) {
if (_.isUndefined(sel) || sel[1] < 4)
return;
console.log('dropoff!')
console.log(sel)
// console.log(trip.get('stopTimes'))
console.log(this.collection);
console.log(instance);
// stopTime = instance.get('stopTime');
this.getInput('Dropoff only?', function(input) {
instance.offsetTimes(sel, input);
instance.collection.trigger('change');
});

// i: insert new trip
// basically, duplicate this trip or these trips, with the entered offset
} else if (e.keyCode == keyCodes.insert) {
Expand Down

0 comments on commit d0ed931

Please sign in to comment.