<commit_before>﻿(function () {
    'use strict';

    function ResetButtonDirective() {
        function link(scope, el, attr, ctrl) {
            if (attr.defaultValue) {
                scope.defaultValue = attr.defaultValue;
            } else {
                scope.defaultValue = '';
            }
            scope.labelKey = attr.labelKey;

            scope.resetValue = function () {
                scope.model = scope.defaultValue;
            }
            scope.isDisabled = function () {
                var hasNoValue = typeof (scope.model) === 'undefined';
                var valueEqualsDefaultValue = scope.model === scope.defaultValue;

                return hasNoValue && (valueEqualsDefaultValue == false);
            }
        }

        var directive = {
            restrict: 'E',
            replace: true,
            templateUrl: '/App_Plugins/Our.Umbraco.GridSettings/directives/ResetButton/view.html',
            scope: {
                labelKey: '&',
                model: '=',
                defaultValue: '&?'
            },
            link: link
        };

        return directive;
    }

    angular.module('umbraco.directives').directive('gridsettingsResetButton', ResetButtonDirective);
})();<commit_msg>Corrected isVisible() logic in ResetButton directive<commit_after>﻿(function () {
    'use strict';

    function ResetButtonDirective() {
        function link(scope, el, attr, ctrl) {
            if (attr.defaultValue) {
                scope.defaultValue = attr.defaultValue;
            } else {
                scope.defaultValue = '';
            }
            scope.labelKey = attr.labelKey;

            scope.resetValue = function () {
                scope.model = scope.defaultValue;
            }
            scope.isVisible = function () {
                var hasValue = typeof (scope.model) !== 'undefined';
                var valueEqualsDefaultValue = scope.model === scope.defaultValue;

                return hasValue && (valueEqualsDefaultValue === false);
            }
        }

        var directive = {
            restrict: 'E',
            replace: true,
            templateUrl: '/App_Plugins/Our.Umbraco.GridSettings/directives/ResetButton/view.html',
            scope: {
                labelKey: '&',
                model: '=',
                defaultValue: '&?'
            },
            link: link
        };

        return directive;
    }

    angular.module('umbraco.directives').directive('gridsettingsResetButton', ResetButtonDirective);
})();
{'fraction_non_alphanumeric': 0.11400394477317555, 'fraction_numerical': 0.0, 'mean_word_length': 1.5720081135902637, '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': '3639521', 'n_tokens_mistral': 658, 'n_tokens_neox': 621, 'n_words': 115}