diff --git a/js/issuer.js b/js/issuer.js index 08e898d..3fe4572 100644 --- a/js/issuer.js +++ b/js/issuer.js @@ -164,8 +164,13 @@ $(function () { $scope.find('.js-scope-desc').text(grantDescriptions[scope]); } else { - $scope.find('.js-scope-toggle').prop('checked', false); - $scope.find('.js-scope-toggle').prop('disabled', true); + //This disables the check/checkbox when we have an unrecognized grant. + //This is disabled for testing until we can discover grants automatically. + //TODO: Enable this when grants are discoverable + //TODO: Indicate to user that this is disabled, not just unchecked. + //$scope.find('.js-scope-toggle').prop('checked', false); + //$scope.find('.check').attr("src", "./img/unpressed-check.png"); + //$scope.find('.js-scope-toggle').prop('disabled', true); $scope.find('.js-scope-desc').text(scope); } diff --git a/js/script.js b/js/script.js index 2f567ba..3a39100 100644 --- a/js/script.js +++ b/js/script.js @@ -47,25 +47,28 @@ $('body').on('click', '.js-remember-label', function (ev) { $('body').on('click', '.check', function () { 'use strict'; - var $img = $(this); - if($img.attr("src") === "./img/pressed-check.png") { - $img.attr("src", "./img/unpressed-check.png"); - $img.removeClass("is-checked"); - } else if($img.attr("src") === "./img/unpressed-check.png") { - $img.attr("src", "./img/pressed-check.png"); - $img.addClass("is-checked"); - } }); $('body').on('click', '.js-auth-li-enabled', function (ev) { 'use strict'; ev.preventDefault(); ev.stopPropagation(); + + var $this = $(this); - if ($this.find('.js-auth-checkbox').is(':checked') === true) { - $this.find('.js-auth-checkbox').prop( "checked", false ); + var $hiddenCheckbox = $this.find('.js-auth-checkbox'); + var $img = $this.find('.check'); + var newStatus = $hiddenCheckbox.prop('checked') ? "unchecked" : "checked"; + + if(newStatus === 'checked') { + + $img.attr('src', './img/pressed-check.png'); + $img.addClass("is-checked"); + $hiddenCheckbox.prop( "checked", true ); } else { - $this.find('.js-auth-checkbox').prop( "checked", true ); + $img.attr("src", "./img/unpressed-check.png"); + $img.removeClass("is-checked"); + $hiddenCheckbox.prop( "checked", false ); } });