<commit_before>(function() {

	"use strict";

	var pageFactory = modules.PoeticRivals.factories.page,
		viewModelFactory = modules.PoeticRivals.factories.viewModel,
		utils = modules.Utils,
		once = utils.once,
		debounce = utils.debounce;

	pageFactory.UserPoemCommentaries = function() {

		var page = this;

		pageFactory.FromPageData.call(page);

		var jqButtonsTemplate = once(function() {
			return $("#" + page.jqButtonsTemplateId).children().clone();
		});

		var setEventListeners = function() {
			var clickableCommentaryIndexPage = new pageFactory.ClickableIndex(page.indexId, page.jqTemplateClassName, page.indexApiUrl, page.excludedIds, page.indexPageNewModelCallback, page.clickId, page.indexPageAfterModelRender);
			clickableCommentaryIndexPage.setEventListeners();
		}

		var indexPageAfterModelRender = function(model) {
			if (model.can_edit) {
				model.updateJqButtonsTemplate();
				model.renderButtons();
			}
		}

		var indexPageNewModelCallback = function(modelJSON, indexId, jqTemplate) {
			var indexableIndexableCommentary = new viewModelFactory.IndexableCommentary(modelJSON, indexId, jqTemplate, page.jqButtonsTemplate().clone());
			return indexableIndexableCommentary;
		}

		page.setEventListeners = setEventListeners;
		page.indexId = 'commentaries_index';
		page.jqTemplateClassName = 'indexable-commentary-template';
		page.indexApiUrl = '/users/' + page.userId + '/poems/' + page.poemId + '/commentaries';
		page.indexPageNewModelCallback = indexPageNewModelCallback;
		page.jqButtonsTemplateId = "indexable_commentary_edit_and_delete_buttons_template";
		page.clickId = "more_comments";
		page.jqButtonsTemplate = jqButtonsTemplate;
		page.indexPageAfterModelRender = indexPageAfterModelRender;

	}

})();<commit_msg>modified page.UserPoemCommentary#setEventListeners to create a SubmitCommentary page and set its event listeners<commit_after>(function() {

	"use strict";

	var pageFactory = modules.PoeticRivals.factories.page,
		viewModelFactory = modules.PoeticRivals.factories.viewModel,
		utils = modules.Utils,
		once = utils.once,
		debounce = utils.debounce;

	pageFactory.UserPoemCommentaries = function() {

		var page = this;

		pageFactory.FromPageData.call(page);

		var jqButtonsTemplate = once(function() {
			return $("#" + page.jqButtonsTemplateId).children().clone();
		});

		var setEventListeners = function() {
			var clickableCommentaryIndexPage = new pageFactory.ClickableIndex(page.indexId, page.jqTemplateClassName, page.indexApiUrl, page.excludedIds, page.indexPageNewModelCallback, page.clickId, page.indexPageAfterModelRender),
			submitCommentaryFormPage = new pageFactory.SubmitCommentaryForm(page.indexId, page.jqTemplateClassName, page.submitApiUrl, page.indexPageNewModelCallback, page.formId, page.indexPageAfterModelRender);
			clickableCommentaryIndexPage.setEventListeners();
			submitCommentaryFormPage.setEventListeners();
		}

		var indexPageAfterModelRender = function(model) {
			if (model.can_edit) {
				model.updateJqButtonsTemplate();
				model.renderButtons();
			}
		}

		var indexPageNewModelCallback = function(modelJSON, indexId, jqTemplate) {
			var indexableIndexableCommentary = new viewModelFactory.IndexableCommentary(modelJSON, indexId, jqTemplate, page.jqButtonsTemplate().clone());
			return indexableIndexableCommentary;
		}

		page.setEventListeners = setEventListeners;
		page.indexId = 'commentaries_index';
		page.jqTemplateClassName = 'indexable-commentary-template';
		page.indexApiUrl = '/users/' + page.userId + '/poems/' + page.poemId + '/commentaries';
		page.indexPageNewModelCallback = indexPageNewModelCallback;
		page.jqButtonsTemplateId = "indexable_commentary_edit_and_delete_buttons_template";
		page.clickId = "more_comments";
		page.jqButtonsTemplate = jqButtonsTemplate;
		page.indexPageAfterModelRender = indexPageAfterModelRender;
		page.formId = "new_commentary";
		page.submitApiUrl = "/commentaries";

	}

})();
{'fraction_non_alphanumeric': 0.10546378653113088, 'fraction_numerical': 0.0, 'mean_word_length': 5.857142857142857, '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': '1095755', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1186, 'n_words': 188}