Skip to content

Commit b09f830

Browse files
committed
author wip
1 parent 28b996a commit b09f830

File tree

4 files changed

+177
-141
lines changed

4 files changed

+177
-141
lines changed

lib/MetaCPAN/Web/Controller/Author.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ sub index : Chained('root') PathPart('') Args(0) {
6767
faves => $faves,
6868
releases => $releases->{releases},
6969
profiles => $profiles,
70-
template => 'author.html',
7170
took => $took,
7271
total => $releases->{total},
72+
current_view => 'Xslate',
73+
template => 'author.tx',
7374
} );
7475

7576
$c->stash( author_country_name =>
@@ -108,6 +109,7 @@ sub releases : Chained('root') PathPart Args(0) {
108109
total => $releases->{total},
109110
releases => $releases->{releases},
110111
pageset => $pageset,
112+
current_view => 'Xslate',
111113
} );
112114

113115
return unless $releases->{total};

root/author.html

Lines changed: 0 additions & 140 deletions
This file was deleted.

root/author.tx

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
%% cascade base {
2+
%% title => $author.name ~ ' (' ~ $author.pauseid ~ ')',
3+
%% rss => 'author/' ~ $author.pauseid,
4+
%% rss_title => 'Recent CPAN Activity of ' ~ $author.pauseid ~ ' - MetaCPAN',
5+
%% twitter_card_inc => 'inc/twitter/author.tx',
6+
%% }
7+
%% override left_nav_content -> {
8+
<li class="hidden-phone">[% include inc::author_pic %]</li>
9+
<li class="nav-header">Email</li>
10+
<li>
11+
<a href="mailto:[% $author.email.0 %]" class="ellipsis" title="[% $author.email.0 %]">[% $author.email.0 %]</a>
12+
</li>
13+
%% if $author.website.size() {
14+
<li class="nav-header">Website</li>
15+
%% for $author.website -> $website {
16+
<li>
17+
<a rel="me noopener nofollow" href="[% $website %]" title="[% $website %]" target="_blank">[% $website.decode_punycode() %]</a>
18+
</li>
19+
%% } }
20+
%% if $author.profile.size() {
21+
<li class="nav-header">Profiles</li>
22+
<div class="user-profiles">
23+
%% for $author.profile.sort(-> $a, $b { $a.name cmp $b.name }) -> $profile {
24+
%% my $known = $profiles[$profile.name];
25+
%% if $known {
26+
<a rel="me noopener nofollow" href="[% $known.url_format.sprintf($profile.id) %]" target="_blank" title="[% $known.name %] - [% $profile.id %]">
27+
<img src="[% $known.icon %]" width="16" height="16" alt="[% $known.name %]">
28+
</a>
29+
%% }
30+
%% }
31+
</div>
32+
%% }
33+
%% if $author.country || $author.city || $author.region {
34+
<li class="nav-header">Location</li>
35+
%% if $author.country {
36+
<img src="/static/images/flag/[% $author.country | lc %].png" alt="[% $author_country_name %]" title="[% $author_country_name %]" width=16 height=11> &nbsp;
37+
%% }
38+
[% $author.city %][% if $author.city && $author.region { %], [% } %][% $author.region %]
39+
%% }
40+
%% if $author.blog.size() {
41+
<li class="nav-header">Blog</li>
42+
%% for $author.blog -> $blog {
43+
<li>
44+
%% if $blog.feed {
45+
<a rel="noopener nofollow" href="[% $blog.feed %]" target="_blank">
46+
<img src="/static/images/profile/feed.png" width=16 height=16 style="float: right">
47+
</a>
48+
%% }
49+
<a rel="noopener nofollow" href="[% $blog.url %]" title="[% $blog.url %]" target="_blank" class="ellipsis" style="width: 140px">
50+
[% $blog.url.replace(rx("^https?://"), '') %]
51+
</a>
52+
</li>
53+
%% }
54+
%% }
55+
%% for $author.donation -> $donate { if $donate.id {
56+
%% if $donate.name == 'paypal' {
57+
<li class="author-donate">
58+
<center>
59+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
60+
<input type="hidden" name="cmd" value="_donations">
61+
<input type="hidden" name="business" value="[% $donate.id %]">
62+
<input type="hidden" name="lc" value="US">
63+
<input type="hidden" name="item_name" value="Donation to CPAN Author [% $author.pauseid %] via MetaCPAN">
64+
<input type="hidden" name="no_note" value="0">
65+
<input type="hidden" name="currency_code" value="USD">
66+
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_SM.gif:NonHostedGuest">
67+
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" style="width: auto">
68+
</form>
69+
</center>
70+
</li>
71+
%% }
72+
%% else if $donate.name == 'wishlist' {
73+
<li class="author-donate">
74+
<a rel="me noopener nofollow" href="[% $donate.id %]" target="_blank">Wishlist</a>
75+
</li>
76+
%% }
77+
%% } }
78+
<li class="nav-header">Activity</li>
79+
<li>[% include inc::activity { query => 'author=' ~ $author.pauseid } %]</li>
80+
%% if $latest.date {
81+
<li class="nav-header">Latest Release</li>
82+
<li>
83+
<div>
84+
<a href="/release/[% if $latest.status == 'latest' { $latest.distribution } else { $latest.author ~ '/' ~ $latest.name } %]" class="ellipsis" title="[% $latest.name %]">
85+
[% $latest.name %]
86+
</a>
87+
</div>
88+
</li>
89+
<li>
90+
<div>
91+
<span class="relatize">[% datetime($latest.date).to_http %]</span>
92+
</div>
93+
</li>
94+
%% }
95+
<li>
96+
<div>
97+
<a href="/author/[% $author.pauseid %]/releases">All releases by this author</a>
98+
</div>
99+
</li>
100+
<li class="nav-header">Tools</li>
101+
<li>
102+
Search distributions:<br>
103+
</li>
104+
<li class="toolbar-search-form">
105+
<form action="/search">
106+
<input type="hidden" name="q" value="author:[% $author.pauseid %]">
107+
<input type="text" name="q" class="form-control tool-bar-form">
108+
<input type="submit" style="display: none">
109+
</form>
110+
</li>
111+
<li>
112+
<a href="[% $author.links.cpantesters_reports %]">CPANTesters Reports</a>
113+
<a href="[% $author.links.cpantesters_matrix %]" title="Matrix">
114+
<i class="icon-grid"></i>
115+
</a>
116+
</li>
117+
<li>
118+
<a href="[% $author.links.cpants %]">CPANTS</a>
119+
</li>
120+
<li>
121+
<a href="[% $author.links.metacpan_explorer %]">MetaCPAN Explorer</a>
122+
</li>
123+
<li>
124+
<a href="[% $author.links.cpan_directory %]">CPAN directory</a> ([% $author.release_count.cpan + $author.release_count.latest %])
125+
</li>
126+
<li>
127+
<a href="/permission/author/[% $author.pauseid %]">Module permissions</a>
128+
</li>
129+
<li>
130+
<a href="[% $author.links.backpan_directory %]" title="See all releases ever done by [% $author.pauseid %], not just those currently on CPAN.">BackPAN directory</a> ([% $author.release_count['backpan-only'] %])
131+
</li>
132+
%% }
133+
%% override content -> {
134+
<div class="content">
135+
<div id="feed_subscription" class="page-header">
136+
<p>[% if $releases.0 { $releases.size() } else { 'No' } %] distributions uploaded by <span class="author-name">[% $author.name %]</span> ([% $author.pauseid %])</p>
137+
<a href="/feed/author/[% $author.pauseid %]"><i class="fa fa-rss fa-2x black"></i></a>
138+
</div>
139+
<div class="visible-xs inline-author-pic">[% include inc::author_pic %]</div>
140+
%% if $releases.0 {
141+
%% include inc::release_table { header => 1, tablesorter => 1, table_id => 'author_releases' }
142+
%% }
143+
%% else {
144+
<div class="message">
145+
<strong>Releases</strong>
146+
<p>No releases from <a href="/author/[% $author.pauseid %]">[% $author.pauseid %]</a> could be found
147+
%% if $author.release_count["backpan-only"] {
148+
<br/><a href="/author/[% $author.pauseid %]">[% $author.pauseid %]</a> has <a href="[% $author.links.backpan_directory %]">[% $author.release_count["backpan-only"] %] distributions on BackPAN</a> that were previously on CPAN.
149+
%% }
150+
</p>
151+
</div>
152+
%% }
153+
%% if $faves.0 {
154+
%% include inc::favorite_table { favorites => $faves, author => 1, tablesorter => 1 }
155+
%% }
156+
%% else {
157+
<div class="message">
158+
<strong>Favorites</strong>
159+
<p>No favorite distributions from <a href="/author/[% $author.pauseid %]">[% $author.pauseid %]</a> could be found</p>
160+
</div>
161+
%% }
162+
</div>
163+
%% }

root/inc/twitter/author.tx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<meta name="twitter:card" content="summary" />
2+
<meta name="twitter:url" content="[% $page_url %]" />
3+
<meta name="twitter:title" content="[% $author.name %]" />
4+
<meta name="twitter:description" content="CPAN Author" />
5+
<meta name="twitter:site" content="metacpan" />
6+
%% for $author.profile -> $profile {
7+
%% if $profile.name == "twitter" {
8+
<meta name="twitter:creator" content="[% $profile.id %]" />
9+
%% }
10+
%% }
11+
<meta name="twitter:image" content="[% gravatar_image($author, 400) %]" />

0 commit comments

Comments
 (0)