Skip to content

Commit

Permalink
Merge pull request #1736 from CPAN-API/topic/link-etc-cleanup
Browse files Browse the repository at this point in the history
Link etc cleanup
  • Loading branch information
mickeyn committed Jun 21, 2016
2 parents 1129337 + d54d3dd commit 9e4d03d
Show file tree
Hide file tree
Showing 26 changed files with 84 additions and 72 deletions.
5 changes: 3 additions & 2 deletions lib/MetaCPAN/Web/Model/API/Changes.pm
Expand Up @@ -32,8 +32,9 @@ sub last_version {

my @releases = sort { $b->[0] <=> $a->[0] }
map {
my $v = $_->{version} =~ s/-TRIAL$//r;
my $dev = $_->{version} =~ /_|-TRIAL$/ || $_->{note} =~ /\bTRIAL\b/;
my $v = $_->{version} =~ s/-TRIAL$//r;
my $dev = $_->{version} =~ /_|-TRIAL$/
|| $_->{note} && $_->{note} =~ /\bTRIAL\b/;
[ version->parse($v), $v, $dev, $_ ];
} @$releases;

Expand Down
6 changes: 3 additions & 3 deletions root/about/faq.html
Expand Up @@ -94,8 +94,8 @@

### Trying to connect PAUSE just gives you JSON and doesn't work?

It is possible to get your account into an inconsistent state where it won't
connect to PAUSE - particularly if you've connected via multiple identities,
It is possible to get your account into an inconsistent state where it won't
connect to PAUSE - particularly if you've connected via multiple identities,
and/or using multiple browsers.

To fix this:
Expand All @@ -105,7 +105,7 @@
3. Reconnect via one identity
4. Connect to PAUSE

Make sure that you use the same browser for all of the steps - including
Make sure that you use the same browser for all of the steps - including
opening the link in the email from MetaCPAN.

### Favorites not displaying on author page?
Expand Down
2 changes: 1 addition & 1 deletion root/about/sponsors.html
Expand Up @@ -177,7 +177,7 @@
<p>MetaCPAN.org (the search site) probably would not exist
if it weren't for Google. This site was originally built
as a layer on top of the MetaCPAN API by <a
href="https://metacpan.org/author/PERLER">Moritz Onken</a>
href="/author/PERLER">Moritz Onken</a>
as part of his Google Summer of Code (GSoC) project. In
2014 GSoC also sponsored Talina Shrotriya's work on
MetaCPAN. We're not actually sure if we're allowed to use
Expand Down
2 changes: 1 addition & 1 deletion root/account/identities.html
Expand Up @@ -25,4 +25,4 @@ <h4><strong>Information</strong></h4>
</tr>
<%- END %>
</table>
</div>
</div>
2 changes: 1 addition & 1 deletion root/account/login.html
Expand Up @@ -8,4 +8,4 @@
<% END %>

</table>
</div>
</div>
2 changes: 1 addition & 1 deletion root/account/settings.html
Expand Up @@ -4,4 +4,4 @@
<label><input type="checkbox" name="show_pod" />Hide POD in source view</label>
<label>Sort order of releases in author view <select><option>Name ascending</option><option>Name descending</option><option>Date ascending</option><option>Date descending</option></select></label>
</form>
</div>
</div>
2 changes: 1 addition & 1 deletion root/account/turing.html
Expand Up @@ -23,4 +23,4 @@ <h4 class="alert-heading"><strong>Success</strong></h4>
</form>
</fieldset>
<% END %>
</div>
</div>
2 changes: 1 addition & 1 deletion root/activity.xml
Expand Up @@ -17,4 +17,4 @@ xmlns="http://www.w3.org/2000/svg">
height="1"
style="fill:#36C; fill-opacity:0.6" />
<% END %>
</svg>
</svg>
2 changes: 1 addition & 1 deletion root/forbidden.html
@@ -1,2 +1,2 @@
<big><strong>Forbidden</strong></big><br><br>
You don't have permission to access this resource.
You don't have permission to access this resource.
2 changes: 1 addition & 1 deletion root/inc/breadcrumbs.html
Expand Up @@ -5,7 +5,7 @@
MACRO breadcrumb_link(version) BLOCK;
selected = release.author == version.author && release.name == version.name ? "selected" : ""; %>
<%# FIXME: This link should point to /pod (or /source?) %>
<option <% selected %> value="/<% [(module ? 'module' : 'release'), version.author, version.name, module.path].join('/') %>">
<option <% selected %> value="/<% [(module ? 'module' : 'release'), version.author, version.name].join('/'); IF module; "/"; module.path; END %>">
<% version.version _ (version.maturity == 'developer' ? ' DEV' : '') %>
(<%version.author %> on <% version.date.dt_date_common %>)
<% IF mark_unauthorized_releases && NOT version.authorized %>UNAUTHORIZED<% END %>
Expand Down
2 changes: 1 addition & 1 deletion root/inc/module-install.html
Expand Up @@ -10,7 +10,7 @@ <h4 class="modal-title">Module Install Instructions</h4>
<p><a href="/pod/distribution/App-cpanminus/bin/cpanm">cpanm</a></p>
<pre>
cpanm <% module.documentation or module.module.0.name or release.main_module or (release.author _ "/" _ release.archive) %></pre>
<p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
<p><a href="/pod/CPAN">CPAN shell</a></p>
<pre>
perl -MCPAN -e shell
install <% module.documentation or module.module.0.name or release.main_module or (release.author _ "/" _ release.archive) %></pre>
Expand Down
4 changes: 2 additions & 2 deletions root/inc/release-info.html
Expand Up @@ -56,11 +56,11 @@
backpan.push(version);
NEXT;
END %>
<option value="<% version.author; '/'; version.name; '/'; module.path %>"><% version.version _ (version.maturity == 'developer' ? ' DEV' : '') %> (<% version.author %> on <% version.date.dt_date_common %>)</option>
<option value="<% version.author; '/'; version.name; IF module; '/'; module.path; END %>"><% version.version _ (version.maturity == 'developer' ? ' DEV' : '') %> (<% version.author %> on <% version.date.dt_date_common %>)</option>
<% END; IF backpan.size %>
<optgroup label="BackPAN"></optgroup>
<% FOREACH version IN backpan %>
<option value="<% version.author; '/'; version.name; '/'; module.path %>"><% version.version _ (version.maturity == 'developer' ? ' DEV' : '') %> (<%version.author %> on <% version.date.dt_date_common %>)
<option value="<% version.author; '/'; version.name; IF module; '/'; module.path; END %>"><% version.version _ (version.maturity == 'developer' ? ' DEV' : '') %> (<%version.author %> on <% version.date.dt_date_common %>)
</option>
<% END %>
<% END; END %>
2 changes: 1 addition & 1 deletion root/inc/release-latest.html
Expand Up @@ -7,7 +7,7 @@
</a>
</div>
</li>
<li>
<li>
<div>
<span class="relatize"><% latest.date.dt_http %></span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion root/inc/release-tools.html
Expand Up @@ -60,7 +60,7 @@
<%- END %>
<li class="nav-header">Permalinks</li>
<li>
<a href="/<% module ? "pod/release" : "release" %>/<% release.author %>/<% release.name %>/<% module.path %>">This version</a>
<a href="/<% module ? "pod/release" : "release" %>/<% release.author %>/<% release.name %><% IF module; "/"; module.path; END %>">This version</a>
</li>
<%- IF canonical %>
<li>
Expand Down
2 changes: 1 addition & 1 deletion root/no_result.html
Expand Up @@ -4,7 +4,7 @@
<div class="content no-results">
<div class="alert alert-danger">
Did you mean :
<a href="/search?q=<% suggest | uri %>"><% suggest %></a>
<a href="/search?q=<% suggest | uri %>"><% suggest %></a>
</div>
</div>
<% ELSE %>
Expand Down
2 changes: 1 addition & 1 deletion root/release.html
Expand Up @@ -166,5 +166,5 @@ <h2 id="other">Other files</h2>
</div>
<%- END %>

<% INCLUDE inc/module-install.html %>
<% INCLUDE inc/module-install.html %>
</div>
80 changes: 45 additions & 35 deletions root/static/js/contributors.js
Expand Up @@ -46,49 +46,59 @@ $(function(){
}


var filter = [];
var by_author = {};
var by_email = {};
$('#contributors .contributor').each(function(){
var li = $(this);
var author;
var email;
if( author = li.attr('data-cpan-author')) {
$.getJSON( "https://api-v1.metacpan.org/author/" + author, function(data) {
updateContrib(li, data);
});
filter.push({ "term" : { "pauseid" : author } });
by_author[author] = li;
}
else if ( email = li.attr('data-contrib-email') ) {
var filter = $.map(email.split(/\s+/), function(em){
return {
"term": {
"email" : em
}
};
$.each(email.split(/\s+/), function(i, em){
filter.push({ "term" : { "email" : em } });
by_email[em] = li;
});
var query = {
"query" : {
"match_all" : {}
},
"filter": {
"or" : filter
},
"fields" : [
"name",
"email",
"pauseid",
"gravatar_url"
],
"size": 1
};
$.ajax({
type: "POST",
url: "https://api-v1.metacpan.org/author/",
data: JSON.stringify(query),
dataType: "json",
contentType: "application/x-www-form-urlencoded; charset=UTF-8", // a lie to bypass cors
processData: false,
success: function (data) {
if (data.hits.total == 1) {
updateContrib(li, data.hits.hits[0].fields);
}
}
});

var query = {
"query" : {
"match_all" : {}
},
"filter": {
"or" : filter
},
"_source" : [
"name",
"email",
"pauseid",
"gravatar_url"
]
};

$.ajax({
type: "POST",
url: "https://api-v1.metacpan.org/author/",
data: JSON.stringify(query),
dataType: "json",
contentType: "application/x-www-form-urlencoded; charset=UTF-8", // a lie to bypass cors
processData: false,
success: function (data) {
$.each(data.hits.hits, function(i, contrib){
var fields = contrib._source;
if (fields.email) {
$.each(fields.email, function(i, email){
if (by_email[email]) {
updateContrib(by_email[email], fields);
}
});
}
if (fields.pauseid && by_author[fields.pauseid]) {
updateContrib(by_author[fields.pauseid], fields);
}
});
}
Expand Down
8 changes: 4 additions & 4 deletions root/static/js/dropdown.js
@@ -1,5 +1,5 @@
$(function() {
$(".dropdown select").on("change", function() {
document.location.href = $(this).val();
});
});
$(".dropdown select").on("change", function() {
document.location.href = $(this).val();
});
});
4 changes: 2 additions & 2 deletions root/static/less/account.less
Expand Up @@ -9,7 +9,7 @@
padding-left: 0px !important;
}

#account-profile {
#account-profile {
.form-group:after {
clear: both !important;
}
Expand Down Expand Up @@ -294,7 +294,7 @@
}
}
}

.pull-right {
float: none !important;
}
Expand Down
6 changes: 3 additions & 3 deletions root/static/less/author.less
Expand Up @@ -84,7 +84,7 @@
}

.fa {
float: right;
margin-right: -15px;
}
float: right;
margin-right: -15px;
}
}
2 changes: 1 addition & 1 deletion root/static/less/global.less
Expand Up @@ -348,7 +348,7 @@ input#search-input {

.top-input-form {
border-right: none;
width: 340px !important;
width: 340px !important;
}

.search-form {
Expand Down
2 changes: 1 addition & 1 deletion root/static/less/login.less
Expand Up @@ -10,4 +10,4 @@
float: left;
font-size: 2.7em;
}
}
}
2 changes: 1 addition & 1 deletion root/static/less/print.less
@@ -1,4 +1,4 @@
@media print {
.pod { margin: 0px; border: 0px solid #000; padding: 0px}
.home, .header, .search-bar, .box-right, .footer, a.favorite {display:none}
}
}
2 changes: 1 addition & 1 deletion root/static/less/silk.less
Expand Up @@ -20,4 +20,4 @@
padding-left: 20px;
background-repeat: no-repeat !important;
background: url(/static/icons/page_white_c.png);
}
}
4 changes: 2 additions & 2 deletions root/wrapper.html
Expand Up @@ -32,14 +32,14 @@
class = 'hidden-xs',
icon = "rocket",
},
] %>
] -%>
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><% IF title; title; ELSE; 'Search the CPAN'; END %> - metacpan.org</title>
<%- IF rss %>
<link rel="alternate" type="application/rss+xml" title="RSS" href="https://metacpan.org/feed/<% rss %>" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed/<% rss %>" />
<%- END %>
<%- FOREACH css IN req.env.item('psgix.assets').grep(/\.css$/) %>
<link href="<% css %>" rel="stylesheet" type="text/css">
Expand Down
5 changes: 3 additions & 2 deletions t/controller/shared/release-info.t
Expand Up @@ -104,8 +104,9 @@ test_psgi app, sub {
'contains permalink to resource' );

ok(
my $this
= $tx->find_value('//a[text()="This version"]/@href'),
my $this = $tx->find_value(
'//a[text()="This version"][starts-with(@href,"/")]/@href'
),
'contains link to "this" version'
);

Expand Down

0 comments on commit 9e4d03d

Please sign in to comment.