Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add individual person page.

  • Loading branch information...
commit d3d8b81fccdfc2ecab62dc9f5a4002a5029ca5ad 1 parent 04c188a
@norm authored
View
16 lib/PubStandards/Chapter.pm
@@ -123,6 +123,22 @@ method get_all_people {
return $results->{'data'};
}
+method get_photos_of_person ( Str $nsid ) {
+ say "-> $nsid";
+
+ my( $results, $more ) = $self->query_view(
+ $self->get_name(),
+ 'photo_by_person',
+ {
+ limit => 200,
+ key => qq("$nsid"),
+ include_docs => 'true',
+ }
+ );
+
+ return $results->{'data'};
+}
+
method get_document_by_slug ( Str $slug! ) {
return $self->query_view_for_key(
$self->get_name(),
View
19 lib/PubStandards/Views.pm
@@ -25,6 +25,10 @@ method handle_view ( $request! ) {
when ( '/people/' ) {
return $self->render_people_list();
}
+ when ( m{^ /people/ ( [a-z0-9_-]+ ) $}x ) {
+ my $name = $1;
+ return $self->render_person( $name );
+ }
when ( m{^ / ( [a-z0-9_-]+ ) $}x ) {
my $slug = $1;
my $doc = $self->get_document_by_slug( $slug );
@@ -93,6 +97,21 @@ method render_people_list {
return $self->render_html_response( $template, \%data );
}
+method render_person ( $name ) {
+ my $ps = $self->get_parent();
+ my $doc = $ps->get_document( "person_$name" );
+
+ if ( defined $doc ) {
+ my $template = $self->get_template( 'person' );
+
+ # TODO - events appeared at
+ $doc->{'photos'} = $self->get_photos_of_person( $doc->{'nsid'} );
+
+ return $self->render_html_response( $template, $doc )
+ }
+
+ return $self->render_404();
+}
method render_404 () {
my $template = $self->get_template( '404' );
return $self->render_html_response( $template, {}, 404 );
View
13 site/london.css
@@ -161,10 +161,23 @@ p#date-held {
margin-bottom: 0.4em;
}
+#person #photos,
#event #photos {
margin-top: 2em;
}
+#person .twitter {
+ margin-top: -2em;
+ font-weight: bold;
+}
+#person .twitter a {
+ color: #690;
+}
+#person .twitter a:hover,
+#person .twitter a:focus {
+ color: #fff;
+}
+
#photos li {
float: left;
margin-right: 5px;
View
1  templates/person/bodyid.html
@@ -0,0 +1 @@
+id='person'
View
18 templates/person/content.html
@@ -0,0 +1,18 @@
+<p class='twitter'><a href='http://twitter.com/${twitter}'>@${twitter}</a></p>
+<p>${description}</p>
+
+<img src='${photo}'>
+
+${include photo_list}
+
+
+<div class='advisory'>
+ <h3>Wait ... where are my photos?</h3>
+ <p>
+ Photos of you at Pub Standards not showing up? Make sure that the
+ <i>People in this photo</i> section of each photo has you in it. See
+ <a href='http://blog.flickr.net/en/2009/10/21/people-in-photos/'>flickr
+ for more information</a>.
+ </p>
+ <p>Photos are reindexed weekly.</p>
+</div>
View
2  templates/person/h2.html
@@ -0,0 +1,2 @@
+<h2>${name}</h2>
+
View
1  templates/person/title.html
@@ -0,0 +1 @@
+<title>London Pub Standards &mdash; ${name}</title>
Please sign in to comment.
Something went wrong with that request. Please try again.