<commit_before>jsio('from shared.javascript import Class, map')
jsio('import tasks.panels.Panel')
jsio('import ui.lists.List')

exports = Class(tasks.panels.Panel, function(supr) {
	
	this._className += ' LabelsPanel'
	this._width = 150
	this._left = -8
	
	this._createContent = function() {
		supr(this, '_createContent')
		
		// This can't be defined until gUser exists
		this._labelList = [{ 
			label: "My tasks", 
			view: ['SortedItemListView', { type: 'task', user: gUser }, 'priority'] 
		}, { 
		// 	label: "My projects", 
		// 	view: ['ListView', { item: gUser, property: 'projects' }]
		// }, { 
			label: "Projects", 
			view: ['SortedItemListView', { type: 'project' }, 'target_date']
		}, { 
			label: "Unassigned tasks", 
			view: ['SortedItemListView', { type: 'task', user: undefined }, 'priority']
		}, { 
			label: "All tasks", 
			view: ['SortedItemListView', { type: 'task' }, 'priority']
		}]
		
		for (var i=0, labelItem; labelItem = this._labelList[i]; i++) { // allow lookup by label
			this._labelList[labelItem.label] = labelItem
		}
		
		var list = new ui.lists.List()
		var labels = map(this._labelList, function(labelItem) { return labelItem.label })
		list.setItems(labels)
		list.subscribe('Click', bind(this, '_onClick'))
		this._content.appendChild(list.getElement())
	}
	
	this._onClick = function(labelId, element) {
		if (this._selectedElement) { this.removeClassName(this._selectedElement, 'selected') }
		this.addClassName(element, 'selected')
		this._selectedElement = element
		
		var labelItem = this._labelList[labelId]
		var view = fin.getView.apply(fin, labelItem.view)
		gListPanel.loadList(view)
	}
	
})<commit_msg>Make My Tasks list only uncompleted tasks<commit_after>jsio('from shared.javascript import Class, map')
jsio('import tasks.panels.Panel')
jsio('import ui.lists.List')

exports = Class(tasks.panels.Panel, function(supr) {
	
	this._className += ' LabelsPanel'
	this._width = 150
	this._left = -8
	
	this._createContent = function() {
		supr(this, '_createContent')
		
		// This can't be defined until gUser exists
		this._labelList = [{ 
			label: "My tasks", 
			view: ['SortedItemListView', { type: 'task', user: gUser.getId(), completed: false }, 'priority'] 
		}, { 
		// 	label: "My projects", 
		// 	view: ['ListView', { item: gUser, property: 'projects' }]
		// }, { 
			label: "Projects", 
			view: ['SortedItemListView', { type: 'project' }, 'target_date']
		}, { 
			label: "Unassigned tasks", 
			view: ['SortedItemListView', { type: 'task', user: undefined }, 'priority']
		}, { 
			label: "All tasks", 
			view: ['SortedItemListView', { type: 'task' }, 'priority']
		}]
		
		for (var i=0, labelItem; labelItem = this._labelList[i]; i++) { // allow lookup by label
			this._labelList[labelItem.label] = labelItem
		}
		
		var list = new ui.lists.List()
		var labels = map(this._labelList, function(labelItem) { return labelItem.label })
		list.setItems(labels)
		list.subscribe('Click', bind(this, '_onClick'))
		this._content.appendChild(list.getElement())
	}
	
	this._onClick = function(labelId, element) {
		if (this._selectedElement) { this.removeClassName(this._selectedElement, 'selected') }
		this.addClassName(element, 'selected')
		this._selectedElement = element
		
		var labelItem = this._labelList[labelId]
		var view = fin.getView.apply(fin, labelItem.view)
		gListPanel.loadList(view)
	}
	
})
{'fraction_non_alphanumeric': 0.16133806986382473, 'fraction_numerical': 0.002960331557134399, 'mean_word_length': 4.013353115727003, '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': '2337692', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1109, 'n_words': 250}