-
Notifications
You must be signed in to change notification settings - Fork 55
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
limit number of items on list tile & collection tile #447
Comments
The "Position" label on the Number of items to display field in the Tile configuration view is coming from a modification done last year (8ff071b) to implement an offset value for the collection tile. And as the collection tile is inheriting from the list tile this also modifies the list. |
I think your question is really complex and involves too many things; we need to break this in various issues in order to solve them easily; anyway, I will try to answer you. as you already know, collective.cover code is really complex and nobody understands all of it well enough; some decisions made on the beginning are showing not being the best ones. that's normal and we have to fix them, trying to disrupt the less possible and move on. one of these decisions is the use of an adapter to store on persistent annotations the configuration of tiles. I don't know how to solve this but we need to simplify the implementation. as an example, we are now having an issue with the checkout of a very complex front page in one of our customers taking too long (like 30 seconds). the problem with some of the fields and their default values is that the default value is not always initialized. IIRC, the default value is only initialized if you edit the tiles first, instead of configure it. I think this is an issue with the configuration of tiles. I had to include some funky code to initialize a tile in some cases because of this. on a perfect world we should have extended z3c.form to have a configuration mode, but I think at that point nobody knew what we were doing. so, on the list tile: we should get rid of the hard-coded limit; as long as I can see, the limit attribute is only used internally and in one place on the list tile template. we can provide a function called same thing with the collection tile, we are setting it to 4 in case it has not taken the default value for some reason. I would love to change the fields name, but I think that could be just a little bit harder here. so, resuming:
|
BTW, the position label you're seeing on the configuration screen of the list tile should be a bug. probably the |
As you know, I am just creating a new carousel tile: covertile.cycle2. As with the old carousel tile, it will be based on the list tile, but since this new tile does not have any existing user base, what can I do now to avoid issues mentioned here in the future? |
we must fix the issue :-) |
Note: the actual commit for "funky code to initialize the tile" |
yes, that's the kind of crap I want to avoid :-) |
A couple of comments:
Things that might help (and I'm just throwing out ideas from the top of my head here):
e.g.
instead of:
UPDATE: Better link for Multiwidget / ObjectWidgets looks the right thing to use, this gives an example of a "Minmax widget" http://docs.plone.org/develop/plone/forms/z3c.form.html#combined-widgets |
I think we will have some resources to work on this at some point in the following weeks; also, I think this is not a blocker for 1.0b1. @rodfersou please check this when you have some spare time and we can discuss later how to aboard the issue. |
@djowett Currently Line 47 in tiles/carousel.py has "class CarouselTile(ListTile):" . What do you mean with 'class collection tile does not inherit from listtile', for your carousel implementation? |
@fredvd you seem to be mixing up references to Carousel Tile & Collection Tile ...
In tiles/carousel.py:
Not a major point, but I'm just saying (in response to your second comment on 29th Aug) that the "Position" label change creeps in to Carousel tile because it shares the same Widget (template) as the Collection tile, not because they both inherit from ListTile. |
@djowett Mixup: you are absolutely right, I was blogging from PLOG with the carousel in mind and didn't read. :-) The position/number weird naming in the layout model dialog for configuring tiles is indeed coming from the shared widget. template. If I'm correct the 'position' label was introduced by my former colleague Kuno he added the support in the collection tile to start displaying items from a certain position (but didn't realise the widget for a 'number' field is shared). The use case for this position is that you can create a coer for exmple for news items where you create one collection tile that highlights the 2 items in a different layout and then you could use another instance of the collection tile that lists new-items 3 and following in a smaller list style. |
and that is related with #298 |
IMHO we should not have limit to list tile and carousel tile. If the user want to have 2 or 52 items in the list is a personal decision and he just need to drag the items he wants to the list or carousel. Although the collection need a limit field because de number of result items depends on how many items have in the portal. |
@cleberjsantos why did you close the issue? |
@hvelarde I'm Sorry, I didn't do it for wanting! |
Initial fix for limit number of items on list tile & collection tile here 1f9f8f7 |
Solves this issue with #802 |
The list tile is now hard coded to 5 items by default in tiles/list.py:ListTile with limit = 5 . The set_limit() method on the same class is marked with a TODO, the count field is not used/ignored:
I checked with some debugging but afaics the field.get('size', self.limit) will never find a size value since it's not there. Is this some legacy code that would break installed base if we implement the TODO? Maybe in the CarouselTile that is inheriting from ListTile?
The Collection tile has a similar hard coded value where the number_to_show field value is chcked but otherwise set to 4. At least here you can override the default value, but the schema has a note that number_to_show should be renamed to count (to be on par with naming in the ListTile).Another
installed base migration.
Last, the Layout configuration of the List tile shows a 'Position' label next to the "Number to Show" field name, but this seems to be the ordering of the fields, not the field for count. See attached screenshot.
Questions:
The text was updated successfully, but these errors were encountered: