<commit_before>(function() {
"use strict";
/**
 * formula.js
 * Generic JSON Schema form builder
 *
 * <NAME> 2014, http://npolar.no/
 */

angular.module('formula')
	.directive('formula',
	['formulaJsonLoader', 'formulaModel', 'formulaSchema', 'formulaForm', 'formulaI18n', '$http', '$compile', '$templateCache', '$templateRequest', '$q',
	function(jsonLoader, model, Schema, Form, i18n, $http, $compile, $templateCache, $templateRequest, $q) {
		return {
			restrict: 'A',
      scope: { data: '=formula' },
			controller: ['$scope', '$attrs', '$element', function($scope, $attrs, $element) {
				var controller = this, formBuffer = { pending: false, data: null };

				if(!$scope.data) {
					$scope.data = {};
				}

				if($scope.data.model) {
					model.data = $scope.data.model;
					model.locked = true;
				}

				controller.schema	= $scope.schema = new Schema();
				controller.form  	= $scope.form = new Form();

				$scope.onsave		= $scope.form.onsave;
				$scope.template 	= $scope.data.template || 'default';
				$scope.language 	= { uri: $scope.data.language || null, code: null };

				function formBuild(formURI) {
					if(!formBuffer.pending || formURI) {
						$scope.schema.then(function(schemaData) {
							if(schemaData) {
								formBuffer.pending = false;
								controller.form = $scope.form = new Form(formURI);
								$scope.form.onsave = $scope.onsave;
								$scope.form.build(schemaData, formBuffer.data);
								$scope.form.translate($scope.language.code);
							}
						});
					}
				}

				function loadTemplate (templateId) {
					return $q(function(resolve, reject) {
						var prefix = 'formula/';<commit_msg>Fixed a bug with ui component toggling<commit_after>(function() {
"use strict";
/**
 * formula.js
 * Generic JSON Schema form builder
 *
 * <NAME> 2014, http://npolar.no/
 */

angular.module('formula')
	.directive('formula',
	['formulaJsonLoader', 'formulaModel', 'formulaSchema', 'formulaForm', 'formulaI18n', '$http', '$compile', '$templateCache', '$templateRequest', '$q',
	function(jsonLoader, model, Schema, Form, i18n, $http, $compile, $templateCache, $templateRequest, $q) {
		return {
			restrict: 'A',
      scope: { data: '=formula' },
			controller: ['$scope', '$attrs', '$element', function($scope, $attrs, $element) {
				var controller = this, formBuffer = { pending: false, data: null };

				if(!$scope.data) {
					$scope.data = {};
				}

				if($scope.data.model) {
					model.data = $scope.data.model;
					model.locked = true;
				}

				controller.schema	= $scope.schema = new Schema();
				controller.form  	= $scope.form = new Form();

				$scope.onsave		= $scope.form.onsave;
				$scope.template 	= $scope.data.template || 'default';
				$scope.language 	= { uri: $scope.data.language || null, code: null };

				function formBuild(formURI) {
					if(!formBuffer.pending || formURI) {
						$scope.schema.then(function(schemaData) {
							if(schemaData) {
								formBuffer.pending = false;
								controller.form = $scope.form = new Form(formURI);
								$scope.form.onsave = $scope.onsave;
								$scope.form.build(schemaData, formBuffer.data);
								$scope.form.translate($scope.language.code);
								$scope.form.uiSaveHidden = !!$scope.data.saveHidden;
								$scope.form.uiValidateHidden = !!$scope.data.validateHidden;
							}
						});
					}
				}

				function loadTemplate (templateId) {
					return $q(function(resolve, reject) {
						var prefix = 'formula/';
{'fraction_non_alphanumeric': 0.1717259323503903, 'fraction_numerical': 0.004625614339404453, 'mean_word_length': 3.2143727161997564, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1650698', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1093, 'n_words': 223}