<commit_before>define ['jquery', 'underscore', 'backbone', 'utils', 'hbs!template/route_view'], ($, _, Backbone, Utils, template) ->
  class RouteView extends Backbone.View

    tagName: 'li'
    className: 'route'

    events:
      "click ol li": "selectLeg"
      "click a": "select"

    initialize: (@route) ->
      Reitti.Event.on 'route:change', @onRouteChanged

    dispose: ->
      Reitti.Event.off 'route:change', @onRouteChanged

    render: ->
      @$el.html template
        depTime: Utils.formatTime(@route.departureTime())
        arrTime: Utils.formatTime(@route.arrivalTime())
        legs: @_legData()
      this

    select: =>
      Reitti.Event.trigger 'route:change', @route
      false

    selectLeg: (evt) =>
      @select()
      Reitti.Event.trigger 'leg:change', @route.getLeg($(evt.target).closest('[data-leg]').data('leg'))
      false

    _lineCode: () ->
      Utils.parseLineCode _.first()

    onRouteChanged: (route) =>
      @$el.toggleClass 'selected', route is @route

    _legData: () ->
      for leg in @route.get('legs')
        {
        type: leg.type
        indicator: if leg.isWalk() then Utils.formatDistance(leg.get('length')) else leg.lineName()
        color: Utils.transportColors[leg.get('type')]
        }<commit_msg>fix route view leg type to use backbone property style<commit_after>define ['jquery', 'underscore', 'backbone', 'utils', 'hbs!template/route_view'], ($, _, Backbone, Utils, template) ->
  class RouteView extends Backbone.View

    tagName: 'li'
    className: 'route'

    events:
      "click ol li": "selectLeg"
      "click a": "select"

    initialize: (@route) ->
      Reitti.Event.on 'route:change', @onRouteChanged

    dispose: ->
      Reitti.Event.off 'route:change', @onRouteChanged

    render: ->
      @$el.html template
        depTime: Utils.formatTime(@route.departureTime())
        arrTime: Utils.formatTime(@route.arrivalTime())
        legs: @_legData()
      this

    select: =>
      Reitti.Event.trigger 'route:change', @route
      false

    selectLeg: (evt) =>
      @select()
      Reitti.Event.trigger 'leg:change', @route.getLeg($(evt.target).closest('[data-leg]').data('leg'))
      false

    _lineCode: () ->
      Utils.parseLineCode _.first()

    onRouteChanged: (route) =>
      @$el.toggleClass 'selected', route is @route

    _legData: () ->
      for leg in @route.get('legs')
        {
        type: leg.get('type')
        indicator: if leg.isWalk() then Utils.formatDistance(leg.get('length')) else leg.lineName()
        color: Utils.transportColors[leg.get('type')]
        }
{'fraction_non_alphanumeric': 0.1578137028483449, 'fraction_numerical': 0.0, 'mean_word_length': 2.7997076023391814, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3373325', 'n_tokens_mistral': 852, 'n_tokens_neox': 825, 'n_words': 173}