<commit_before>jsio('from common.javascript import Class')
jsio('import tasks.panels.Panel')
jsio('import browser.xhr');

exports = Class(tasks.panels.Panel, function(supr) {
	
	this._className += ' ItemPanel'
	this._width = null // dynamic
	this._left = 420
	this._templates = {}
	
	this._createContent = function() {
		supr(this, '_createContent')
		this.hide()
	}
	
	this._onWindowResize = function(winSize) {
		var leftPadding = 10,
			rightPadding = 250
		this._width = winSize.width - this._left - leftPadding - rightPadding
		supr(this, '_onWindowResize', arguments)
	}
	
	this.setItem = function(itemId) {
		this.show()
		this._item = fin.getItem(itemId)
		this._item.addDependant('type', bind(this, '_onItemType'))
	}
	
	this._onItemType = function(type) {
		this._loadTemplate(type, bind(this, function(template) {
			console.log("HERE", template)
			this._content.innerHTML = ''
			this._content.appendChild(fin.applyTemplate(template, this._item))
		}))
	}
	
	this._loadTemplate = function(itemType, callback) {
		if (this._templates[itemType]) { 
			callback(itemType)
			return
		}
		browser.xhr.get('./Tasks/templates/' + itemType + '.html', bind(this, function(template) {
			this._templates[itemType] = template
			callback(template)
		}))
	}
})<commit_msg>Make tasks render! Changing the user owner automatically update task lists! Woot!<commit_after>jsio('from common.javascript import Class')
jsio('import tasks.panels.Panel')
jsio('import browser.xhr');

exports = Class(tasks.panels.Panel, function(supr) {
	
	this._className += ' ItemPanel'
	this._width = null // dynamic
	this._left = 420
	this._templates = {}
	
	this._createContent = function() {
		supr(this, '_createContent')
		this.hide()
	}
	
	this._onWindowResize = function(winSize) {
		var leftPadding = 10,
			rightPadding = 250
		this._width = winSize.width - this._left - leftPadding - rightPadding
		supr(this, '_onWindowResize', arguments)
	}
	
	this.setItem = function(itemId) {
		this.show()
		this._item = fin.getItem(itemId)
		this._item.addDependant('type', bind(this, '_onItemType'))
	}
	
	this._onItemType = function(type) {
		this._loadTemplate(type, bind(this, function(template) {
			this._content.innerHTML = ''
			this._content.appendChild(fin.applyTemplate(template, this._item.getId()))
		}))
	}
	
	this._loadTemplate = function(itemType, callback) {
		if (this._templates[itemType]) { 
			callback(itemType)
			return
		}
		browser.xhr.get('templates/' + itemType + '.html', bind(this, function(template) {
			this._templates[itemType] = template
			callback(template)
		}))
	}
})
{'fraction_non_alphanumeric': 0.14518002322880372, 'fraction_numerical': 0.006194347657762292, 'mean_word_length': 4.338842975206612, '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': '1853170', 'n_tokens_mistral': 931, 'n_tokens_neox': 839, 'n_words': 153}