<commit_before>define([
  'communicator', 
  'backbone'
],

function(Communicator, Backbone){
  return function(App){
    
    /* Functions that are called when the Router routes are matched */
    var allTopicsRoute = function(){
      /*
       * Doesn't work :(
       */
      var data = new App.Topic.Collection();

      data.fetch({

        error: function(collection, response, options){
          // TODO: add error handling
        },

        success: function(collection, response, options){
          var view = new App.Topic.CompositeView({collection: collection});
          App.mainRegion.show(view);
        }.bind(this)

      });

      console.log("All Topics");

    };
    
    var oneTopicRoute = function(id){

      var data = new App.Topic.Model(id);
        data.fetch({

          error: function(model, response, options){
            // TODO: add error handling
          },

          success: function(model, response, options){
            App.mainRegion.show(new App.Topic.ItemView({model: model}));
            console.log(model.toJSON());
          }.bind(this)

        });

      console.log("One Topic");

    };
    
    var createTopicRoute = function(){
      console.log("Create Topic");
    };
    
    /* Events listening to these routes */
    Communicator.command.setHandler("pageChange:topics", function(){
      console.log("Topics Route");
    });
    Communicator.command.setHandler("pageChange:topic:show", function(id){
      console.log("Topic Show Route: " + id);
    });
    Communicator.command.setHandler("pageChange:topic:edit", function(id){
      console.log("Topic Edit Route: " + id);
    });
    Communicator.command.setHandler("pageChange:topic:delete", function(id){
      console.log("Topic Delete Route: " + id);
    });
    Communicator.command.setHandler("pageChange:topic:newPost", function(id){
      console.log("Topic New Post Route: " + id);
    });
    
    /* API/Controller for the routes */
    return {
      showAllTopics: allTopicsRoute,
      showOneTopic: oneTopicRoute,
      createTopic: createTopicRoute
    };
   };
});<commit_msg>Adds topic create route Signed-off-by: <NAME> <<EMAIL>><commit_after>define([
  'communicator', 
  'backbone'
],

function(Communicator, Backbone){
  return function(App){
    
    /* Functions that are called when the Router routes are matched */
    var allTopicsRoute = function(){
      /*
       * Doesn't work :(
       */
      var data = new App.Topic.Collection();

      data.fetch({

        error: function(collection, response, options){
          // TODO: add error handling
        },

        success: function(collection, response, options){
          var view = new App.Topic.CompositeView({collection: collection});
          App.mainRegion.show(view);
        }.bind(this)

      });

      console.log("All Topics");

    };
    
    var oneTopicRoute = function(id){

      var data = new App.Topic.Model(id);
        data.fetch({

          error: function(model, response, options){
            // TODO: add error handling
          },

          success: function(model, response, options){
            App.mainRegion.show(new App.Topic.ItemView({model: model}));
            console.log(model.toJSON());
          }.bind(this)

        });

      console.log("One Topic");

    };
    
    var createTopicRoute = function(){
      console.log("Create Topic");
    };
    
    /* Events listening to these routes */
    Communicator.command.setHandler("pageChange:topics", function(){
      console.log("Topics Route");
    });
    Communicator.command.setHandler("pageChange:topic:create", function(){
      console.log("Topic Create Route");
    });
    Communicator.command.setHandler("pageChange:topic:show", function(id){
      console.log("Topic Show Route: " + id);
    });
    Communicator.command.setHandler("pageChange:topic:edit", function(id){
      console.log("Topic Edit Route: " + id);
    });
    Communicator.command.setHandler("pageChange:topic:delete", function(id){
      console.log("Topic Delete Route: " + id);
    });
    Communicator.command.setHandler("pageChange:topic:newPost", function(id){
      console.log("Topic New Post Route: " + id);
    });
    
    /* API/Controller for the routes */
    return {
      showAllTopics: allTopicsRoute,
      showOneTopic: oneTopicRoute,
      createTopic: createTopicRoute
    };
   };
});
{'fraction_non_alphanumeric': 0.14049024058102588, 'fraction_numerical': 0.0, 'mean_word_length': 2.5087579617834397, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '1779967', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1218, 'n_words': 261}