<commit_before>
App.FrequencyResultListView = App.NestedView.extend({
    initialize: function (options) {
        App.debug('App.FrequencyResultListView.initialize()');
        this.resultViews = {};
        this.render();
    },
    render: function () {
        App.debug('App.FrequencyResultListView.render()');
        this.$el.html('');
        this.collection.each(function (m) {
            var view = this.getResultView(m);
            this.$el.append(view.el);
        }, this);
        this.listenTo(
            this.collection.resources
            , 'resource:complete:wordcount'
            , function () {
                if (this.collection.length < 2) {
                    return;
                }
                // add in the columnar comparison view if we have two queries
                if (this.comparisonView) {
                    this.comparisonView.remove();
                }
                this.comparisonView = new App.FrequencyResultComparisonView({
                    collection: this.collection
                });
                this.$el.append(this.comparisonView.el);
            }
        );
    },
    // Return a unique and reusable view for a ResultModel
    getResultView: function (m) {
        if (this.resultViews[m.cid]) {
            return this.resultViews[m.cid];
        }
        var view = new App.FrequencyResultView({ model: m });
        this.resultViews[m.cid] = view;
        return view;
    }
});

App.FrequencyResultView = Backbone.View.extend({
    template: _.template($('#tpl-frequency-result-view').html()),
    events: {
        'click li.action-about > a': 'clickAbout'
    },
    initialize: function (options) {
        App.debug('App.FrequencyResultView.initialize()');
        App.debug(options.model);
        this.render();
    },
    render: function () {
        App.debug('App.FrequencyResultView.render()');
        this.$el.html(this.template());
        this.hideActionMenu();
        var progress = _.template($('#tpl-progress').html())();
        this.$('.content-text').html(progress);
        // update the header
        this.$('.query-name').html(this.model.get('name'));
        this.$('.query-name').removeClass('first-query').removeClass('second-query');      
        if(this.model.get('name')==App.config.queryNames[0]){
            this.$('.query-name').addClass('first-query');
        } else {
            this.$('.query-name').addClass('second-query');
        }
        // and set up callbacks
        this.listenTo(this.model.get('results').get('wordcounts'), 'request', function () {
            App.debug('Model Request');
            this.$('.content-text').show();
            this.$('.content-viz').hide();
        });
        this.listenTo(
            this.model.get('results')<commit_msg>add option to download data CSV for single word clouds<commit_after>
App.FrequencyResultListView = App.NestedView.extend({
    initialize: function (options) {
        App.debug('App.FrequencyResultListView.initialize()');
        this.resultViews = {};
        this.render();
    },
    render: function () {
        App.debug('App.FrequencyResultListView.render()');
        this.$el.html('');
        this.collection.each(function (m) {
            var view = this.getResultView(m);
            this.$el.append(view.el);
        }, this);
        this.listenTo(
            this.collection.resources
            , 'resource:complete:wordcount'
            , function () {
                if (this.collection.length < 2) {
                    return;
                }
                // add in the columnar comparison view if we have two queries
                if (this.comparisonView) {
                    this.comparisonView.remove();
                }
                this.comparisonView = new App.FrequencyResultComparisonView({
                    collection: this.collection
                });
                this.$el.append(this.comparisonView.el);
            }
        );
    },
    // Return a unique and reusable view for a ResultModel
    getResultView: function (m) {
        if (this.resultViews[m.cid]) {
            return this.resultViews[m.cid];
        }
        var view = new App.FrequencyResultView({ model: m });
        this.resultViews[m.cid] = view;
        return view;
    }
});

App.FrequencyResultView = Backbone.View.extend({
    template: _.template($('#tpl-frequency-result-view').html()),
    events: {
        'click li.action-about > a': 'clickAbout'
    },
    initialize: function (options) {
        App.debug('App.FrequencyResultView.initialize()');
        App.debug(options.model);
        this.render();
    },
    render: function () {
        App.debug('App.FrequencyResultView.render()');
        this.$el.html(this.template());
        this.hideActionMenu();
        var progress = _.template($('#tpl-progress').html())();
        this.$('.content-text').html(progress);
        // update the header
        this.$('.query-name').html(this.model.get('name'));
        this.$('.query-name').removeClass('first-query').removeClass('second-query');      
        if(this.model.get('name')==App.config.queryNames[0]){
            this.$('.query-name').addClass('first-query');
        } else {
            this.$('.query-name').addClass('second-query');
        }
        // add in data download links
        var downloadUrls = [ this.model.get('results').get('wordcounts').csvUrl() ];
        this.addDownloadMenuItems(downloadUrls, "Download Data CSV");
        // and set up callbacks
        this.listenTo(this.model.get('results').get('wordcounts'), 'request', function () {
            App.debug('Model Request');
            this.$('.content-text').show();
            this.$('.content-viz').hide();
        });
        this.listenTo(
            this.model.get('results')
{'fraction_non_alphanumeric': 0.15568142808101612, 'fraction_numerical': 0.0006865774116031583, 'mean_word_length': 1.9503797468354431, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4013074', 'n_tokens_mistral': 1590, 'n_tokens_neox': 1545, 'n_words': 260}