From: Jess Robinson Date: Mon, 21 May 2012 10:49:49 +0000 (+0000) Subject: Show traditions based on the current logged-in user X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7c2568180baa0721b119d3a3a265a6e32b359024;p=scpubgit%2Fstemmatology.git Show traditions based on the current logged-in user --- diff --git a/stemmaweb/lib/stemmaweb/Controller/Root.pm b/stemmaweb/lib/stemmaweb/Controller/Root.pm index 6610705..a3505f5 100644 --- a/stemmaweb/lib/stemmaweb/Controller/Root.pm +++ b/stemmaweb/lib/stemmaweb/Controller/Root.pm @@ -41,15 +41,17 @@ sub index :Path :Args(0) { GET /directory -Serves a snippet of HTML that lists the available texts. Eventually this will be available texts by user. +Serves a snippet of HTML that lists the available texts. This returns texts belonging to the logged-in user if any, otherwise it returns all public texts. =cut + sub directory :Local :Args(0) { my( $self, $c ) = @_; my $m = $c->model('Directory'); # TODO not used yet, will load user texts later - my $user = $c->request->param( 'user' ) || 'ALL'; - my @textlist = $m->traditionlist(); + my $user = $c->user_exists ? $c->user->id : 'public'; +# my $user = $c->request->param( 'user' ) || 'ALL'; + my @textlist = $m->traditionlist($user); $c->stash->{texts} = \@textlist; $c->stash->{template} = 'directory.tt'; }