Permalink
Browse files

More work moving cpanratings to leo-layout

  • Loading branch information...
1 parent 63b7dd2 commit 6b5c8a34602d812a341b27460047ae6682fa7784 @abh abh committed Sep 20, 2012
@@ -12,10 +12,7 @@
page.banner_prefix = page.site;
page.style = 'leo.html';
-
- page.sidebar = BLOCK;
- PROCESS tpl/navigation.html;
- END;
+ page.section = 'onion';
PROCESS tpl/quicknews;
@@ -0,0 +1,23 @@
+[%
+ FILTER navigation_class(combust.request.path) %]
+<ul>
+ <li>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/search">Search</a>
+ </li>
+ <li>
+ <a href="/about.html">About</a>
+ </li>
+ <li>
+ <a href="[% combust.account_url | html %]">Bitcard Account</a>
+ </li>
+ <li>
+ <a id="login_link" class="login" href="[% combust.login_url | html %]">Login</a>
+ </li>
+</ul>
+[% END %]
+
+
+
@@ -1,11 +0,0 @@
-[%
- FILTER navigation(combust.request.path) %]
- <a href="/">Home</a> |
- <a href="/search">Search</a> |
- <a href="/about.html">About</a> |
- <a href="[% combust.account_url | html %]">Bitcard Account</a> |
- <a id="login_link" class="login" href="[% combust.login_url | html %]">Login</a>
-[% END %]
-
-
-
@@ -1,6 +1,10 @@
h3.review_header { margin-top: 0em; margin-bottom: 0.25em; }
+#page_image {
+ background: transparent url([% combust.static_url("/images/icons/community.png") %]) no-repeat left top;
+}
+
#twitter { float: right; width: 300px; }
div.review { margin-top: 1.5em; }
View
@@ -6,6 +6,7 @@ use CPANRatings::Schema;
use Digest::SHA qw(sha1_hex);
use Encode qw();
use Combust::Constant qw(OK);
+use PerlOrg::Template::Filters;
use XML::RSS;
has schema => (
@@ -18,6 +19,17 @@ sub _build_schema {
return CPANRatings::Schema->new;
}
+my $ctemplate;
+
+sub tt {
+ my $self = shift;
+ return $ctemplate ||= Combust::Template->new(
+ filters =>
+ {'navigation_class' => [\&PerlOrg::Template::Filters::navigation_filter_factory, 1],},
+ @_
+ ) or die "Could not initialize Combust::Template object: $Template::ERROR";
+}
+
sub init {
my $self = shift;
$self->bc_check_login_parameters;
@@ -0,0 +1,21 @@
+package PerlOrg::Template::Filters;
+use strict;
+
+sub navigation_filter_factory {
+ my ($context, $uri) = @_;
+
+ return sub {
+ my $text = shift;
+ return $text unless $uri;
+ $uri =~ s!/?index(?:\.html)?$!/!;
+
+ # why is this here? -- need to write some tests for this... made
+ # it work by adding a /? below.
+ $uri =~ s!/$!!;
+
+ $text =~ s{(<li>)\s*(<a href="\Q$uri\E/?">(.+?)</a>)}{<li class="selected">$2}i;
+ return $text;
+ }
+}
+
+1;

0 comments on commit 6b5c8a3

Please sign in to comment.