<commit_before>tetra.controller.register('popin', {
	scope: 'comp_popin',
	use: ['popin'],
	
	constr: function(me, app, page, orm) {
		return {
			events: {
				model: { // events received from model
					'popin': { // model name
						
						'fetch': function(obj) {
							
							app.notify('start loading');
							
						},
						'append': function(col) {
							
							app.notify('end loading').notify('set content', {
								content : col[0].get('html')
							});
							
							page.notify("popin: success", col[0].get('html'));
						},
						'error': function(error) {
							
							app.notify('end loading').notify('show error');
							
						}
					}
				},
				
				view: {
					'popin: set content': function(data) {
						
						me.methods.setContent(data);
						
					},
					'popin: close': function() {
						
						app.notify('clear', {
							url: me.url,
							id: me.id
						});
						
					}
				},
				
				controller: { // events received from view or third party controllers
					'popin: loading': function(data) {
						app.notify('start loading');
					},
					'popin: set content': function(data) {
						me.methods.setContent(data);
						
					}
				}
			},
			
			methods: {
				init: function() {
					me.id = null;
					me.url = null;
				},
				
				setContent: function(data) {
					
					data._timestamp = (new Date()).getTime();
					
					if (data.url) { // loading popin with ajax
						
						me.url = data.url;
						me.id = null;
						orm('popin').fetch({ uriParams: { url: data.url } });
						
					} else if (data.id) { // loading popin from the dom<commit_msg>Popin close function<commit_after>tetra.controller.register('popin', {
	scope: 'comp_popin',
	use: ['popin'],
	
	constr: function(me, app, page, orm) {
		return {
			events: {
				model: { // events received from model
					'popin': { // model name
						
						'fetch': function(obj) {
							
							app.notify('start loading');
							
						},
						'append': function(col) {
							
							app.notify('end loading').notify('set content', {
								content : col[0].get('html')
							});
							
							page.notify("popin: success", col[0].get('html'));
						},
						'error': function(error) {
							
							app.notify('end loading').notify('show error');
							
						}
					}
				},
				
				view: {
					'popin: set content': function(data) {
						
						me.methods.setContent(data);
						
					},
					'popin: close': function() {
						
						app.notify('clear', {
							url: me.url,
							id: me.id
						});
						
					}
				},
				
				controller: {
					'popin: loading': function(data) {
						app.notify('start loading');
					},
					'popin: set content': function(data) {
						me.methods.setContent(data);
					},
					'popin: close': function() {
						app.notify('clear', {
							url: me.url,
							id: me.id
						});
					}
				}
			},
			
			methods: {
				init: function() {
					me.id = null;
					me.url = null;
				},
				
				setContent: function(data) {
					
					data._timestamp = (new Date()).getTime();
					
					if (data.url) { // loading popin with ajax
						
						me.url = data.url;
						me.id = null;
						orm('popin').fetch({ uriParams: { url: data.url } });
						
					} else if (data.id) { // loading popin from the dom
{'fraction_non_alphanumeric': 0.16307318554509564, 'fraction_numerical': 0.0012146978439113271, 'mean_word_length': 1.6693679092382496, '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': '2397890', 'n_tokens_mistral': 1714, 'n_tokens_neox': 1022, 'n_words': 213}