Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 4 additions & 89 deletions gtfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,253 +276,168 @@
options:
- value: 3
text: Bus
group: Standard
- value: 0
text: Tram
group: Standard
- value: 1
text: Subway
group: Standard
- value: 2
text: Rail
group: Standard
- value: 4
text: Ferry
group: Standard
- value: 5
text: Cable car
group: Standard
- value: 6
text: Gondola
group: Standard
- value: 7
text: Funicular
group: Extended
- value: 11
text: Trolleybus
- value: 12
text: Monorail
- value: 100
text: Railway Service
group: Extended
- value: 100
text: Railway Service
group: Extended
- value: 101
text: High Speed Rail Service
group: Extended
- value: 102
text: Long Distance Trains
group: Extended
- value: 103
text: Inter Regional Rail Service
group: Extended
- value: 104
text: Car Transport Rail Service
group: Extended
- value: 105
text: Sleeper Rail Service
group: Extended
- value: 106
text: Regional Rail Service
group: Extended
- value: 107
text: Tourist Railway Service
group: Extended
- value: 108
text: Rail Shuttle (Within Complex)
group: Extended
- value: 109
text: Suburban Railway
group: Extended
- value: 110
text: Replacement Rail Service
group: Extended
- value: 111
text: Special Rail Service
group: Extended
- value: 112
text: Lorry Transport Rail Service
group: Extended
- value: 113
text: All Rail Services
group: Extended
- value: 114
text: Cross-Country Rail Service
group: Extended
- value: 115
text: Vehicle Transport Rail Service
group: Extended
- value: 116
text: Rack and Pinion Railway
group: Extended
- value: 117
text: Additional Rail Service
group: Extended
- value: 200
text: Coach Service
group: Extended
- value: 201
text: International Coach Service
group: Extended
- value: 202
text: National Coach Service
group: Extended
- value: 203
text: Shuttle Coach Service
group: Extended
- value: 204
text: Regional Coach Service
group: Extended
- value: 205
text: Special Coach Service
group: Extended
- value: 206
text: Sightseeing Coach Service
group: Extended
- value: 207
text: Tourist Coach Service
group: Extended
- value: 208
text: Commuter Coach Service
group: Extended
- value: 209
text: All Coach Services
group: Extended
- value: 400
text: Urban Railway Service
group: Extended
- value: 401
text: Metro Service
group: Extended
- value: 402
text: Underground Service
group: Extended
- value: 403
text: Urban Railway Service
group: Extended
- value: 404
text: All Urban Railway Services
group: Extended
- value: 405
text: Monorail
group: Extended
- value: 700
text: Bus Service
group: Extended
- value: 701
text: Regional Bus Service
group: Extended
- value: 702
text: Express Bus Service
group: Extended
- value: 703
text: Stopping Bus Service
group: Extended
- value: 704
text: Local Bus Service
group: Extended
- value: 705
text: Night Bus Service
group: Extended
- value: 706
text: Post Bus Service
group: Extended
- value: 707
text: Special Needs Bus
group: Extended
- value: 708
text: Mobility Bus Service
group: Extended
- value: 709
text: Mobility Bus for Registered Disabled
group: Extended
- value: 710
text: Sightseeing Bus
group: Extended
- value: 711
text: Shuttle Bus
group: Extended
- value: 712
text: School Bus
group: Extended
- value: 713
text: School and Public Service Bus
group: Extended
- value: 714
text: Rail Replacement Bus Service
group: Extended
- value: 715
text: Demand and Response Bus Service
group: Extended
- value: 716
text: All Bus Services
group: Extended
- value: 800
text: Trolleybus Service
group: Extended
- value: 900
text: Tram Service
group: Extended
- value: 901
text: City Tram Service
group: Extended
- value: 902
text: Local Tram Service
group: Extended
- value: 903
text: Regional Tram Service
group: Extended
- value: 904
text: Sightseeing Tram Service
group: Extended
- value: 905
text: Shuttle Tram Service
group: Extended
- value: 906
text: All Tram Services
group: Extended
- value: 1000
text: Water Transport Service
group: Extended
- value: 1100
text: Air Service
group: Extended
- value: 1200
text: Ferry Service
group: Extended
- value: 1300
text: Aerial Lift Service
group: Extended
- value: 1400
text: Funicular Service
group: Extended
- value: 1500
text: Taxi Service
group: Extended
- value: 1501
text: Communal Taxi Service
group: Extended
- value: 1502
text: Water Taxi Service
group: Extended
- value: 1503
text: Rail Taxi Service
group: Extended
- value: 1504
text: Bike Taxi Service
group: Extended
- value: 1505
text: Licensed Taxi Service
group: Extended
- value: 1506
text: Private Hire Service Vehicle
group: Extended
- value: 1507
text: All Taxi Services
group: Extended
- value: 1700
text: Miscellaneous Service
group: Extended
- value: 1702
text: Horse-drawn Carriage
group: Extended
columnWidth: 6
helpContent: The route_type field describes the type of transportation used on a route. Valid values for this field are...
- name: route_sort_order
Expand Down
69 changes: 36 additions & 33 deletions lib/editor/components/EditorInput.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import React, {Component} from 'react'
import * as React from 'react'
import {Checkbox, FormControl, FormGroup, ControlLabel, Tooltip, OverlayTrigger} from 'react-bootstrap'
import Select from 'react-select'
import moment from 'moment'
Expand Down Expand Up @@ -53,7 +53,7 @@ const entityToOption = (entity: ?Entity, key: string) => {
: null
}

export default class EditorInput extends Component<Props> {
export default class EditorInput extends React.Component<Props> {
_onColorChange = (color: any) => {
const {onChange, updateActiveGtfsEntity, activeEntity, activeComponent, field} = this.props
const val = color.hex.split('#')[1]
Expand Down Expand Up @@ -118,31 +118,26 @@ export default class EditorInput extends Component<Props> {
}
}

_renderRouteTypeOptions = (field: any) => {
const standardTypes = []
const extendedTypes = []
const routeTypes = ['Standard', 'Extended']
const fieldOptions = field.options
for (const option in fieldOptions) {
if (fieldOptions[option].group === 'Standard') {
standardTypes.push(fieldOptions[option])
} else {
extendedTypes.push(fieldOptions[option])
_renderRouteTypeOptions = (field: GtfsSpecField): React.Node => {
const options = field.options || []
const toOption = ({value, text}) => (
<option key={value}>{text} ({value})</option>
)
// The first 10 options (types 0 - 12) are the standard types found in the
// GTFS specification. All others represent extended route types.
const routeTypes = [
{
label: 'Standard',
options: options.slice(0, 9).map(toOption)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

},
{
label: 'Extended',
options: options.slice(10).map(toOption)
}
}
return (
routeTypes.map<any>(type => (
<optgroup key={type} label={type}>
{type === 'Standard'
? standardTypes.map<any>(sType => (
<option key={sType.value}>{sType.text}</option>
))
: extendedTypes.map<any>(exType => (
<option key={exType.value}>{exType.text}</option>
))
}
</optgroup>
)))
]
return routeTypes.map(({label, options}) => (
<optgroup key={label} label={label}>{options}</optgroup>
))
}

render () {
Expand Down Expand Up @@ -327,24 +322,32 @@ export default class EditorInput extends Component<Props> {
</span>
)
case 'DROPDOWN':
const options = field.options || []
return (
<FormGroup
{...formProps}
className={field.columnWidth ? `col-xs-${field.columnWidth}` : 'col-xs-12'}>
{basicLabel}
<FormControl
{...fieldProps}
value={!doesNotExist(value) ? value : ''} // set value to '' to allow for selection of disabled option
// set value to '' to allow for selection of disabled option
value={!doesNotExist(value) ? value : ''}
disabled={approveGtfsDisabled && field.adminOnly}>
{/* Add field for empty string value if that is not an allowable option so that user selection triggers onChange */}
{field.options && field.options.findIndex(option => option.value === '') === -1
? <option disabled value=''>{field.required ? '-- select an option --' : '(optional)' }</option>
{options.findIndex(option => option.value === '') === -1
? <option disabled value=''>
{field.required ? '-- select an option --' : '(optional)' }
</option>
: null
}
{field.name === 'route_type' && (
this._renderRouteTypeOptions(field)
)}
{field.name !== 'route_type' && field.options && field.options.map(o => (<option value={o.value} key={o.value}>{o.text || o.value}</option>))}}
{field.name === 'route_type'
? this._renderRouteTypeOptions(field)
: options.map(o => (
<option value={o.value} key={o.value}>
{o.text || o.value}
</option>
))
}
</FormControl>
</FormGroup>
)
Expand Down