Closed (fixed)
Project:
Facet API
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Jun 2011 at 17:52 UTC
Updated:
21 Jun 2011 at 14:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
pwolanin commentedsacrificing the 'type' setting, since we are debating making that an array or even how it's relevant.
Comment #2
cpliakas commentedI see what you are getting at. Could you further explain the "widgetFamily" to me? We already have the machine readable name of the widget. Couldn't we use that for the conditional?
Changing to a feature request because I think the functionality works as-is and I don't see it conflicting with future widgets. Obviously I could be missing something.
Comment #3
pwolanin commentedWell, I did not want to hard-code the allowed widget names there. Imagine I want to make another widget that derives from FacetapiWidgetLinks and wants to use the soft/hard limit feature.
By having this "family" notion, we allow this new custom widget to benefit from the JS defined by the main module.
The alternative I initially considered was having a setting that lists all the link-type widget names, but that was a bit uglier in terms of implementation and further bloats the JS settings.
Comment #4
pwolanin commentedper discussion with Chris, making this more targeted as part of the settings, since the "Family" concept is not necessarily clear.
Comment #5
pwolanin commentedAfter more discussion - a simplified patch.
Comment #6
pwolanin commentedComment #7
pwolanin commentedFollow-up to better target the adding of checkboxes and minimize the JS overhead.
Also replaces the class rather than adding another.
Comment #8
pwolanin commentedbetter comments and method names too.
Comment #9
cpliakas commentedLooks good to me.
Comment #10
pwolanin commentedGiven the other checks we have, we can probable even remove the condition
what do you think?
Comment #11
cpliakas commentedI think that makes sense. I want to try to get away from hard-coding the realms if possible. I created a task a while ago at #1147500: Improve the JavaScript API to remember to improve the JS API. I am even tpying with the idea of specifying the method or methods that are invoked per-facet in the jsSettings. For example:
The methods would be out checkbox functionality or show more / show less stuff. That way we can eliminate any checks all together. Would like to hear thoughts on that approach.
Comment #12
pwolanin commentedWhat's the use case for such dynamic specification of the methods? Two facet widgets with the same 'limit' setting but different ways of handling it? Seems clearer to just have a different setting name?
Comment #13
cpliakas commentedHow I see it, this would allow for different widgets to reuse the same settings. For example:
This way you could reuse settings without having to do the conditionals we have been working with. Also, as it stands every JS file associated with a widget has to iterate over the settings and do their own conditional to apply their own settings. Check out the for loop in the Chart Facets module's JS file. Defining the callbacks would eliminate the need for the widgets to loop through the settings in order to figure out which widgets should be acted on.
Comment #14
pwolanin commentedAny concern about bloating the settings?
Comment #15
cpliakas commentedIn what way? Are you concerned about the amount of data being transferred as JS settings, the actual $this->jsSettings variable getting too big and unwieldy, or something else I am not thinking of?
Comment #16
pwolanin commentedMore the JS settings in the page getting big, though really it's not going to make much difference if there are only a half dozen fcets displayed on a page.
Comment #17
pwolanin commentedHere's a version with somewhat more changes that reduces code duplication and should be more compatible to defining a single callback.
Comment #18
pwolanin commentedMake code clearer by removing repeated use of
$(this)Comment #19
pwolanin commentedcommitted
Comment #20
cpliakas commentedAwesome. Love the elimination of all that code. Moving the "callbacks" functionality to a post at #1147500: Improve the JavaScript API.