Skip to content

Commit

Permalink
FLUID-5205: Fixed selector surfacing.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jobara committed Nov 15, 2013
1 parent 36c5c41 commit 9c1d36d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
20 changes: 6 additions & 14 deletions src/framework/preferences/js/Panels.js
Expand Up @@ -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": {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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);
}
});
Expand Down
9 changes: 2 additions & 7 deletions src/tests/framework-tests/preferences/js/PanelsTests.js
Expand Up @@ -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: {
Expand Down Expand Up @@ -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
};
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 9c1d36d

Please sign in to comment.