<commit_before>window.InstrumentListView = Backbone.View.extend({

    initialize: function () {
        
    },

    render: function () {
        var instruments = this.model.models;
        var len = instruments.length;
        console.log("Instrument list: " + len + " instruments");
        var items = parseInt(settings.get('itemsperpage'));
        var startPos = (this.options.page - 1) * items;
        var endPos = Math.min(startPos + items, len);

        $(this.el).html('<ul class="thumbnails"></ul>');

        for (var i = startPos; i < endPos; i++) {
            $('.thumbnails', this.el).append(new InstrumentListItemView({model: instruments[i]}).render().el);
        }

        $(this.el).append(new Paginator({model: this.model, page: this.options.page, items: items}).render().el);

        return this;
    }
});

window.InstrumentListItemView = Backbone.View.extend({

    tagName: "li",

    initialize: function () {
        this.model.bind("change", this.render, this);
        this.model.bind("destroy", this.close, this);
    },

    render: function () {
        $(this.el).html(this.template(this.model.toJSON()));
        return this;
    },
    
    events: {
        "click .select" : "selectInstrument",
        "click .edit": "editInstrument"
    },
    
    editInstrument: function(event) {
        var url = event.target.href.substr(event.target.baseURI.length);
        app.navigate(url, {trigger: true});
        event.stopPropagation();
    },

    selectInstrument: function(event) {
        console.log('Instrument selected: ' + this.model.id);
        var theID = this.model.id;
        // Now store the instrument ID in our settings:
        this.options.settings.set({currentInstrument:theID});
        // Update our settings to use the correct port: 
        this.options.settings.set({ serialPort: this.model.get('port')});
        this.options.settings.save(null, {success: function() {
            app.navigate('/', true);
        }});
        return false;
    },
    

});<commit_msg>Bugfix: forgot one reference in instrumentlist.js<commit_after>window.InstrumentListView = Backbone.View.extend({

    initialize: function () {
        
    },

    render: function () {
        var instruments = this.model.models;
        var len = instruments.length;
        console.log("Instrument list: " + len + " instruments");
        var items = parseInt(settings.get('itemsperpage'));
        var startPos = (this.options.page - 1) * items;
        var endPos = Math.min(startPos + items, len);

        $(this.el).html('<ul class="thumbnails"></ul>');

        for (var i = startPos; i < endPos; i++) {
            $('.thumbnails', this.el).append(new InstrumentListItemView({model: instruments[i]}).render().el);
        }

        $(this.el).append(new Paginator({model: this.model, page: this.options.page, items: items}).render().el);

        return this;
    }
});

window.InstrumentListItemView = Backbone.View.extend({

    tagName: "li",

    initialize: function () {
        this.model.bind("change", this.render, this);
        this.model.bind("destroy", this.close, this);
    },

    render: function () {
        $(this.el).html(this.template(this.model.toJSON()));
        return this;
    },
    
    events: {
        "click .select" : "selectInstrument",
        "click .edit": "editInstrument"
    },
    
    editInstrument: function(event) {
        var url = event.target.href.substr(event.target.baseURI.length);
        app.navigate(url, {trigger: true});
        event.stopPropagation();
    },

    selectInstrument: function(event) {
        console.log('Instrument selected: ' + this.model.id);
        var theID = this.model.id;
        // Now store the instrument ID in our settings:
        settings.set({currentInstrument:theID});
        // Update our settings to use the correct port: 
        settings.set({ serialPort: this.model.get('port')});
        settings.save(null, {success: function() {
            app.navigate('/', true);
        }});
        return false;
    },
    

});
{'fraction_non_alphanumeric': 0.15630376013762595, 'fraction_numerical': 0.0004915212582944212, 'mean_word_length': 2.4404057480980557, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 7, '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': '2762339', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1182, 'n_words': 243}