<commit_before>﻿/* Controllers */
angular.module("umbraco").controller("Our.Umbraco.Mortar.Dialogs.docTypeDialog",
    [
        "$scope",
        "editorState",
        "contentResource",
        "contentTypeResource",
        "Our.Umbraco.Mortar.Resources.mortarResources",

        function ($scope, editorState, contentResource, contentTypeResource, mortarResources) {

            // Probably not best practise to talk to parent scope directly, but hey...
            $scope.model = $scope.$parent.$parent.model;
            $scope.dialogOptions = $scope.$parent.dialogOptions;

            $scope.docTypes = [];
            $scope.dialogMode = "selectDocType";
            $scope.selectedDocType = null;
            $scope.node = null;
            $scope.nameProperty = {
                hideLabel: false,
                alias: "name",
                label: "Name",
                description: "Give this piece content a name.",
                value: ""
            };

            $scope.selectDocType = function () {
                $scope.dialogMode = "edit";
                $scope.dialogData = $scope.selectedDocType.alias;
                //$scope.model.docType = $scope.selectedDocType.alias;
                loadNode();
            };

            $scope.save = function () {
                // Copy property values to scope model value
                if ($scope.node) {
                    var value = {
                        name: $scope.nameProperty.value
                    };
                    for (var t = 0; t < $scope.node.tabs.length; t++) {
                        var tab = $scope.node.tabs[t];
                        for (var p = 0; p < tab.properties.length; p++) {
                            var prop = tab.properties[p];
                            if (typeof prop.value !== "function") {
                                value[prop.alias] = prop.value;
                            }
                        }
                    }
                    $scope.dialogData.value = value;
                } else {
                    $scope.dialogData.value = null;
                }

                $scope.submit($scope.dialogData);
            };

            function loadNode() {
                contentResource.getScaffold(-20, $scope.dialogData.docType).then(function (data) {
                    // Remove the last tab<commit_msg>Removed un-ndeeded code<commit_after>﻿/* Controllers */
angular.module("umbraco").controller("Our.Umbraco.Mortar.Dialogs.docTypeDialog",
    [
        "$scope",
        "editorState",
        "contentResource",
        "contentTypeResource",
        "Our.Umbraco.Mortar.Resources.mortarResources",

        function ($scope, editorState, contentResource, contentTypeResource, mortarResources) {

            // Probably not best practise to talk to parent scope directly, but hey...
            $scope.model = $scope.$parent.$parent.model;
            $scope.dialogOptions = $scope.$parent.dialogOptions;

            $scope.docTypes = [];
            $scope.dialogMode = "selectDocType";
            $scope.selectedDocType = null;
            $scope.node = null;
            $scope.nameProperty = {
                hideLabel: false,
                alias: "name",
                label: "Name",
                description: "Give this piece content a name.",
                value: ""
            };

            $scope.selectDocType = function () {
                $scope.dialogMode = "edit";
                $scope.dialogData = $scope.selectedDocType.alias;
                loadNode();
            };

            $scope.save = function () {
                // Copy property values to scope model value
                if ($scope.node) {
                    var value = {
                        name: $scope.nameProperty.value
                    };
                    for (var t = 0; t < $scope.node.tabs.length; t++) {
                        var tab = $scope.node.tabs[t];
                        for (var p = 0; p < tab.properties.length; p++) {
                            var prop = tab.properties[p];
                            if (typeof prop.value !== "function") {
                                value[prop.alias] = prop.value;
                            }
                        }
                    }
                    $scope.dialogData.value = value;
                } else {
                    $scope.dialogData.value = null;
                }

                $scope.submit($scope.dialogData);
            };

            function loadNode() {
                contentResource.getScaffold(-20, $scope.dialogData.docType).then(function (data) {
                    // Remove the last tab
{'fraction_non_alphanumeric': 0.11243866012374654, 'fraction_numerical': 0.0017068487305312568, 'mean_word_length': 1.2355746304244157, 'pattern_counts': {'":': 0, '<': 7, '<?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': '680874', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1115, 'n_words': 233}