calendar: When there are multiple pages for a given day, they're displayed in a popup on mouseover. Thanks, Louis

master
Joey Hess 2013-06-23 14:11:39 -04:00
parent c037714b77
commit b8d65da266
5 changed files with 44 additions and 7 deletions

View File

@ -86,8 +86,10 @@ sub format_month (@) {
my $year = $date[5] + 1900; my $year = $date[5] + 1900;
my $mtag = sprintf("%02d", $month); my $mtag = sprintf("%02d", $month);
# Only one posting per day is being linked to. if (! $linkcache{"$year/$mtag/$mday"}) {
$linkcache{"$year/$mtag/$mday"} = $p; $linkcache{"$year/$mtag/$mday"} = [];
}
push(@{$linkcache{"$year/$mtag/$mday"}}, $p);
} }
my $pmonth = $params{month} - 1; my $pmonth = $params{month} - 1;
@ -221,11 +223,38 @@ EOF
$tag='month-calendar-day-link'; $tag='month-calendar-day-link';
} }
$calendar.=qq{\t\t<td class="$tag $downame{$wday}">}; $calendar.=qq{\t\t<td class="$tag $downame{$wday}">};
$calendar.=htmllink($params{page}, $params{destpage}, if (scalar(@{$linkcache{$key}}) == 1) {
$linkcache{$key}, # Only one posting on this page
noimageinline => 1, my $page = $linkcache{$key}[0];
linktext => $day, $calendar.=htmllink($params{page}, $params{destpage},
title => pagetitle(IkiWiki::basename($linkcache{$key}))); $page,
noimageinline => 1,
linktext => $day,
title => pagetitle(IkiWiki::basename($page)));
}
else {
$calendar.=qq{<div class='popup'>$day<div class='balloon'>};
# Several postings on this page
$calendar.=qq{<ul>};
foreach my $page (@{$linkcache{$key}}) {
$calendar.= qq{\n\t\t\t<li>};
my $title;
if (exists $pagestate{$page}{meta}{title}) {
$title = "$pagestate{$page}{meta}{title}";
}
else {
$title = pagetitle(IkiWiki::basename($page));
}
$calendar.=htmllink($params{page}, $params{destpage},
$page,
noimageinline => 1,
linktext => $title,
title => $title);
$calendar.= '</li>';
}
$calendar.=qq{\n\t\t</ul>};
$calendar.=qq{</div></div>};
}
$calendar.=qq{</td>\n}; $calendar.=qq{</td>\n};
} }
else { else {

3
debian/changelog vendored
View File

@ -5,6 +5,9 @@ ikiwiki (3.20130519) UNRELEASED; urgency=low
* comments: The formats allowed to be used in comments can be configured * comments: The formats allowed to be used in comments can be configured
using comments_allowformats. using comments_allowformats.
Thanks, Michal Sojka 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 <joeyh@debian.org> Sun, 23 Jun 2013 14:02:01 -0400 -- Joey Hess <joeyh@debian.org> Sun, 23 Jun 2013 14:02:01 -0400

View File

@ -17,3 +17,5 @@ and a suitable whilst loop looks to be all that's needed...
Any pointers appreciated. Any pointers appreciated.
A [[!taglink patch]] has been proposed in [comment](#comment-d6f94e2b779d1c038b6359aad79ed14b) A [[!taglink patch]] has been proposed in [comment](#comment-d6f94e2b779d1c038b6359aad79ed14b)
> This has been applied. --[[Joey]]

View File

@ -323,6 +323,7 @@ div.progress-done {
.popup .paren, .popup .paren,
.popup .expand { .popup .expand {
display: none; display: none;
text-align: left;
} }
.popup:hover .balloon, .popup:hover .balloon,
.popup:focus .balloon { .popup:focus .balloon {

View File

@ -90,3 +90,5 @@ Regards,
} }
.popup:hover .balloon, .popup:hover .balloon,
.popup:focus .balloon { .popup:focus .balloon {
> [[applied|done]] --[[Joey]]