<commit_before>define(["app", "backbone", "courses/views/SearchView", "courses/views/BookingsView", "courses/views/CoursesView", "courses/views/CourseView", "courses/collections/CourseCollection", "backbone.subroute"], 
 function(app, Backbone, SearchView, BookingsView, CoursesView, CourseView, Courses){
    var CoursesRouter = Backbone.SubRoute.extend({

        routes: {
            "": "search",
            "bookings": "bookings",
            "detail/:id": "course",
            ":query": "courses"
        },

        search: function(params) {
            app.showView(new SearchView({
                collection: new Courses(),
                params: params
            }));
        },

        bookings: function(params) {
            app.showView(new BookingsView({
                params: params
            }));
        },

        courses: function(query, params) {
            app.showView(new CoursesView({
                params: params,
                query: query
            }));
        },

        course: function(id, params) {
            app.showView(new CourseView({
                params: params,
                id: id
            }));
        }

    });

    return CoursesRouter;
});
<commit_msg>Generic back button in the courses app<commit_after>define(["app", "backbone", "courses/views/SearchView", "courses/views/BookingsView", "courses/views/CoursesView", "courses/views/CourseView", "courses/collections/CourseCollection", "backbone.subroute"], 
 function(app, Backbone, SearchView, BookingsView, CoursesView, CourseView, Courses){
    var CoursesRouter = Backbone.SubRoute.extend({

        routes: {
            "": "search",
            "bookings": "bookings",
            "detail/:id": "course",
            ":query": "courses"
        },

        search: function(params) {
            app.showView(new SearchView({
                collection: new Courses(),
                params: params
            }));
        },

        bookings: function(params) {
            app.showView(new BookingsView({
                params: params
            }), {back: true});
        },

        courses: function(query, params) {
            app.showView(new CoursesView({
                params: params,
                query: query
            }), {back: true});
        },

        course: function(id, params) {
            app.showView(new CourseView({
                params: params,
                id: id
            }), {back: true});
        }

    });

    return CoursesRouter;
});

{'fraction_non_alphanumeric': 0.13217253660466957, 'fraction_numerical': 0.0, 'mean_word_length': 1.744842562432139, 'pattern_counts': {'":': 10, '<': 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': '75294', 'n_tokens_mistral': 696, 'n_tokens_neox': 672, 'n_words': 134}