<commit_before>define(['override', 'vein', 'utils'], function(override, vein, utils) {
    "use strict";
    
    return function(grid, pluginOptions) {
        override(grid, function($super) {
            var subViewHeights = [];
            var subviewsExpanded = {};
            return {
                init: function() {
                    $super.init();
                    
                    this.container.on("click", ".pg-subview-toggle", function(event) {
                        var row = $(this).parents(".pg-row").first(),
                            rowId = row.attr("data-row-id"),
                            rowIdx = parseInt(row.attr("data-row-idx"));

                        if(!subviewsExpanded[rowId]) {
                            grid.subviews.expandView(grid.dataSource.getRecordById(rowId), rowIdx);
                        } else {
                            grid.subviews.collapseView(grid.dataSource.getRecordById(rowId), rowIdx);
                        }

                        event.stopPropagation();
                        event.preventDefault();
                    });
                },
                findRow: function(rowId) {
                    return $super.findRow(rowId).find('.pg-inner-row');
                },

                subviews: {
                    autoExpand: function(filter) {
                        for (var i = 0, j=grid.dataSource.data.length; i < j; i++) {
                            var row = grid.dataSource.data[i];
                            if (filter.apply(this, [row.id, grid.dataSource])) {
                                this.expandView(row, i);
                            }
                        }
                    },
                    expandView: function(record, rowIdx) {
                        var group = grid.getRowGroupFor(rowIdx);
                        if(!subviewsExpanded[record.id]) {
                            subviewsExpanded[record.id] = true;
                            grid.afterRenderRow(record, rowIdx, group.all.children("[data-row-id='" + record.id + "']"));
                            group.all.find('.pg-subview-toggle').addClass('pg-subview-expanded');
                        }
                    },

                    collapseView: function(record, rowIdx) {
                        var group = grid.getRowGroupFor(rowIdx);
                        if(subviewsExpanded[record.id]) {
                            subviewsExpanded[record.id] = false;
                            group.all.children("[data-row-id='" + record.id + "']").css("height", grid.rowHeight(rowIdx) + "px");
                            group.all.find('.pg-subview-toggle').removeClass('pg-subview-expanded');
                        }<commit_msg>http://jira.pearlchain.net/browse/PRL-2650 CPQ Version tab: when you try to make another version the main version, the old version is not unflagged as main version<commit_after>define(['override', 'vein', 'utils'], function(override, vein, utils) {
    "use strict";
    
    return function(grid, pluginOptions) {
        override(grid, function($super) {
            var subViewHeights = [];
            var subviewsExpanded = {};
            return {
                init: function() {
                    $super.init();
                    
                    this.container.on("click", ".pg-subview-toggle", function(event) {
                        var row = $(this).parents(".pg-row").first(),
                            rowId = row.attr("data-row-id"),
                            rowIdx = parseInt(row.attr("data-row-idx"));

                        if(!subviewsExpanded[rowId]) {
                            grid.subviews.expandView(grid.dataSource.getRecordById(rowId), rowIdx);
                        } else {
                            grid.subviews.collapseView(grid.dataSource.getRecordById(rowId), rowIdx);
                        }

                        event.stopPropagation();
                        event.preventDefault();
                    });
                },
                findRow: function(rowId) {
                    var row = $super.findRow(rowId);
                    var innerRow = row.find('.pg-inner-row');
                    return innerRow.length == 0 ? row : innerRow;
                },

                subviews: {
                    autoExpand: function(filter) {
                        for (var i = 0, j=grid.dataSource.data.length; i < j; i++) {
                            var row = grid.dataSource.data[i];
                            if (filter.apply(this, [row.id, grid.dataSource])) {
                                this.expandView(row, i);
                            }
                        }
                    },
                    expandView: function(record, rowIdx) {
                        var group = grid.getRowGroupFor(rowIdx);
                        if(!subviewsExpanded[record.id]) {
                            subviewsExpanded[record.id] = true;
                            grid.afterRenderRow(record, rowIdx, group.all.children("[data-row-id='" + record.id + "']"));
                            group.all.find('.pg-subview-toggle').addClass('pg-subview-expanded');
                        }
                    },

                    collapseView: function(record, rowIdx) {
                        var group = grid.getRowGroupFor(rowIdx);
                        if(subviewsExpanded[record.id]) {
                            subviewsExpanded[record.id] = false;
                            group.all.children("[data-row-id='" + record.id + "']").css("height", grid.rowHeight(rowIdx) + "px");
                            group.all.find('.pg-subview-toggle').removeClass('pg-subview-expanded');
                        }
{'fraction_non_alphanumeric': 0.12332579579057228, 'fraction_numerical': 0.001217603061401983, 'mean_word_length': 1.1608417888012026, 'pattern_counts': {'":': 0, '<': 5, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6312853', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1378, 'n_words': 215}