<commit_before>var sequence = undefined;

AutoForm.hooks({
	 'events-form': {
			 onSuccess: function (operation, result, template) {
				 	// TODO: Close modal

					 Materialize.toast('Event submitted successfully!', 4000);

					 Session.set("selected", result);
					 $('#congratsModal').openModal({
							dismissible: false
						});
					 GAnalytics.event("Events","create");
			 },
			 onError: function(formType, error) {
					 GAnalytics.event("Events","form_error");
					 console.error(error);
			 }
	 }
});

Template.newEvent.viewmodel({
	clearForm: function() {
		AutoForm.resetForm('events-form');
		$("#eventTitle").text('New Gather');
		sequence.resetSequence();
	}
});

Template.newEvent.onCreated(function() {
	create.call(this);
});

Template.newEvent.helpers({
	categories: function(){
		return Categories.find({});
	},
	geocodeDataSource: function(query, sync, asyncCallback) {
		geocodeDataSource(query, sync, asyncCallback);
	},
	selectedHandler: function (event, suggestion, datasetName) {
		selectedHandler(event, suggestion, datasetName);
	},
	selectedEventDoc: function() { return Events.findOne(Session.get('selected'));},
	isEdit: function() { return Session.get('isEdit') }
});

Template.autoForm.onRendered(function () {

	onRendered.call(this);

	sequence = new SequenceForm('.sequence-form-fields', '#next', 'button[type="submit"]', '#back');
<commit_msg>Fixed bug with submit button in edit event form<commit_after>var sequence = undefined;

AutoForm.hooks({
	 'events-form': {
			 onSuccess: function (operation, result, template) {
				 	// TODO: Close modal

					 Materialize.toast('Event submitted successfully!', 4000);

					 Session.set("selected", result);
					 $('#congratsModal').openModal({
							dismissible: false
						});
					 GAnalytics.event("Events","create");
			 },
			 onError: function(formType, error) {
					 GAnalytics.event("Events","form_error");
					 console.error(error);
			 }
	 }
});

Template.newEvent.viewmodel({
	clearForm: function() {
		AutoForm.resetForm('events-form');
		$("#eventTitle").text('New Gather');
		sequence.resetSequence();
	}
});

Template.newEvent.onCreated(function() {
	create.call(this);
});

Template.newEvent.helpers({
	categories: function(){
		return Categories.find({});
	},
	geocodeDataSource: function(query, sync, asyncCallback) {
		geocodeDataSource(query, sync, asyncCallback);
	},
	selectedHandler: function (event, suggestion, datasetName) {
		selectedHandler(event, suggestion, datasetName);
	},
	selectedEventDoc: function() { return Events.findOne(Session.get('selected'));},
	isEdit: function() { return Session.get('isEdit') }
});

Template.autoForm.onRendered(function () {

	if (Session.get('isEdit') === true) {
		return;
	}

	onRendered.call(this);

	sequence = new SequenceForm('.sequence-form-fields', '#next', 'button[type="submit"]', '#back');

{'fraction_non_alphanumeric': 0.1699825479930192, 'fraction_numerical': 0.002792321116928447, 'mean_word_length': 4.709163346613546, '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': '7238561', 'n_tokens_mistral': 989, 'n_tokens_neox': 846, 'n_words': 158}