<commit_before>'use strict';

angular.module('mean.icu.ui.bulkoperations')
    .directive('multipleCornerButton', function () {
        function controller($scope, MultipleSelectService) {
            $scope.selectedItems = $scope.$parent.selectedItems;
            $scope.cornerState = $scope.$parent.cornerState;

            $scope.changeCornerState = function(){
                $scope.cornerState = MultipleSelectService.changeCornerState();
                $scope.$emit('changeCornerState', $scope.cornerState);

                if($scope.cornerState === 'none'){
                    $scope.selectedItems = MultipleSelectService.refreshSelectedList();
                } else {
                    $scope.selectedItems = MultipleSelectService.getSelected();
                }
            };
        }

        return {
            restrict: 'E',
            controller: controller,
            templateUrl: '/icu/components/bulk-operations/multiple-corner-button/multiple-corner-button.html',
        };
    });<commit_msg>fixed changing corner button after selecting all and unselect some https://github.com/linnovate/root/issues/1158<commit_after>'use strict';

angular.module('mean.icu.ui.bulkoperations')
    .directive('multipleCornerButton', function () {
        function controller($scope, MultipleSelectService) {
            $scope.selectedItems = $scope.$parent.selectedItems;
            $scope.cornerState = $scope.$parent.cornerState;

            $scope.changeCornerState = function(){
                $scope.cornerState = MultipleSelectService.changeCornerState();
                $scope.$emit('changeCornerState', $scope.cornerState);

                if($scope.cornerState === 'none'){
                    $scope.selectedItems = MultipleSelectService.refreshSelectedList();
                } else {
                    $scope.selectedItems = MultipleSelectService.getSelected();
                }
            };

            $scope.$on('refreshList', function (event) {
                $scope.cornerState = MultipleSelectService.getCornerState();
            });
        }

        return {
            restrict: 'E',
            controller: controller,
            templateUrl: '/icu/components/bulk-operations/multiple-corner-button/multiple-corner-button.html',
        };
    });
{'fraction_non_alphanumeric': 0.1196877710320902, 'fraction_numerical': 0.0017346053772766695, 'mean_word_length': 2.168956043956044, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '5568761', 'n_tokens_mistral': 598, 'n_tokens_neox': 552, 'n_words': 79}