-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make collectionfilter show human-readable title when group_by is on index where dexterity has a vocabulary or choices and no display_modifier applied. #41
Comments
Well this is exactly what the |
Here‘s a snippet I‘ve made for
|
@petschki,
|
yes ... like described in the README https://github.com/collective/collective.collectionfilter#overloading-groupbycriteria |
In my scenario, my vocabulary is defined TTW using collective.ambidexerity.
|
@pigeonflight I don't think checking for ambidexterity is the correct route. ambidexterity would either need to implement the adapter (or possibly a separate package). However, I think we do need a solution for TTW usage (where writing adapters isn't available) and for basic/end users who would have higher expectations I think when using the collection filters. I think we could implement the original proposal (give the user a setting to automatically try and get values for indexes from type schemas) in such a way that it's only an option if there are no IGroupByModifier adapters registered and update the documentation accordingly. That way, basic users and those implementing ttw solutions can get friendly values in their filters without the need to understand or develop adapters. |
@instification |
@petschki I think that what we are suggesting here is an adjunct to the advanced usecase of creating an adapter + new plugin to get human readible names in the case where you have a dexterity schema with vocabularies already. This is going be a very common case and its built into plone so asking someone to install another plugin or write code for this is not very nice UI. |
@djay I'm not asking you to install another plugin. I just pointed to the places, where to implement it as a integrator for eg. in your theme package. I'm happy for every OOTB usability improvement in general. Maybe the Checkbox in the screenshot above should be a selector, where the user can explicitly define which vocabulary should be used to get the human readable label ... but if the underlying magic does the trick too it's fine. |
@pigeonflight TTW or not is irrelevent. |
let's keep it more general ... there are tiles too 😉 |
@petschki originally we had it as a selector to pick either the vocabulary or the at least the field. As there are cases where you can't map an index back to the field definitions that created it. For example you can a postcode on two different types with two different vocabularies yet the same index. But to have a UI to handle this makes it somewhat complicated so we figured for now its easier just to look up every vocabulary its likely to be and use the first one with a matching value. |
just a note as looking through the code: there's a default |
Just to say that the translation makes sense but doesn't solve many custom vocabulary scenarios. Here's a slightly far fetched but illustrative usecase: Site administrator has created a content type with a field called "my_workflow"
They create a collection filter portlet with |
@djay |
Good idea to use a vocabulary if there is one. As long as the code doesn't introduce any new dependencies, I'm fine with such an approach. |
If the lookup of available vocabularies has a significant performance penalty, then this should a configurable option.... |
@thet agree entirely about the performance. We haven't really measured yet but if there are a lot of filters then this approach by default could certainly introduce a lot of overhead. |
@thet |
@pigeonflight @instification yes sounds good! |
@pigeonflight I made comments on your current approach here 7b203bd. Can you work in the collective rather than in private forks? Makes it harder for others to fix your code. |
Reviewing and working on a better implementation. |
Rationale
The collectionfilter portlet is not smart enough to return human readable titles on vocabularies provided through the web (TTW).
I would like to be able to show human readable titles, whether a vocabulary is provided from a filesystem product with the proper display_modifier or from a TTW provided vocabulary.
A specific example of this is collective.ambidexterity which provides a mechanism for associating a vocabulary with a content type. Ambidexterity vocabularies are defined through the web (TTW) in a control panel provided by collective.ambidexterity.
Most commonly, the vocabulary is presented as a list of tuples.
expected behaviour
The resulting dropdown box would present the human readable title (term.value), most likely derived from the indexed token (term.token).
(for simplicity, I've removed id and class values below).
actual behaviour
The resulting dropdown menu presents the dropdown with only the tokens, not the "human readable" (term.value).
Proposed fix
Provide an option to
fetch human readable title
this would make best effort to locate the title from a vocabulary associated with the field.It would
The provided interface would look something like this
The text was updated successfully, but these errors were encountered: