Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: Tonyvic on July 31, 2022, 09:53:37 AM

Title: Calendar - divider in wrong place with two events on same date
Post by: Tonyvic on July 31, 2022, 09:53:37 AM
When logged in as Admin or Global Mod the divider between them is ok, but Guest and Regular members see the line in the wrong place. (See attached).
I hope someone may have a clue cos I'm out of ideas. ???
cal1.JPGcal2.JPG

Edit: Same result with default Curve2
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Kindred on July 31, 2022, 11:06:15 AM
The line is not in the wrong place, if you notice in your 2nd set of screenshots the 8 PM is on the line below where it is in your 1st set. Something is causing that to go down in extra line which is making the divider line look like it's in the wrong place
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Arantor on July 31, 2022, 12:14:03 PM
It's the edit icon. In the left hand side, the edit icon is present and it's causing the float to clear correctly.

In the right hand side, no edit icon, and the event title is trying to float left around the details of the previous event.
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Tonyvic on July 31, 2022, 01:06:18 PM
@Kindred and @Arantor,
Thank you for your input but now I'm more confused which is not difficult to achieve these days.
As it's only boxes to complete for Event Title, Time and Details (Event) How can I solve this?
If you want to see live https://allradio.co.uk/index.php (https://allradio.co.uk/index.php)
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Arantor on July 31, 2022, 02:50:40 PM
Does it do it in the default theme? If not, this is a theme bug and the themer needs to fix it.

(I can't switch to the default theme and don't currently have a 2.1 test setup with calendar enabled)

There is a fix to be had by modifying the calendar template to add <br class="clear"> after the <span> with event_location in it, but this really should be fixed by your theme's maintainer.
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Tonyvic on July 31, 2022, 05:13:51 PM
@Arantor,
Many thanks for your response It does happen with Curve2 although it's a very feint line, I have changed the site to the default theme so you can see for yourself.
I will leave the default theme selected until I know you have seen it.

Tony
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Arantor on July 31, 2022, 05:20:27 PM
That sounds like a bug in the core then if you happen to have longer lines for things.

So...

Themes/default/Calendar.template.php around line 470 onwards, you should see this:

echo '
</span><br class="clear">';
}

echo '
</div><!-- .event_wrapper -->';
}

echo '
</div><!-- .smalltext -->';

Change it to:
echo '
</span>';
}
echo '
<br class="clear">';


echo '
</div><!-- .event_wrapper -->';
}

echo '
</div><!-- .smalltext -->';

Basically, there's a thing to force a line break between thigns - but it only happens if editing or exporting to iCal is on - which in this case neither is.

Thus we need to move the br tag outside of the if statement so it's always shown, not just conditionally.
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Antechinus on July 31, 2022, 05:22:52 PM
Add this to the CSS:
.event_wrapper {overflow: hidden;}
Should work without any template edits (just tested it live on that site).
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Arantor on July 31, 2022, 05:24:29 PM
It's still wrong though - because there is conditionally a clear being used in some cases not others (just not the cases you can see there)
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Antechinus on July 31, 2022, 05:29:12 PM
Maybe, but the only reason they are using a br.clear is to clear floated content in that div, and using hidden overflow on the div does that anyway. IOW, I think that whoever wrote the default code did not know enough basic CSS 101 to deal with it the easy way.

ETA: If you did want to edit the template as well, I would do it like this:
Code (Find) Select
echo '
</span><br class="clear">';
}

echo '
</div><!-- .event_wrapper -->';
}

echo '
</div><!-- .smalltext -->';

Code (Replace) Select
echo '
</span>';
}

echo '
</div><!-- .event_wrapper -->';
}

echo '
</div><!-- .smalltext -->';
Really, that (with the extra line of CSS) is how it should be by default. Although if I just wanted to get it working on top of the current default code, and wasn't a template hacker from way back, I'd just use the CSS tweak for simplicity. :)
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Arantor on July 31, 2022, 05:46:14 PM
Um, that's now broken - you've removed the end of a span that is conditionally displayed when you can edit or when you can export iCal.
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Antechinus on July 31, 2022, 05:52:20 PM
Fixed it. :)
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Tonyvic on July 31, 2022, 06:48:18 PM
Sorry I started a war of codeing guys, I'll stay quiet for a while and try the options presented.  :)
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Arantor on July 31, 2022, 06:56:28 PM
My solution is the old fashioned and quick and dirty approach, Antechinus's is the more modern and probably more correct approach.

Both should work.
Title: Re: Calendar - divider in wrong place with two events on same date
Post by: Tonyvic on August 01, 2022, 04:12:21 AM
Thanks to both of you, now working.