From 14c276d21865f70e0ff939357b52a9830d32b5ea Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 18 Apr 2013 12:38:38 +0200 Subject: Convert definitions of entities to spec objects https://fedorahosted.org/freeipa/ticket/3235 --- install/ui/src/freeipa/realmdomains.js | 48 ++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'install/ui/src/freeipa/realmdomains.js') diff --git a/install/ui/src/freeipa/realmdomains.js b/install/ui/src/freeipa/realmdomains.js index c5914a28..82f104ca 100644 --- a/install/ui/src/freeipa/realmdomains.js +++ b/install/ui/src/freeipa/realmdomains.js @@ -18,20 +18,24 @@ * along with this program. If not, see . */ -define(['./ipa', './jquery', './details', './entity'], function (IPA, $) { - - IPA.realmdomains = {}; - - IPA.realmdomains.entity = function (spec) { - - spec = spec || {}; - spec.defines_key = false; - var that = IPA.entity(spec); - - that.init = function () { - that.entity_init(); - - that.builder.details_facet({ +define([ + './ipa', + './jquery', + './phases', + './reg', + './details', + './entity'], + function (IPA, $, phases, reg) { + + var exp = IPA.realmdomains = {}; + + var make_spec = function() { + return { + name: 'realmdomains', + defines_key: false, + facets: [ + { + $type: 'details', $factory: IPA.realmdomains_details_facet, title: IPA.metadata.objects.realmdomains.label, sections: [ @@ -47,10 +51,9 @@ define(['./ipa', './jquery', './details', './entity'], function (IPA, $) { } ], needs_update: true - }); - }; - return that; - }; + } + ] + };}; IPA.realmdomains_details_facet = function (spec) { spec = spec || {}; @@ -99,7 +102,12 @@ define(['./ipa', './jquery', './details', './entity'], function (IPA, $) { return that; }; - IPA.register('realmdomains', IPA.realmdomains.entity); + exp.entity_spec = make_spec(); + exp.register = function() { + var e = reg.entity; + e.register({type: 'realmdomains', spec: exp.entity_spec}); + }; + phases.on('registration', exp.register); - return {}; + return exp; }); -- cgit