collective / collective.polls

A content type, workflow, and portlet for conducting online polls, for anonymous and logged-in users
11 stars 12 forks source link

Revisit tile logic #112

Open puittenbroek opened 7 years ago

puittenbroek commented 7 years ago

Should you create a cover page with a poll-tile without any polls, it will break. In #89 MR I added some checks to avert this, but the logic itself is implicit. Insert a poll inot the tile, if not .. we try to find the most recent closed one to show. This is a bit random IMHO.

I propose the following changes:

So the usage of the tile is as followed:

puittenbroek commented 7 years ago

The first is easiliy done by making the tile configurable and adding a (bool?) field for 'show latest poll'. 'Dropping' a poll on the tile should set the 'show latest poll' to False. Reverse, setting 'show latest poll' should empty any saved uid pointing to a poll. So you always have either a poll-uid, or a 'latest' flag. Never both.

hvelarde commented 7 years ago

that could be complicated.

puittenbroek commented 7 years ago

Perhaps, but otherwise we the 'latest poll' flag should precede the object :thinking: And populating with object can easily turn that flag off. Did some testing, it's not so easy to clear the saved poll in the tile when turning on the 'show latest poll' flag :/

So I guess the 'preceding' part is the way to go?

hvelarde commented 7 years ago

yes, that sounds good: if use latests is set we just ignore the UUID on the tile; sound easy.