Skip to content

Commit

Permalink
got rid of URI::Query
Browse files Browse the repository at this point in the history
  • Loading branch information
monken committed Jul 23, 2011
1 parent 30e3ba1 commit e875fea
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
1 change: 0 additions & 1 deletion dist.ini
Expand Up @@ -36,5 +36,4 @@ Template::Plugin::JSON = 0
Template::Plugin::Number::Format = 0
Template::Plugin::Page = 0
Test::XPath = 0.15
URI::Query = 0
XML::Feed = 0
9 changes: 0 additions & 9 deletions lib/MetaCPAN/Web/Role/Request.pm
@@ -1,17 +1,8 @@
package MetaCPAN::Web::Role::Request;

use Moose::Role;
use URI::Query;
use Plack::Session;

sub query_string_with {
my $self = shift;
my $params = shift;
my $qq = URI::Query->new( $self->parameters );
$qq->replace(%$params);
return $qq->stringify;
}

sub page {
my $page = shift->parameters->{p};
return $page && $page =~ /^\d+$/ ? $page : 1;
Expand Down
6 changes: 3 additions & 3 deletions root/inc/pager.html
@@ -1,14 +1,14 @@
<%- USE pager = Page(size, page); pager.total_entries(total); IF pager.last_page > 1 %>
<div class="pager">
<%- IF pager.previous_page %>
<a href="?<% req.query_string_with( p = pager.previous_page ) %>"><strong>Previous</strong></a>&nbsp;&nbsp;&nbsp;
<a href="<% c.req.uri_with( p = pager.previous_page ) %>"><strong>Previous</strong></a>&nbsp;&nbsp;&nbsp;
<% END %>
<% FOREACH p IN [page - 10 .. [page + 10, pager.last_page].nsort.0 ];
IF p < 1; NEXT; END;
IF p == page %><strong><% p %></strong><% ELSE %>
<a href="?<% req.query_string_with( p = p ) %>"><% p %></a> <% END; END %>
<a href="<% c.req.uri_with( p = p ) %>"><% p %></a> <% END; END %>
<% IF pager.next_page %>&nbsp;&nbsp;&nbsp;
<a href="?<% req.query_string_with( p = pager.next_page ) %>"><strong>Next</strong></a>
<a href="<% c.req.uri_with( p = pager.next_page ) %>"><strong>Next</strong></a>
<% END %>
</div>
<% END %>

0 comments on commit e875fea

Please sign in to comment.