<commit_before>
// This uses require.js to structure javascript:
// http://requirejs.org/docs/api.html#define

define(function(require) {
    // Receipt verification (https://github.com/mozilla/receiptverifier)
    require('receiptverifier');

    // Installation button
    require('./install-button');

    // Write your app here.

    require('layouts/view');
    require('layouts/list');

    function formatDate(d) {
        return (d.getMonth()+1) + '/' +
            d.getDate() + '/' +
            d.getFullYear();
    }

    var list = $('.list').get(0);
    list.add({ id: 0,
               title: 'Cook yummy food',
               desc: 'COOK ALL THE THINGS',
               date: new Date() });
    list.add({ id: 1,
               title: 'Make things',
               desc: 'Make this look like that',
               date: new Date(12, 9, 5) });
    list.add({ id: 2,
               title: 'Move stuff',
               desc: 'Move this over there',
               date: new Date(12, 10, 1) });

    var detail = $('.detail').get(0);
    detail.render = function(item) {
        $('.title', this).text(item.get('title'));
        $('.desc', this).text(item.get('desc'));
        $('.date', this).text(formatDate(item.get('date')));
    };

    var edit = $('.edit').get(0);
    edit.render = function(item) {
        $('input[name=id]', this).val(item.id);
        $('input[name=title]', this).val(item.get('title'));
        $('input[name=desc]', this).val(item.get('desc'));
    };

    $('.edit button.add').click(function() {
        var el = $(this);
        var title = el.find('input[name=title]');
        var desc = el.find('input[name=desc]');
        var model = edit.model;

        if(model) {
            model.set({ title: title.val(), desc: desc.val() });
        }
        else {
            list.add({ title: title,
                       desc: desc,
                       date: new Date() });
        }

        edit.pop();
    });

    // function renderEdit(view) {
    //     var model = view.model;
    //     var el = $(this.el);
<commit_msg>fix editing<commit_after>
// This uses require.js to structure javascript:
// http://requirejs.org/docs/api.html#define

define(function(require) {
    // Receipt verification (https://github.com/mozilla/receiptverifier)
    require('receiptverifier');

    // Installation button
    require('./install-button');

    // Write your app here.

    require('layouts/view');
    require('layouts/list');

    function formatDate(d) {
        return (d.getMonth()+1) + '/' +
            d.getDate() + '/' +
            d.getFullYear();
    }

    var list = $('.list').get(0);
    list.add({ id: 0,
               title: 'Cook yummy food',
               desc: 'COOK ALL THE THINGS',
               date: new Date() });
    list.add({ id: 1,
               title: 'Make things',
               desc: 'Make this look like that',
               date: new Date(12, 9, 5) });
    list.add({ id: 2,
               title: 'Move stuff',
               desc: 'Move this over there',
               date: new Date(12, 10, 1) });

    var detail = $('.detail').get(0);
    detail.render = function(item) {
        $('.title', this).text(item.get('title'));
        $('.desc', this).text(item.get('desc'));
        $('.date', this).text(formatDate(item.get('date')));
    };

    var edit = $('.edit').get(0);
    edit.render = function(item) {
        $('input[name=id]', this).val(item.id);
        $('input[name=title]', this).val(item.get('title'));
        $('input[name=desc]', this).val(item.get('desc'));
    };

    $('.edit button.add').click(function() {
        var el = $(edit);
        var title = el.find('input[name=title]');
        var desc = el.find('input[name=desc]');
        var model = edit.model;

        if(model) {
            model.set({ title: title.val(), desc: desc.val() });
        }
        else {
            list.add({ title: title,
                       desc: desc,
                       date: new Date() });
        }

        edit.pop();
    });

    // function renderEdit(view) {
    //     var model = view.model;
    //     var el = $(this.el);

{'fraction_non_alphanumeric': 0.1900866217516843, 'fraction_numerical': 0.007699711260827719, 'mean_word_length': 1.827891156462585, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '6365608', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1257, 'n_words': 279}