<commit_before><commit_msg>this is the list view.  i left it out of r114568<commit_after>$( function() {
	// view for the article list

	// instantiate the collection of articles
	var articles = new mw.pageTriage.ArticleList;

	// set the default sort order.
	articles.comparator = function( article ) {
		return -article.get( "creation_date" );
	};
	
	// overall list view
	// currently, this is the main application view.
	mw.pageTriage.ListView = Backbone.View.extend( {

		initialize: function() {

			// these events are triggered when items are added to the articles collection
			this.position = 0;
			articles.bind( 'add', this.addOne, this );
			articles.bind( 'reset', this.addAll, this );
		
			// this event is triggered when the collection finishes loading.
			articles.bind( 'all', this.render, this );

			// on init, make sure to load the contents of the collection.
			articles.fetch();
		},

		render: function() {
			this.position = 0;
			// TODO: refresh the view (show/hide the parts that aren't attached to the ListItem view)
		},

		// add a single article to the list
		addOne: function( article ) {
			// define position, for making alternating background colors.
			// this is added at the last minute, so it gets updated when the sort changes.
			if(! this.position ) {
				this.position = 0;
			}
			article.set( 'position', this.position++ );
			
			// pass in the specific article instance
			var view = new mw.pageTriage.ListItem( { model: article } );
			this.$( "#listView" ).append( view.render().el );
		},

		// add all the items in the articles collection
		addAll: function() {
			$("#listView").empty(); // remove the spinner before displaying.
			articles.each( this.addOne );
	    }

	} );

	// create an instance of the list view, which makes everything go.
	var list = new mw.pageTriage.ListView();	
} );
{'fraction_non_alphanumeric': 0.11748781808337845, 'fraction_numerical': 0.004872766648619383, 'mean_word_length': 3.0526315789473686, 'pattern_counts': {'":': 0, '<': 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': '7387940', 'n_tokens_mistral': 620, 'n_tokens_neox': 528, 'n_words': 204}