Skip to content

Commit

Permalink
Merged commit 9a03ade from the dev-2.0 branch (manually since file lo…
Browse files Browse the repository at this point in the history
…cations have changed)
  • Loading branch information
laurenwalker committed May 7, 2018
1 parent 184a693 commit 7e8f0ae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion metacatui/src/main/webapp/css/metacatui-common.css
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ img.icon{
margin-top: 40px;
}
/* Hide the elements from the view service that we don't need to display */
#metadata-container .citation,
#Metadata form > .citation,
#metadata-container #downloadPackage{
display: none;
}
Expand Down
26 changes: 17 additions & 9 deletions metacatui/src/main/webapp/js/views/CitationView.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,17 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
//If there is no metadata doc, then this is probably a data doc without science metadata.
//So create the citation from the index values
else{
var author = this.model.get("rightsHolder") || this.model.get("submitter") || "",
var authorText = this.model.get("rightsHolder") || this.model.get("submitter") || "",
dateUploaded = this.model.get("dateUploaded"),
datasource = this.model.get("datasource");

//Format the author text
var authorText = author? author.substring(3, author.indexOf(",O=")) + ". " : "";
if( authorText.indexOf(",O=") > -1 ){
authorText = authorText.substring(3, authorText.indexOf(",O=")) + ". ";
}
else{
authorText += ". ";
}
}

//The author
Expand Down Expand Up @@ -133,11 +138,13 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
var idEl = this.createIDElement();

//Create a link
var idForLink = this.metadata? this.metadata.get("id") : this.model.get("id");

if(this.createLink){
var linkEl = $(document.createElement("a"))
.addClass("route-to-metadata")
.attr("data-id", this.metadata.get("id"))
.attr("href", "#view/" + this.metadata.get("id"));
.attr("data-id", idForLink)
.attr("href", "#view/" + idForLink);
}
else{
var linkEl = document.createElement("span");
Expand All @@ -146,7 +153,7 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
if((typeof title !== "undefined") && title){
var titleEl = $(document.createElement("span"))
.addClass("title")
.attr("data-id", this.metadata.get("id"))
.attr("data-id", idForLink)
.text(title + ". ");
}
else{
Expand All @@ -162,14 +169,15 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],

createIDElement: function(){

var id = this.metadata.get("id"),
seriesId = this.metadata.get("seriesId"),
datasource = this.metadata.get("datasource");
var model = this.metadata || this.model,
id = model.get("id"),
seriesId = model.get("seriesId"),
datasource = model.get("datasource");

var idEl = $(document.createElement("span")).addClass("id");
if(seriesId){
//Create a link for the identifier if it is a DOI
if( this.metadata.isDOI(seriesId) && !this.createLink ){
if( model.isDOI(seriesId) && !this.createLink ){
var doiURL = (seriesId.indexOf("doi:") == 0)? "https://doi.org/" + seriesId.substring(4) : seriesId,
doiLink = $(document.createElement("a"))
.attr("href", doiURL)
Expand Down

0 comments on commit 7e8f0ae

Please sign in to comment.