<commit_before>﻿define(
	['app', 'common',
		'webapp/scripts/subscriptions-model',
		'webapp/scripts/subscriptions-view'],
	function (application, commonModule, models, views) {

		application.module('Scripts.Subscriptions', function (module, app, backbone, marionette, $, _) {

			var layoutView;

			var api = {

				addSubscription: function () {

					var eventAlias = this.model.get('selectedEventAlias');
					var scriptId = this.model.get('selectedScriptId');

					models.addSubscription(eventAlias, scriptId).done(api.reloadList);
				},

				deleteSubscription: function (childView) {

					var eventAlias = childView.model.get('eventAlias');
					var scriptName = childView.model.get('scriptName');

					if (commonModule.utils.confirm('Delete the subscription?\n- event: "{0}"\n- script: "{1}"', eventAlias, scriptName)) {

						var subscriptionId = childView.model.get('id');
						models.deleteSubscription(subscriptionId).done(api.reloadList);
					}
				},

				reloadList: function () {

					models.loadSubscriptions()
						.done(function (list) {

							var view = new views.SubscriptionListView({ collection: list });
							view.on('childview:scripts:subscription:delete', api.deleteSubscription);
							layoutView.regionList.show(view);
						});
				},

				reloadForm: function () {

					models.loadFormData()
						.done(function (formData) {

							var form = new views.SubscriptionFormView({ model: formData });
							form.on('scripts:subscription:add', api.addSubscription);
							layoutView.regionForm.show(form);
						});
				}
			};

			module.start = function () {

				// init layout
				layoutView = new views.SubscriptionLayout();
				app.setContentView(layoutView);

				api.reloadForm();
				api.reloadList();
			};

		});

		return application.Scripts.Subscriptions;
	});<commit_msg>- переписан модуль subscription list (main) без использования модулей marionette.js;<commit_after>﻿define(
	['app', 'common',
		'webapp/scripts/subscriptions-model',
		'webapp/scripts/subscriptions-view'],
	function (application, common, models, views) {

		var layoutView;

		var api = {

			addSubscription: function () {

				var eventAlias = this.model.get('selectedEventAlias');
				var scriptId = this.model.get('selectedScriptId');

				models.addSubscription(eventAlias, scriptId).done(api.reloadList);
			},

			deleteSubscription: function (childView) {

				var eventAlias = childView.model.get('eventAlias');
				var scriptName = childView.model.get('scriptName');

				if (common.utils.confirm('Delete the subscription?\n- event: "{0}"\n- script: "{1}"', eventAlias, scriptName)) {

					var subscriptionId = childView.model.get('id');
					models.deleteSubscription(subscriptionId).done(api.reloadList);
				}
			},

			reloadList: function () {

				models.loadSubscriptions()
					.done(function (list) {

						var view = new views.SubscriptionListView({ collection: list });
						view.on('childview:scripts:subscription:delete', api.deleteSubscription);
						layoutView.regionList.show(view);
					});
			},

			reloadForm: function () {

				models.loadFormData()
					.done(function (formData) {

						var form = new views.SubscriptionFormView({ model: formData });
						form.on('scripts:subscription:add', api.addSubscription);
						layoutView.regionForm.show(form);
					});
			}
		};

		return {
			start: function () {

				// init layout
				layoutView = new views.SubscriptionLayout();
				application.setContentView(layoutView);

				api.reloadForm();
				api.reloadList();
			}
		};
	});
{'fraction_non_alphanumeric': 0.14338028169014083, 'fraction_numerical': 0.0011267605633802818, 'mean_word_length': 3.5525641025641024, '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': '2556281', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1044, 'n_words': 188}