<commit_before>define(['jquery', 'underscore', 'backbone', 'marionette', 'app/models'], function ($, _, Backbone, Marionette, models) {
    var ToDoView = Backbone.Marionette.ItemView.extend({
        tagName: 'li',
        template: Backbone.Marionette.TemplateCache.get("#list-item"),

        ui: {
            'toggleItemDone': '.toggle-item-done',
            'deleteItem': '.delete'
        },

        events: {
            "click @ui.toggleItemDone": "toggleDoneState",
            "click @ui.deleteItem": "deleteTodo"
        },

        onRender: function() {
            if (this.model.getDone()) {
                this.ui.toggleItemDone.prop("checked", true);
                this.ui.toggleItemDone.parent().toggleClass("completed");
            }
        },

        toggleDoneState: function() {
            var isDone = this.ui.toggleItemDone.prop("checked");
            this.model.setDone(isDone);
            if (this.model.getDone()) {
                this.ui.toggleItemDone.parent().toggleClass("completed");
            } else {
                this.ui.toggleItemDone.parent().toggleClass("completed");
            }
        },

        deleteTodo: function() {
            this.model.destroy();
        }<commit_msg>change toggle to add and remove<commit_after>define(['jquery', 'underscore', 'backbone', 'marionette', 'app/models'], function ($, _, Backbone, Marionette, models) {
    var ToDoView = Backbone.Marionette.ItemView.extend({
        tagName: 'li',
        template: Backbone.Marionette.TemplateCache.get("#list-item"),

        ui: {
            'toggleItemDone': '.toggle-item-done',
            'deleteItem': '.delete'
        },

        events: {
            "click @ui.toggleItemDone": "toggleDoneState",
            "click @ui.deleteItem": "deleteTodo"
        },

        onRender: function() {
            if (this.model.getDone()) {
                this.ui.toggleItemDone.prop("checked", true);
                this.ui.toggleItemDone.parent().addClass("completed");
            }
        },

        toggleDoneState: function() {
            var isDone = this.ui.toggleItemDone.prop("checked");
            this.model.setDone(isDone);
            if (this.model.getDone()) {
                this.ui.toggleItemDone.parent().addClass("completed");
            } else {
                this.ui.toggleItemDone.parent().removeClass("completed");
            }
        },

        deleteTodo: function() {
            this.model.destroy();
        }
{'fraction_non_alphanumeric': 0.1487138263665595, 'fraction_numerical': 0.0, 'mean_word_length': 1.928235294117647, 'pattern_counts': {'":': 4, '<': 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': '5701070', 'n_tokens_mistral': 701, 'n_tokens_neox': 674, 'n_words': 103}