<commit_before>@VideoTracker.module "MoviesApp.List", (List, App, Backbone, Marionette, $, _) ->

  class List.Layout extends Marionette.LayoutView
    template: 'movies/list/templates/list_layout'
    regions: 
      "panelRegion"  : "#panel-region"
      "moviesRegion" : "#movies-region"

  class List.PanelView extends Marionette.ItemView
    template: 'movies/list/templates/_panel'

  class List.MovieView  extends Marionette.ItemView
    initialize: ->
      if this.model.get('watched') is true
        this.$el.addClass('watched')
    template: 'movies/list/templates/_movie'
    tagName: 'tr'
    events: 
      'click' : 'toggleWatched'
      'mouseenter' : 'showOverlay'
      'mouseleave' : 'hideOverlay'

    # getTemplate: ->
    #   if this.model.get('watched') is true
    #     return "movies/list/templates/_movie"
    #   else
    #     return "movies/list/templates/_watched"


    toggleWatched: -> 
      this.$el.toggleClass('watched');
      if this.model.get('watched') is true
        this.model.set(watched: false).save()
      else
        this.model.set(watched: true).save()

    showOverlay: ->
      # this.$el.find('.main').toggleClass('no-display')
      this.$el.find('.overlay').toggleClass('no-display')


    hideOverlay: ->
      this.$el.find('.overlay').toggleClass('no-display')
      # this.$el.find('.main').toggleClass('no-display')
      # this.$el.find('.overlay').toggleClass('no-display')

  class List.MovieCollectionView extends Marionette.CompositeView
    template: 'movies/list/templates/_movies'
    childView: List.MovieView
    childViewContainer: 'tbody'<commit_msg>Updates queued attribute when button is clicked<commit_after>@VideoTracker.module "MoviesApp.List", (List, App, Backbone, Marionette, $, _) ->

  class List.Layout extends Marionette.LayoutView
    template: 'movies/list/templates/list_layout'
    regions: 
      "panelRegion"  : "#panel-region"
      "moviesRegion" : "#movies-region"

  class List.PanelView extends Marionette.ItemView
    template: 'movies/list/templates/_panel'

  class List.MovieView  extends Marionette.ItemView
    initialize: ->
      if this.model.get('watched') is true
        this.$el.addClass('watched')
    template: 'movies/list/templates/_movie'
    tagName: 'tr'
    events: 
      'click .watched-btn' : 'toggleWatched'
      'click .queued-btn' : 'toggleQueued'
      'mouseenter' : 'showOverlay'
      'mouseleave' : 'hideOverlay'

    # getTemplate: ->
    #   if this.model.get('watched') is true
    #     return "movies/list/templates/_movie"
    #   else
    #     return "movies/list/templates/_watched"


    toggleWatched: -> 
      this.$el.toggleClass('watched');
      if this.model.get('watched') is true
        this.model.set(watched: false).save()
      else
        this.model.set(watched: true).save()
        
    toggleQueued: ->
      if this.model.get('queued') is true
        this.model.set(queued: false).save()
      else
        this.model.set(queued: true).save()


    showOverlay: ->
      this.$el.find('.overlay').fadeIn(500)


    hideOverlay: ->
      this.$el.find('.overlay').fadeOut(500)

  class List.MovieCollectionView extends Marionette.CompositeView
    template: 'movies/list/templates/_movies'
    childView: List.MovieView
    childViewContainer: 'tbody'
{'fraction_non_alphanumeric': 0.14100241545893719, 'fraction_numerical': 0.0018115942028985507, 'mean_word_length': 2.9771908763505404, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, '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': '829673', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1031, 'n_words': 180}