From ca7395c35367965f8824f2bfecfa3f79f4b8a87b Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Thu, 21 Jul 2011 21:29:55 -0500 Subject: Refactored IPA.current_facet(). The IPA.current_facet() has been merged into IPA.entity.setup() and replaced by IPA.entity.get_facet(). The setup() will read the current facet's name from the -facet URL parameter and store the facet object in the entity object. The get_facet() without any parameter will return the current facet object. --- install/ui/entity.js | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'install/ui/entity.js') diff --git a/install/ui/entity.js b/install/ui/entity.js index 0940c7d17..83687fe7e 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -127,6 +127,10 @@ IPA.facet = function (spec) { that.header.load(data); }; + that.needs_update = function() { + return true; + }; + that.is_dirty = function() { return false; }; @@ -459,7 +463,7 @@ IPA.entity = function (spec) { that.facet_groups = $.ordered_map(); // current facet - that.facet_name = null; + that.facet = null; that.redirect_facet = spec.redirect_facet; that.containing_entity = null; @@ -490,7 +494,14 @@ IPA.entity = function (spec) { }; that.get_facet = function(name) { - if (name === 'default') { + if (name === undefined) { + // return the current facet + if (that.facet) return that.facet; + + // return the main facet + return that.facets.values[0]; + + } else if (name === 'default') { // return the first facet in the first facet group var facet_groups = that.facet_groups.values; for (var i=0; i return + if (that == prev_entity && that.facet == prev_facet && !that.facet.needs_update()) { + return; } if (prev_facet) { @@ -613,15 +619,6 @@ IPA.entity = function (spec) { return that; }; -IPA.current_facet = function(entity) { - var facet_name = IPA.nav.get_state(entity.name+'-facet'); - var facets = entity.facets.values; - if (!facet_name && facets.length) { - facet_name = facets[0].name; - } - return facet_name; -}; - IPA.nested_tab_labels = {}; IPA.get_nested_tab_label = function(entity_name){ -- cgit