From 5b26a383ceb7c9293ae3850316a29de477c43303 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Wed, 23 Nov 2011 16:57:57 +0100 Subject: Added possibility to define facet/dialog specific policies After deleting section as a special type of object a new way of defining inter-field logic is needed. For this purpose a facet_policy was created. It is a simple object with init() method. Init method should contain logic for attaching to fields' or widgets' events. When a policy is added to facet or dialog its container property should be set to that facet or dialog. It gives the policy an access to fields and widgets. Init method should be called after widgets creation. https://fedorahosted.org/freeipa/ticket/2040 --- install/ui/dialog.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'install/ui/dialog.js') diff --git a/install/ui/dialog.js b/install/ui/dialog.js index c03bf801..44bd11cc 100644 --- a/install/ui/dialog.js +++ b/install/ui/dialog.js @@ -1,6 +1,7 @@ /*jsl:import ipa.js */ /* Authors: * Endi Sukma Dewata + * Petr Vobornik * * Copyright (C) 2010 Red Hat * see file 'COPYING' for use and warranty information @@ -19,7 +20,7 @@ * along with this program. If not, see . */ -/* REQUIRES: widget.js */ +/* REQUIRES: widget.js, details.js */ IPA.dialog_button = function(spec) { @@ -68,6 +69,10 @@ IPA.dialog = function(spec) { that.widgets = IPA.widget_container(); that.fields = IPA.field_container({ container: that }); that.buttons = $.ordered_map(); + that.policies = IPA.facet_policies({ + container: that, + policies: spec.policies + }); that.create_button = function(spec) { var factory = spec.factory || IPA.dialog_button; @@ -122,6 +127,7 @@ IPA.dialog = function(spec) { widget.create(div); } + that.policies.post_create(); }; that.show_message = function(message) { @@ -233,6 +239,7 @@ IPA.dialog = function(spec) { that.create_builder(); that.builder.build(spec); that.fields.widgets_created(); + that.policies.init(); }; that.init(); -- cgit