require(['jquery', 'project-init/validate', 'app'], function ($, validate, app) {

    var form = $("[data-project-init-form]");
    var projectRef = app.firebase.child("web/data/projects");
    var defaultMessage = 'This field cannot be left blank';

	form.on('submit', function (evt) {
		evt.preventDefault();

		var validation = validate(form);

		form.find('.has-error').removeClass('has-error');
		form.find('.glyphicon-remove').removeClass('glyphicon-remove');
		form.find('[data-feedback-text]').html('');

		validation.fail(function (data) {
			$.each(data.failures, function (index, el) {
				var formGroup = el.closest('.form-group');
				formGroup.addClass('has-error');
				formGroup.find('[data-validation-feedback]').addClass('glyphicon-remove');
				formGroup.find('[data-feedback-text]').html(el.data('invalidMessage') || defaultMessage);
			})
		});

		validation.done(function (data) {
			var p = {
			    name: form.find("[name=projectName]").val(),
			    description: form.find("[name=projectDescription]").val(),
			    location: {
			    	latitude: form.find("[name=projectLatitude]").val(),
			    	longitude: form.find("[name=projectLongitude]").val()
			    }
			};



		    projectRef.push(p);
		});
	});
});

@@ -1190,16 +1190,80 @@
 %7D;%0A%0A
-%0A%0A%09%09    
+%09%09%09if (app && app.authData) %7B%0A%09%09%09%09p.user_id = app.authData.uid;%0A%09%09%09%7D%0A%09%09%09
 proj

store auth user id.