<commit_before>$(document).ready ->

  # Views.City.Galleries = Backbone.View.extend      

  Views.Cities.LeftMenu = Backbone.Marionette.ItemView.extend
    template: '#left_menu-template'
    # model: Models.City

    events:
      'click .map-link a': 'show_map'
      'click .calendar-link a': 'show_calendar'
      'click .cities-link a': 'show_cities'

    initialize: (item) ->
      @model = item.model
      _.bindAll @, 'deactivate_all', 'show_map', 'show_calendar', 'show_cities'

    show_map: (item) ->
      console.log( 'showing cities map' )
      @deactivate_all()
      $(item.currentTarget).addClass('active')
      U.models.cities.fetch
        success: ->
          MyApp.left_region.show new Views.Cities.Map
            model: U.models.cities

    show_calendar: (item) ->
      @deactivate_all()
      $(item.currentTarget).addClass('active')
      U.models.city.fetch
        success: ->
          MyApp.left_region.show new Views.Cities.Calendar
            model: U.models.city

    show_cities: (item) ->
      @deactivate_all()
      $(item.currentTarget).addClass('active')
      U.models.cities.fetch
        success: ->
          MyApp.left_region.show( U.views.cities.index )
      
    deactivate_all: (item) ->
      while $(".left-menu ul li a.active").length > 0
        _.each $(".left-menu ul li a.active"), (key, value) ->
          item = $(".left-menu ul li a.active").eq(value)
          item.removeClass('active')


  Views.Cities.RightMenu = Backbone.Marionette.ItemView.extend
    template: '#cities_right_menu-template'
    # I think this is unnecessary if I set the @model in the initializer?
    # model: Models.City
    events:
      # 'click li.newsitems-link a': 'show_newsitems'
      'click li.cities-link a': 'show_cities'

    initialize: (item) ->
      # so far I think I have no model for this view.
      #
      # @model = item.model
      _.bindAll @, 'show_cities' # , 'show_newsitems'

    show_cities: (item) ->
      @deactivate_all()
      $(item.currentTarget).addClass('active')
      U.views.cities.index = new Views.Cities.Index()
      U.models.cities.fetch
        success: ->
          MyApp.right_region.show U.views.cities.index
        
    # show_newsitems: (item) ->
    #   @deactivate_all()
    #   $(item.currentTarget).addClass('active')
    #   U.models.newsitems.fetch
    #     success: ->
    #       MyApp.right_region.show( U.views.newsitems )

    deactivate_all: (item) ->
      while $(".right-menu ul li a.active").length > 0
        _.each $(".right-menu ul li a.active"), (key, value) ->
          item = $(".right-menu ul li a.active").eq(value)
          item.removeClass('active')
<commit_msg>link to view cities index should work now.<commit_after>$(document).ready ->

  # Views.City.Galleries = Backbone.View.extend      

  Views.Cities.LeftMenu = Backbone.Marionette.ItemView.extend
    template: '#left_menu-template'
    # model: Models.City

    events:
      'click .map-link a': 'show_map'
      'click .calendar-link a': 'show_calendar'
      'click .cities-link a': 'show_cities'

    initialize: (item) ->
      @model = item.model
      _.bindAll @, 'deactivate_all', 'show_map', 'show_calendar', 'show_cities'

    show_map: (item) ->
      console.log( 'showing cities map' )
      @deactivate_all()
      $(item.currentTarget).addClass('active')
      U.models.cities.fetch
        success: ->
          MyApp.left_region.show new Views.Cities.Map
            model: U.models.cities

    show_calendar: (item) ->
      @deactivate_all()
      $(item.currentTarget).addClass('active')
      U.models.city.fetch
        success: ->
          MyApp.left_region.show new Views.Cities.Calendar
            model: U.models.city

    show_cities: (item) ->
      @deactivate_all()
      $(item.currentTarget).addClass('active')
      U.views.cities.index = new Views.Cities.Index()
      U.models.cities.fetch
        success: ->
          MyApp.left_region.show( U.views.cities.index )
      
    deactivate_all: (item) ->
      while $(".left-menu ul li a.active").length > 0
        _.each $(".left-menu ul li a.active"), (key, value) ->
          item = $(".left-menu ul li a.active").eq(value)
          item.removeClass('active')


  Views.Cities.RightMenu = Backbone.Marionette.ItemView.extend
    template: '#cities_right_menu-template'
    # I think this is unnecessary if I set the @model in the initializer?
    # model: Models.City
    events:
      # 'click li.newsitems-link a': 'show_newsitems'
      'click li.cities-link a': 'show_cities'

    initialize: (item) ->
      # so far I think I have no model for this view.
      #
      # @model = item.model
      _.bindAll @, 'show_cities' # , 'show_newsitems'

    show_cities: (item) ->
      @deactivate_all()
      $(item.currentTarget).addClass('active')
      U.views.cities.index = new Views.Cities.Index()
      U.models.cities.fetch
        success: ->
          MyApp.right_region.show U.views.cities.index
        
    # show_newsitems: (item) ->
    #   @deactivate_all()
    #   $(item.currentTarget).addClass('active')
    #   U.models.newsitems.fetch
    #     success: ->
    #       MyApp.right_region.show( U.views.newsitems )

    deactivate_all: (item) ->
      while $(".right-menu ul li a.active").length > 0
        _.each $(".right-menu ul li a.active"), (key, value) ->
          item = $(".right-menu ul li a.active").eq(value)
          item.removeClass('active')

{'fraction_non_alphanumeric': 0.14327538883806037, 'fraction_numerical': 0.0007319304666056725, 'mean_word_length': 2.3329268292682928, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 41, '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': '1554786', 'n_tokens_mistral': 1796, 'n_tokens_neox': 1764, 'n_words': 354}