<commit_before>define([

  'Backbone',

  //Collection
  'app/collections/tasks',

  //Template
  'text!templates/project-page/taskItemTemplate.html',
], function(

  Backbone,

  //Collection
  Tasks,

  //Template
  itemTemplate
){

  var TaskController = Backbone.View.extend({

    template: _.template(itemTemplate),

    initialize: function(){
      this.collection =  new Tasks(this.options.projectId);
      this.collection.bind('reset', this.render, this);
      this.collection.bind('search', this.searchResult, this);
    },

    searchResult: function(result){
      this.$el.html('');

      var template = this.template;
      var $list    = this.$el;
      var title;

      _.each(result, function(model){
        title = model.get('title');

        if(title){
          $list.append(template({title: model.get('title')}));
        }
      });
    },

    render: function(){
      this.$el.html('');

      var template = this.template;
      var $list    = this.$el;

      _.each(this.collection.models, function(model){
        $list.append(template({title: model.get('title')}));
      });
    }
  });

  return TaskController;

});<commit_msg>Extend task list to a nested view<commit_after>define([

  'Backbone',

  //Collection
  'app/collections/tasks',

  //View
  'app/views/taskItemView',

  //Template
  'text!templates/project-page/taskItemTemplate.html',
], function(

  Backbone,

  //Collection
  Tasks,

  //View
  taskItemView,

  //Template
  itemTemplate
){

  var TaskController = Backbone.View.extend({

    template: _.template(itemTemplate),

    initialize: function(){
      this.collection =  new Tasks(this.options.projectId);
      this.collection.bind('reset', this.render, this);
      this.collection.bind('search', this.searchResult, this);
    },

    searchResult: function(result){
      this.$el.html('');

      var template = this.template;
      var $list    = this.$el;
      var title;

      _.each(result, function(model){
        title = model.get('title');

        if(title){
          $list.append(template({title: model.get('title')}));
        }
      });
    },

    render: function(){
      this.$el.html('');

      var template = this.template;
      var $list    = this.$el;
      var task;

      _.each(this.collection.models, function(model){
        task = new taskItemView({ model: model });
        $list.append(task.el);
      });
    }
  });

  return TaskController;

});
{'fraction_non_alphanumeric': 0.15926680244399186, 'fraction_numerical': 0.0, 'mean_word_length': 2.513590844062947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1879431', 'n_tokens_mistral': 773, 'n_tokens_neox': 734, 'n_words': 138}