Permalink
Browse files

Merge branch 'develop' of github.com:toronto-perl-mongers/tpm-website…

… into develop
  • Loading branch information...
2 parents 096fc3a + 10346ec commit 73d6dc1fd0a269368b7295eed5fce2769a56ae0e @ioncache ioncache committed Feb 24, 2012
Showing with 39 additions and 14 deletions.
  1. +1 −0 Makefile.PL
  2. +27 −7 lib/TorontoPerlMongers.pm
  3. +3 −3 lib/TorontoPerlMongers/Model/Meetings.pm
  4. +1 −0 urls.txt
  5. +1 −1 views/contact.tt
  6. +2 −3 views/index.tt
  7. +4 −0 views/layouts/main.tt
View
@@ -20,6 +20,7 @@ WriteMakefile(
'Dancer::Template::Alloy' => 0,
'Moose' => 0,
'XML::Simple' => 0,
+ 'DateTime' => 0,
'DateTime::Format::ISO8601' => 0,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
View
@@ -4,30 +4,50 @@ use Dancer::Plugin::Feed;
our $VERSION = '0.1';
+use DateTime;
use TorontoPerlMongers::Model::Meetings;
my $meetings = TorontoPerlMongers::Model::Meetings->new();
$meetings->load("data/meetings");
get qr{/feed/?} => sub {
- my $feed = create_feed(
- entries => [],
+
+ # template('meeting', { meeting => $_ }, { layout => undef } )
+ # title, link, summary, content, author, issued and modified
+ my $feed = create_feed(
+ entries => map {
+ +{
+ link => uri_for( '/meetings/' . $_->id() ),
+ issued => $_->details()->datetime
+ ? $_->details()->datetime
+ : '',
+ title => $_->label(),
+ content => template(
+ 'meeting', { meeting => $_, hide_layout => undef }
+ ),
+ }
+ } @{ $meetings->ordered_meetings() }
);
- return $feed;
+ return $feed;
};
get '/meetings/:meeting' => sub {
my $id = params->{meeting};
- my ($meeting) = grep { $_->id() == $id } @{$meetings->meetings()} or die("Can't find meeting: $id");
- template 'meeting', { meeting => $meeting };
+ my ($meeting) = grep { $_->id() == $id } @{ $meetings->meetings() }
+ or die("Can't find meeting: $id");
+ template 'meeting', { meeting => $meeting };
};
get qr{/meetings/?} => sub {
template 'meetings', { meetings => $meetings };
-};
+};
get '/' => sub {
- template 'index', { meetings => $meetings };
+ my $meeting = $meetings->ordered_meetings->[0];
+ my $next_or_last = DateTime->compare($meeting->details->datetime, DateTime->now) <= 0
+ ? 'Last'
+ : 'Next';
+ template 'index', { meeting => $meeting, next_or_last => $next_or_last };
};
true;
@@ -23,10 +23,10 @@ sub load {
sub _wanted {
my ($self, $file) = @_;
-
+
my $meeting = TorontoPerlMongers::Model::Meeting->new();
$meeting->load($file);
-
+
my $meetings = $self->meetings() // [];
$self->meetings([@$meetings, $meeting]);
}
@@ -36,4 +36,4 @@ sub ordered_meetings {
return [ sort { $b->details()->datetime()->compare($a->details()->datetime()) } @{$self->meetings()} ];
}
-1;
+1;
View
@@ -6,3 +6,4 @@
/images/perldancer-bg.jpg
/images/perldancer.jpg
/javascripts/jquery.js
+/feed
View
@@ -14,7 +14,7 @@
<a href="http://www.perl.org/">The Perl Programming Language</a>
</li>
<li>
- irc.perl.org: #tpm
+ <a href="irc://irc.perl.org">IRC: irc.perl.org #tpm</a>
</li>
</ul>
View
@@ -3,12 +3,11 @@
<p>The Toronto Perl Mongers is a group of Perl programmers and hackers of all levels who get together to talk about Perl. Perl is a programming language which can be used for a large variety of tasks. A typical simple use of Perl would be for extracting information from a text file and printing out a report or for converting a text file into another form. But Perl provides a large number of tools for quite complicated problems, including systems programming and scientific research.</p>
-<h2>Latest Meeting</h2>
-[% meeting = meetings.ordered_meetings.0 %]
+<h2>[% next_or_last | html %] Meeting</h2>
<ul>
<li>
- <a href="[% meeting.id %]">
+ <a href="/meetings/[% meeting.id %]">
[% meeting.details.datetime.strftime('%d %B %Y') %] - [% meeting.label %]
</a>
</li>
View
@@ -1,3 +1,6 @@
+[% IF hide_layout %]
+ [% content %]
+[% ELSE %]
<!DOCTYPE html>
<html>
@@ -77,3 +80,4 @@
</body>
</html>
+[% END %]

0 comments on commit 73d6dc1

Please sign in to comment.