From b8d65da266e45e81356dcf60b28209b75a437973 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 23 Jun 2013 14:11:39 -0400 Subject: [PATCH] calendar: When there are multiple pages for a given day, they're displayed in a popup on mouseover. Thanks, Louis --- IkiWiki/Plugin/calendar.pm | 43 ++++++++++++++++--- debian/changelog | 3 ++ ...dar:_listing_multiple_entries_per_day.mdwn | 2 + doc/style.css | 1 + ...ar:_listing_multiple_entries_per_day_.mdwn | 2 + 5 files changed, 44 insertions(+), 7 deletions(-) diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index d443198f6..8ca6dd826 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -86,8 +86,10 @@ sub format_month (@) { my $year = $date[5] + 1900; my $mtag = sprintf("%02d", $month); - # Only one posting per day is being linked to. - $linkcache{"$year/$mtag/$mday"} = $p; + if (! $linkcache{"$year/$mtag/$mday"}) { + $linkcache{"$year/$mtag/$mday"} = []; + } + push(@{$linkcache{"$year/$mtag/$mday"}}, $p); } my $pmonth = $params{month} - 1; @@ -221,11 +223,38 @@ EOF $tag='month-calendar-day-link'; } $calendar.=qq{\t\t}; - $calendar.=htmllink($params{page}, $params{destpage}, - $linkcache{$key}, - noimageinline => 1, - linktext => $day, - title => pagetitle(IkiWiki::basename($linkcache{$key}))); + if (scalar(@{$linkcache{$key}}) == 1) { + # Only one posting on this page + my $page = $linkcache{$key}[0]; + $calendar.=htmllink($params{page}, $params{destpage}, + $page, + noimageinline => 1, + linktext => $day, + title => pagetitle(IkiWiki::basename($page))); + } + else { + $calendar.=qq{}; + } $calendar.=qq{\n}; } else { diff --git a/debian/changelog b/debian/changelog index b9b46be3d..10e0e84ff 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,9 @@ ikiwiki (3.20130519) UNRELEASED; urgency=low * comments: The formats allowed to be used in comments can be configured using comments_allowformats. Thanks, Michal Sojka + * calendar: When there are multiple pages for a given day, they're + displayed in a popup on mouseover. + Thanks, Louis -- Joey Hess Sun, 23 Jun 2013 14:02:01 -0400 diff --git a/doc/forum/Calendar:_listing_multiple_entries_per_day.mdwn b/doc/forum/Calendar:_listing_multiple_entries_per_day.mdwn index 251cd6d9f..c3ecf36be 100644 --- a/doc/forum/Calendar:_listing_multiple_entries_per_day.mdwn +++ b/doc/forum/Calendar:_listing_multiple_entries_per_day.mdwn @@ -17,3 +17,5 @@ and a suitable whilst loop looks to be all that's needed... Any pointers appreciated. A [[!taglink patch]] has been proposed in [comment](#comment-d6f94e2b779d1c038b6359aad79ed14b) + +> This has been applied. --[[Joey]] diff --git a/doc/style.css b/doc/style.css index 424d43816..b52c72b6b 100644 --- a/doc/style.css +++ b/doc/style.css @@ -323,6 +323,7 @@ div.progress-done { .popup .paren, .popup .expand { display: none; + text-align: left; } .popup:hover .balloon, .popup:focus .balloon { diff --git a/doc/todo/Calendar:_listing_multiple_entries_per_day_.mdwn b/doc/todo/Calendar:_listing_multiple_entries_per_day_.mdwn index 94a4f1577..ba01790b3 100644 --- a/doc/todo/Calendar:_listing_multiple_entries_per_day_.mdwn +++ b/doc/todo/Calendar:_listing_multiple_entries_per_day_.mdwn @@ -90,3 +90,5 @@ Regards, } .popup:hover .balloon, .popup:focus .balloon { + +> [[applied|done]] --[[Joey]] -- 2.39.5