From 8d5d786452e1f8576b9ca93adf295bdfe76a9254 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Tue, 25 Feb 2014 16:25:10 +0000 Subject: [PATCH] Started directive to make form read-only --- .../META-INF/resources/admin/js/app.js | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js index 2f044860a8..fae6147566 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js +++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js @@ -672,20 +672,6 @@ module.directive('kcInput', function() { return d; }); -module.directive('kcDisableForm', function() { - var d = { - scope : true, - replace : false, - link : function(scope, element, attrs) { - var form = element.children('form'); - console.debug(form); - var input = element.children('input'); - input.attr('disabled', 'true'); - } - }; - return d; -}); - module.directive('kcEnter', function() { return function(scope, element, attrs) { element.bind("keydown keypress", function(event) { @@ -791,6 +777,20 @@ module.directive('kcSelect', function ($compile, Notifications) { } }); +module.directive('kcReadOnly', function() { + var d = { + replace : false, + link : function(scope, element, attrs) { + if (scope.$eval(attrs.kcReadOnly)) { + element.find('input').attr('disabled', 'disabled'); + element.find('button').attr('disabled', 'disabled'); + element.find('select').attr('disabled', 'disabled'); + } + } + }; + return d; +}); + module.directive('kcNavigation', function ($compile, Notifications) { return { scope: true,