Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Talina06 committed Jul 7, 2014
1 parent 8dce8b3 commit 83c867d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
6 changes: 0 additions & 6 deletions lib/MetaCPAN/Web/Controller/Pod.pm
Expand Up @@ -17,15 +17,9 @@ sub root : Chained('/') PathPart('pod') CaptureArgs(0) {

sub stargazer : Chained('root') PathPart('') Args(1) {
my ( $self, $c, @path ) = @_;

# TODO: Pass size param so we can disambiguate?
my $user = $c->model('API::User')->get_profile( $c->token )->recv;
$c->stash( $c->model('API::Stargazer')->find_starred( $user, $path[0] ) );

$c->stash->{pod_file} = $c->model('API::Module')->find(@path)->recv;

# TODO: Disambiguate if there's more than once match. #176

$c->forward( 'view', [@path] );

}
Expand Down
14 changes: 7 additions & 7 deletions lib/MetaCPAN/Web/Model/API/User.pm
Expand Up @@ -6,40 +6,40 @@ extends 'MetaCPAN::Web::Model::API';

sub get {
my ( $self, $token ) = @_;
$self->request( "/user", undef, { token => $token } );
$self->request( '/user', undef, { token => $token } );
}

sub delete_identity {
my ( $self, $identity, $token ) = @_;
$self->request( "/user/identity/$identity", undef,
$self->request( '/user/identity/$identity', undef,
{ method => 'DELETE', token => $token } );
}

sub update_profile {
my ( $self, $data, $token ) = @_;
$self->request( "/user/profile", $data,
$self->request( '/user/profile', $data,
{ method => 'PUT', token => $token } );
}

sub get_profile {
my ( $self, $token ) = @_;
$self->request( "/user/profile", undef, { token => $token } );
$self->request( '/user/profile', undef, { token => $token } );
}

sub add_favorite {
my ( $self, $data, $token ) = @_;
$self->request( "/user/favorite", $data, { token => $token } );
$self->request( '/user/favorite', $data, { token => $token } );
}

sub remove_favorite {
my ( $self, $data, $token ) = @_;
$self->request( "/user/favorite/" . $data->{distribution},
$self->request( '/user/favorite/' . $data->{distribution},
undef, { method => 'DELETE', token => $token } );
}

sub add_stargazer {
my ( $self, $data, $token ) = @_;
$self->request( "/user/stargazer/", $data, { token => $token } );
$self->request( '/user/stargazer/', $data, { token => $token } );
}

sub remove_stargazer {
Expand Down
4 changes: 3 additions & 1 deletion root/inc/stargazer-table.html
@@ -1,10 +1,12 @@
<% IF stargazers.size %>
<!-- I still have to add the css for starring. As, it is similar to ++ i did not change the code here. -->
<table id="author_favorites"
<% IF tablesorter %>data-default-sort="<% default_sort || '0,0' %>"<% END %>
<!-- here as well. -->
class="table table-condensed table-striped table-favorites<% IF tablesorter %> tablesorter<% END %>">
<thead>
<tr>
<th class="release pull-left-phone"><% author ? "Favorites" : "Module" %></th>
<th class="release pull-left-phone"><% author ? "Starred Modules" : "Module" %></th>
<th class="abstract hidden-phone"><% author ? "Author" : "Starred By" %></th>
<th class="date"><% day || "Date" %></th>
</tr>
Expand Down

0 comments on commit 83c867d

Please sign in to comment.