Skip to content

Commit

Permalink
Cut off the author list in citations with "et al." wfter the fifth name
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenwalker committed Nov 29, 2016
1 parent f307d55 commit 4586997
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions metacatui/src/main/webapp/js/views/CitationView.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],

className : "citation",

events: {
},

/*
* Creates a citation
*/
Expand Down Expand Up @@ -82,13 +79,20 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
authorText = "";
_.each(authors, function(author) {
count++;
if (count > 1 && authors.length > 2) authorText += ",";


if(count == 6){
authorText += ", et al. ";
return;
}
else if(count > 6) return;

if(count > 1 && authors.length > 2) authorText += ",";

if (count > 1 && count == authors.length) authorText += " and";

if(authors.length > 1) authorText += " ";

authorText += author
authorText += author;

if (count == authors.length) authorText += ". ";
});
Expand Down

0 comments on commit 4586997

Please sign in to comment.