Permalink
Browse files

separate the events route to fill it with some text

  • Loading branch information...
1 parent b488bab commit cd168d2bfdd52a421b5e8f0d4264df9adb0f5243 @szabgab committed Mar 6, 2011
Showing with 36 additions and 19 deletions.
  1. +34 −18 lib/PEG.pm
  2. +2 −1 views/events.tt
View
@@ -57,8 +57,10 @@ get qr{^ / (?: index \. html )? $}x => sub {
};
my @pages = qw{
- what why who sponsors members events contact
- membership benefits about news earlier_events mailing_lists
+ what why who sponsors members contact
+ membership benefits about earlier_events mailing_lists
+
+ news
news/grants-to-invite-speakers-to-non-perl-events
news/announcement-and-public-discussion-lists
events/fosdem_2011
@@ -76,6 +78,11 @@ get qr{^ / ([\w/-]+) $ }x => sub {
template $page => _content->{$page};
};
+get '/events' => sub {
+ my @events = map {$_->{text} = _event_text($_); $_} @{ _content->{events}{events} };
+
+ template 'events' => {events => \@events};
+};
get '/calendar' => sub {
@@ -155,22 +162,7 @@ sub _rss {
$text =~ s{"/}{"$base/}g;
if ($name eq 'events') {
- if ($n->{days} == 1) {
- $text = "On $n->{date}";
- } else {
- $text = "starting on $n->{date} for $n->{days} days";
- }
-
- $text .= "<br />";
- if ($n->{url}) {
- $text .= qq{ <a href="$n->{url}">$n->{title}</a><br /> };
- }
- if ($n->{wiki}) {
- $n->{wiki} =~ s/ /_/g;
- my $wiki = "http://perlfoundation.org/perl5/$n->{wiki}";
- $text .= qq{ Presence is being organized on the <a href="$wiki">wiki</a><br /> };
- }
- $text .= " Location: $n->{address}<br />";
+ $text = _event_text($n);
}
$rss->add_item(
@@ -192,4 +184,28 @@ sub _rss {
return $rss->as_string;
};
+sub _event_text {
+ my ($n) = @_;
+
+ my $text = '';
+ if ($n->{days} == 1) {
+ $text = "On $n->{date}";
+ } else {
+ $text = "starting on $n->{date} for $n->{days} days";
+ }
+
+ $text .= "<br />";
+ if ($n->{url}) {
+ $text .= qq{ <a href="$n->{url}">$n->{title}</a><br /> };
+ }
+ if ($n->{wiki}) {
+ $n->{wiki} =~ s/ /_/g;
+ my $wiki = "http://perlfoundation.org/perl5/$n->{wiki}";
+ $text .= qq{ Presence is being organized on the <a href="$wiki">wiki</a><br /> };
+ }
+ $text .= " Location: $n->{address}<br />";
+ return $text;
+}
+
+
true;
View
@@ -16,7 +16,8 @@ See information about the <a href="/earlier_events">earlier events</a>.
<div id="schedule">
<ul>
<% FOR e IN events %>
-<li><ul><li><% e.date %></li><li><% e.title %>, <% e.address %></li></ul></li>
+<li><ul><li><% e.date %></li><li><% e.title %>, <% e.address %><br />
+ <% e.text %></li></ul></li>
<% END %>
</ul>
</div>

0 comments on commit cd168d2

Please sign in to comment.