Skip to content

Commit f3a745e

Browse files
authored
Merge pull request #3341 from metacpan/oalders/stars
oalders/stars
2 parents 1294326 + 0d3fc52 commit f3a745e

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

lib/MetaCPAN/Web/Model/ReleaseInfo.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ sub _fetch {
9595

9696
$data->{chat} = $self->_get_chat( $release, $dist );
9797
$data->{issues} = $self->_get_issues( $release, $dist );
98+
$data->{github} = $dist->{repo}->{github};
9899
$data->{repository} = $self->_get_repository( $release, $dist );
99100

100101
Future->done($data);

root/inc/favorite.tx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@
1010
<div class="show-logged-out">
1111
<button class="fav-not-logged-in favorite[% if $favorites { %] highlight[% } %]"><span>[% $favorites %]</span> ++</button>
1212
</div>
13+
%% if $github && $repository.url {
14+
<div class="star-rating">
15+
<a href="[% $repository.url %]" target="_blank" class="btn btn-primary" title="View on GitHub">
16+
⭐ Starred <span>[% $github.stars %]</span>
17+
<span class="sr-only">GitHub stars</span>
18+
</a>
19+
</div>
20+
%% }

root/static/less/global.less

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,10 @@ a.favorite {
110110
display: inline-block;
111111
line-height: 1;
112112
text-align: right;
113-
min-width: 25px;
114113
position: relative;
115-
top: -1px;
116114
font-size: @font-size-base;
117115
font-weight: normal;
116+
height: 100%;
118117
min-width: 35px;
119118
cursor: pointer;
120119

@@ -236,6 +235,30 @@ a.ellipsis:hover * {
236235
margin-bottom: 1px;
237236
}
238237

238+
.star-rating {
239+
& a.btn.btn-primary {
240+
padding: 1px 3px;
241+
font-size: 0.9em;
242+
background: #f0f0f0 linear-gradient(to bottom, #fbfbfb, #f0f0f0);
243+
color: #000;
244+
min-width: 25px;
245+
position: relative;
246+
font-size: @font-size-base;
247+
font-weight: normal;
248+
min-width: 35px;
249+
border-color: #e0e0e0;
250+
line-height: 1.54em;
251+
252+
&:hover {
253+
background: #36c linear-gradient(to bottom, #69f, #36c);
254+
color: #fff;
255+
border-color: #36c;
256+
opacity: 1;
257+
text-decoration: none;
258+
}
259+
}
260+
}
261+
239262
/* Contributors list on release pages
240263
* see /release/Plack for example
241264
*/

0 commit comments

Comments
 (0)