<commit_before>function Post() {
	//create object instance, a parasitic subclass of Observable
	var self = Ti.UI.createView();
	var Cloud = require('ti.cloud');
	Cloud.debug = true;

	//label using localization-ready strings from <app dir>/i18n/en/strings.xml
	var label = Ti.UI.createLabel({
		color : '#000000',
		text : 'Post a Job',
		height : 'auto',
		width : 'auto'
	});

	self.add(label);

	//Add behavior for UI
	label.addEventListener('click', function(e) {
		Cloud.Users.login({
			login : 'laram5',
			password : '<PASSWORD>',
		}, function(e) {
			if (e.success) {

				Cloud.Objects.create({
					classname : 'jobs',
					fields : {
						latitude : 44.564566,
						longitude : -123.262043,
						description : 'First job!',
						expiration : new Date("06-18-2013"),
						wage : 15,
						time_estimate : 1,
						claimed : false
					}
				}, function(e) {
					if (e.success) {
						var job = e.jobs[0];
						alert('Success:\n' + 'latitude: ' + job.id + '\n' + 'longitude: ' + job.make + '\n' + 'description: ' + job.color + '\n' + 'expiration: ' + job.year + '\n' + 'wage: ' + job.wage + '\n' + 'time_estimate: ' + job.time_estimate + '\n' + 'claimed: ' + job.claimed + '\n' + 'created_at: ' + job.created_at);
					} else {
						alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e)));
					}
				});
				// Cloud.Objects.create

			} else {
				alert('Login Error:\\n' + ((e.error && e.message) || JSON.stringify(e)));
			}
		});
		// Cloud.Users.login

	});
	// label.addEventListener

	return self;
}

module.exports = Post; <commit_msg>Updates to post.js: post job form created, still need to handle case where geolocation cannot be determined<commit_after>function Post() {
	var self = Ti.UI.createView({
		layout : 'vertical'
	});
	var Cloud = require('ti.cloud');
	Cloud.debug = true;

	// Get user location
	var latitude;
	var longitude;
	var loc = Ti.Geolocation.getCurrentPosition(function(e) {
		if (e.error) {
			alert('Cannot get your current location, using default..');
			latitude = 0;
			longitude = 0;
			return;
		} else {
			alert('Success getting location');
			latitude = e.coords.latitude;
			longitude = e.coords.longitude;
			return;
		}
	});

	// Form fields:
	// Description
	var description_label = Ti.UI.createLabel({
		color : '#000000',
		text : 'Job Description',
		height : 'auto',
		width : Ti.UI.FILL
	});

	var description = Ti.UI.createTextArea({
		borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		color : '#336699',
		top : 10,
		left : 10,
		width : 250,
		height : 60
	});

	// Wage
	var wage_label = Ti.UI.createLabel({
		color : '#000000',
		text : 'Offering Wage',
		height : 'auto',
		width : Ti.UI.FILL
	});

	var wage = Ti.UI.createTextField({
		borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		color : '#336699',
		top : 10,
		left : 10,
		width : 250,
		height : 60
	});

	// Time estimate
	var estimate_label = Ti.UI.createLabel({
		color : '#000000',
		text : 'Time Estimate (hours)',
		height : 'auto',
		width : Ti.UI.FILL
	});

	var estimate = Ti.UI.createTextField({
		borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		color : '#336699',
		top : 10,
		left : 10,
		width : 250,
		height : 60
	});

	// Expiration date
	var date_label = Ti.UI.createLabel({
		color : '#000000',
		text : 'Expiration date',
		height : 'auto',
		width : Ti.UI.FILL
	});

	var picker = Ti.UI.createPicker({
		type : Ti.UI.PICKER_TYPE_DATE,
		minDate : new Date(),
		value : new Date()
	});

	picker.addEventListener('change', function(e) {
		Ti.API.info("User selected date: " + e.value.toLocaleString());
	});

	self.add(description_label);
	self.add(description);
	self.add(wage_label);
	self.add(wage);
	self.add(estimate_label);
	self.add(estimate);
	self.add(date_label);
	self.add(picker);

	var label = Ti.UI.createButton({
		color : '#000000',
		title : 'Post',
		height : 60,
		width : 300,
		padding : 10
	});

	self.add(label);
	var cancel = Ti.UI.createButton({
		color : '#000000',
		title : 'Cancel',
		height : 60,
		width : 300,
		padding : 10
	});

	self.add(cancel);

	//Add behavior for UI
	label.addEventListener('click', function(e) {
		Cloud.Objects.create({
			classname : 'jobs',
			fields : {
				coordinates : [longitude, latitude], // note: these are [long, lat]
				description : description.value,
				expiration : picker.value,
				wage : wage.value,
				time_estimate : estimate.value,
				claimed : false
			}
		}, function(e) {
			if (e.success) {
				var job = e.jobs[0];
				alert('Success:\n' + 'coordinates: ' + job.coordinates + '\n' + 'description: ' + job.description + '\n' + 'expiration: ' + job.expiration + '\n' + 'wage: ' + job.wage + '\n' + 'time_estimate: ' + job.time_estimate + '\n' + 'claimed: ' + job.claimed + '\n' + 'created_at: ' + job.created_at);
			} else {
				alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e)));
			}
		});
	});

	cancel.addEventListener('click', function(e) {
		Ti.UI.currentWindow.close();
	});

	return self;
}

module.exports = Post;
{'fraction_non_alphanumeric': 0.1746445023032245, 'fraction_numerical': 0.02723813338674144, 'mean_word_length': 3.0339256865912763, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '1331546', 'n_tokens_mistral': 2145, 'n_tokens_neox': 1781, 'n_words': 405}