<commit_before>﻿function WebmailViewModel() {
	// Data
	var self = this;
	self.folders = ['Inbox', 'Archive', 'Sent', 'Spam'];
	self.chosenFolderId = ko.observable();
	self.chosenFolderData = ko.observable();
	self.chosenMailData = ko.observable();

	// Behaviours    
	self.goToFolder = function (folder) {
		Navigation.StateController.navigate('webMail', { folder: folder });
	};
	self.goToMail = function (mail) {
		Navigation.StateController.navigate('select', { folder: Navigation.StateContext.data.folder, mailId: '1' });
	};

	var folderState = Navigation.StateInfoConfig.dialogs.webMail.states.folder;
	var mailState = Navigation.StateInfoConfig.dialogs.webMail.states.mail;

	folderState.navigated = function () {
		self.chosenFolderId(Navigation.StateContext.data.folder);
		self.chosenFolderData({ mails: [{ from: '', to: '', subject: 'test', date: '' }] });
	};
	folderState.ended = function () { self.chosenFolderData(null); };

	mailState.navigated = function () { self.chosenFolderId(Navigation.StateContext.data.folder); };
	mailState.ended = function () { self.chosenMailData(null); };
};

Navigation.StateInfoConfig.build([
	{ key: 'webMail', initial: 'folder', states: [
		{ key: 'folder', route: '{folder}', defaults: {folder: 'Inbox'}, trackCrumbTrail: false, transitions: [
			{ key: 'select', to: 'mail' }]},
		{ key: 'mail', route: '{folder}/{mailId}', defaults: { folder: 'Inbox' } }]}
]);

ko.applyBindings(new WebmailViewModel());

Navigation.StateController.navigateLink(Navigation.router.getData(window.location.hash).state, window.location.hash);<commit_msg>Added id to pass during navigation and some populated dummy mail data on navigated<commit_after>﻿function WebmailViewModel() {
	// Data
	var self = this;
	self.folders = ['Inbox', 'Archive', 'Sent', 'Spam'];
	self.chosenFolderId = ko.observable();
	self.chosenFolderData = ko.observable();
	self.chosenMailData = ko.observable();

	// Behaviours    
	self.goToFolder = function (folder) {
		Navigation.StateController.navigate('webMail', { folder: folder });
	};
	self.goToMail = function (mail) {
		Navigation.StateController.navigate('select', { folder: Navigation.StateContext.data.folder, mailId: mail.id });
	};

	var folderState = Navigation.StateInfoConfig.dialogs.webMail.states.folder;
	var mailState = Navigation.StateInfoConfig.dialogs.webMail.states.mail;

	folderState.navigated = function () {
		self.chosenFolderId(Navigation.StateContext.data.folder);
		self.chosenFolderData({ mails: [{ from: '', to: '', subject: 'test', date: '', id: '1' }] });
	};
	folderState.ended = function () { self.chosenFolderData(null); };

	mailState.navigated = function () {
		self.chosenFolderId(Navigation.StateContext.data.folder);
		self.chosenMailData({ from: '', to: '', subject: 'test', date: '', id: '1' });
	};
	mailState.ended = function () { self.chosenMailData(null); };
};

Navigation.StateInfoConfig.build([
	{ key: 'webMail', initial: 'folder', states: [
		{ key: 'folder', route: '{folder}', defaults: {folder: 'Inbox'}, trackCrumbTrail: false, transitions: [
			{ key: 'select', to: 'mail' }]},
		{ key: 'mail', route: '{folder}/{mailId}', defaults: { folder: 'Inbox' } }]}
]);

ko.applyBindings(new WebmailViewModel());

Navigation.StateController.navigateLink(Navigation.router.getData(window.location.hash).state, window.location.hash);
{'fraction_non_alphanumeric': 0.17474566128067026, 'fraction_numerical': 0.0008976660682226212, 'mean_word_length': 5.3919694072657744, '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': '2118688', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1068, 'n_words': 198}