]> sipb.mit.edu Git - ikiwiki.git/commitdiff
calendar: When there are multiple pages for a given day, they're displayed in a popup...
authorJoey Hess <joey@kitenet.net>
Sun, 23 Jun 2013 18:11:39 +0000 (14:11 -0400)
committerJoey Hess <joey@kitenet.net>
Sun, 23 Jun 2013 18:11:39 +0000 (14:11 -0400)
IkiWiki/Plugin/calendar.pm
debian/changelog
doc/forum/Calendar:_listing_multiple_entries_per_day.mdwn
doc/style.css
doc/todo/Calendar:_listing_multiple_entries_per_day_.mdwn

index d443198f69618f28e37821766731b50bc2599306..8ca6dd82680171d8ebae5f88ac9053c327e0ad3d 100644 (file)
@@ -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<td class="$tag $downame{$wday}">};
-                       $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{<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};
                }
                else {
index b9b46be3d840b5439a36b91996fd2b3f407f9255..10e0e84ffc8e9836bcff7bf645192c66f4861105 100644 (file)
@@ -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 <joeyh@debian.org>  Sun, 23 Jun 2013 14:02:01 -0400
 
index 251cd6d9f9cfb22e5c92651dce6f02a426308316..c3ecf36bece9652c39df300cda6e13b408f0a7f8 100644 (file)
@@ -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]]
index 424d438167dd9ee5272ec55971f261515a4d95ff..b52c72b6b694913394c77fad256b6b93d565ff5f 100644 (file)
@@ -323,6 +323,7 @@ div.progress-done {
 .popup .paren,
 .popup .expand {
        display: none;
+       text-align: left;
 }
 .popup:hover .balloon,
 .popup:focus .balloon {
index 94a4f1577c5f70b3ff1351f0e0e3368635c31b5a..ba01790b3b87f3b76d922289ec33e9091780352e 100644 (file)
@@ -90,3 +90,5 @@ Regards,
      }
      .popup:hover .balloon,
      .popup:focus .balloon {
+
+> [[applied|done]] --[[Joey]]