From 9c1d36d70cee1441f7ef8db09f5df8f6492f8d35 Mon Sep 17 00:00:00 2001 From: Justin Obara Date: Fri, 15 Nov 2013 13:27:46 -0500 Subject: [PATCH] FLUID-5205: Fixed selector surfacing. The cutpoint generator is only run once. This means that all of the selectors, not just currently active sub panels, need to be surfaced immediately. Also removed the onRefreshView event as this is no longer used by anything. --- src/framework/preferences/js/Panels.js | 20 ++++++------------- .../preferences/js/PanelsTests.js | 9 ++------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/src/framework/preferences/js/Panels.js b/src/framework/preferences/js/Panels.js index 368f42763e..73a7a9effa 100644 --- a/src/framework/preferences/js/Panels.js +++ b/src/framework/preferences/js/Panels.js @@ -176,7 +176,6 @@ var fluid_1_5 = fluid_1_5 || {}; "onCreate.initSubPanels": "{that}.events.initSubPanels", "onCreate.hideInactive": "{that}.hideInactive", "onCreate.surfaceSubpanelRendererSelectors": "{that}.surfaceSubpanelRendererSelectors", - "onRefreshView.surfaceSubpanelRendererSelectors": "{that}.surfaceSubpanelRendererSelectors", "afterRender.initSubPanels": "{that}.events.initSubPanels", "afterRender.hideInactive": "{that}.hideInactive", "afterRender.subPanelRelay": { @@ -223,10 +222,6 @@ var fluid_1_5 = fluid_1_5 || {}; }, conditionalCreateEvent: { funcName: "fluid.prefs.compositePanel.conditionalCreateEvent", - }, - refreshView: { - funcName: "fluid.prefs.compositePanel.refreshView", - args: ["{that}"] } }, subPanelOverrides: { @@ -268,11 +263,6 @@ var fluid_1_5 = fluid_1_5 || {}; return comp && fluid.hasGrade(comp.options, "fluid.prefs.panel"); }; - fluid.prefs.compositePanel.refreshView = function (that) { - that.events.onRefreshView.fire(that); - fluid.rendererComponent.refreshView(that); - }; - /* * Creates a grade containing the distributeOptions rules needed for the subcomponents */ @@ -445,13 +435,15 @@ var fluid_1_5 = fluid_1_5 || {}; /* * Surfaces the rendering selectors from the subpanels to the compositePanel, * and scopes them to the subpanel's container. + * Since this is used by the cutpoint generator, which only gets run once, we need to + * surface all possible subpanel selectors, and not just the active ones. */ fluid.prefs.compositePanel.surfaceSubpanelRendererSelectors = function (that, components, selectors) { fluid.each(components, function (compOpts, compName) { - var comp = that[compName]; - if (fluid.prefs.compositePanel.isActivePanel(comp)) { - fluid.each(comp.options.selectors, function (selector, selName) { - if (!comp.options.selectorsToIgnore || $.inArray(selName, comp.options.selectorsToIgnore) < 0) { + if (fluid.prefs.compositePanel.isPanel(compOpts.type, compOpts.options)) { + var opts = fluid.prefs.compositePanel.prefetchComponentOptions(compOpts.type, compOpts.options); + fluid.each(opts.selectors, function (selector, selName) { + if (!opts.selectorsToIgnore || $.inArray(selName, opts.selectorsToIgnore) < 0) { fluid.set(selectors, fluid.prefs.compositePanel.rebaseSelectorName(compName, selName), selectors[compName] + " " + selector); } }); diff --git a/src/tests/framework-tests/preferences/js/PanelsTests.js b/src/tests/framework-tests/preferences/js/PanelsTests.js index 6b428c1914..084b6ee4cf 100644 --- a/src/tests/framework-tests/preferences/js/PanelsTests.js +++ b/src/tests/framework-tests/preferences/js/PanelsTests.js @@ -185,10 +185,6 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt afterRender: { listener: "{that}.writeRecord", args: ["compositePanel"] - }, - onRefreshView: { - listener: "{that}.writeRecord", - args: ["onRefreshView"] } }, protoTree: { @@ -240,7 +236,6 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt var expectedFireRecord = { compositePanel: 3, - onRefreshView: 3, subPanel1: 3, subPanel2: 3 }; @@ -426,10 +421,10 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt } }, strings: { - text: "conditionalPanel2", + text2: "conditionalPanel2", }, selectors: { - text2: ".text" + text: ".text" }, protoTree: { text: {