<commit_before>/**
 * Created by xubt on 4/29/16.
 */
kanbanApp.directive('entryCreation', function () {
    return {
        restrict: 'E',
        templateUrl: 'component/entry/partials/entry-creation.html',
        replace: true,
        scope: true,
        controller: ['$scope', 'entriesServices', function ($scope, entriesServices) {
            $scope.createEntry = function () {
                var title = $scope.title;
                var entry = {title: title, boardId: $scope.board.id};
                var entriesPromise = entriesServices.create(entry);
                entriesPromise.then(function (data) {
                    if ($scope.entries === null) {
                        $scope.entries = [];
                    }
                    $scope.entries.push(data);
                    $scope.title = "";
                    $scope.cancelCreateEntry();
                });
            };

            $scope.displayCreationButton = true;
            $scope.displayForm = false;
            $scope.cancelCreateEntry = function () {
                $scope.displayCreationButton = true;
                $scope.displayForm = false;
            };
            $scope.showCreateEntryForm = function () {
                $scope.displayCreationButton = false;
                $scope.displayForm = true;
            };
            $scope.keyPress = function ($event) {
                if ($event.keyCode == 13) {
                    $scope.createEntry();
                }
                if ($event.keyCode == 27) {
                    $scope.cancelCreateEntry();
                }
            };
            $scope.blur = function () {
                if ($scope.title === "" || $scope.title === undefined) {
                    $scope.cancelCreateEntry();
                }
            };
            $scope.updateEntry = function (_title, _entry) {
                var entry = _entry;
                entry.title = _title;
                var entryPromise = entriesServices.update(entry);
                entryPromise.then(function () {
                });
            };

        }]
    };
});<commit_msg>optimizing entry update.<commit_after>/**
 * Created by xubt on 4/29/16.
 */
kanbanApp.directive('entryCreation', function () {
    return {
        restrict: 'E',
        templateUrl: 'component/entry/partials/entry-creation.html',
        replace: true,
        scope: true,
        controller: ['$scope', 'entriesServices', function ($scope, entriesServices) {
            $scope.createEntry = function () {
                var title = $scope.title;
                var entry = {title: title, boardId: $scope.board.id};
                var entriesPromise = entriesServices.create(entry);
                entriesPromise.then(function (data) {
                    if ($scope.entries === null) {
                        $scope.entries = [];
                    }
                    $scope.entries.push(data);
                    $scope.title = "";
                    $scope.cancelCreateEntry();
                });
            };

            $scope.displayCreationButton = true;
            $scope.displayForm = false;
            $scope.cancelCreateEntry = function () {
                $scope.displayCreationButton = true;
                $scope.displayForm = false;
            };
            $scope.showCreateEntryForm = function () {
                $scope.displayCreationButton = false;
                $scope.displayForm = true;
            };
            $scope.keyPress = function ($event) {
                if ($event.keyCode == 13) {
                    $scope.createEntry();
                }
                if ($event.keyCode == 27) {
                    $scope.cancelCreateEntry();
                }
            };
            $scope.blur = function () {
                if ($scope.title === "" || $scope.title === undefined) {
                    $scope.cancelCreateEntry();
                }
            };
            $scope.updateEntry = function (_title, _entry) {
                var entry = _entry;
                if (entry.title === "") {
                    return;
                }
                entry.title = _title;
                var entryPromise = entriesServices.update(entry);
                entryPromise.then(function () {
                });
            };

        }]
    };
});
{'fraction_non_alphanumeric': 0.12203545935988948, 'fraction_numerical': 0.004144600506562284, 'mean_word_length': 1.2461220268872804, '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': '5525048', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1008, 'n_words': 191}