Skip to content

Commit aba133b

Browse files
committed
#2140 chnage layout of text citation partial view
1 parent 589b16d commit aba133b

File tree

3 files changed

+47
-5
lines changed

3 files changed

+47
-5
lines changed

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Helpers/CitationsHelper.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,18 @@ public static CitationDataModel GetCitationDataModel(long datasetVersionId)
112112
{
113113
if (!String.IsNullOrEmpty(pub.Doi))
114114
model.URL = pub.Doi;
115+
else if (!String.IsNullOrEmpty(pub.ExternalLink))
116+
model.URL = pub.ExternalLink;
117+
115118
}
116-
else
119+
120+
if (String.IsNullOrEmpty(model.URL))
117121
{
118-
if(useTags)
122+
if (useTags)
119123
model.URL = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + $"/ddm/data/Showdata/{datasetVersion.Dataset.Id}?tag={model.Version}";
120124

121125
model.URL = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + $"/ddm/data/Showdata/{datasetVersion.Dataset.Id}?version={model.Version}";
122-
126+
123127
}
124128
}
125129
}

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Models/CitationModels.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using BExIS.App.Bootstrap.Attributes;
2+
using System;
23
using System.Collections.Generic;
34
using System.ComponentModel.DataAnnotations;
45
using System.Xml.Serialization;
@@ -51,6 +52,7 @@ public class CitationDataModel
5152
public string Year { get; set; }
5253

5354
[XmlElement("doi")]
55+
[Obsolete]
5456
public string DOI { get; set; }
5557

5658
[XmlElement("url")]
Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
@model BExIS.Modules.Ddm.UI.Models.CitationDataModel
22

3-
<div>@String.Join("; ", Model.Authors) (@(Model.Year)): @(Model.Title). Version @(Model.Version). @(Model.Publisher). @(Model.EntityType). @(Model.URL)</div>
3+
<div id="citation-container"><b>Citation:</b><div id="citation-title">@String.Join("; ", Model.Authors) (@(Model.Year)): <b>@(Model.Title)</b>. Version @(Model.Version). @(Model.Publisher). @(Model.EntityType). @(Model.URL) <span id="citation-copy" class="bx bx-copy" onclick="copyDivContentToClipboard('citation-title')"></span></div>
4+
5+
</div>
46

5-
@*{Nachname Ersteller}, {Initialen Ersteller}. ({Jahr}). {Titel des Datensatzes} [Datensatz]. {Herausgeber/Organisation}. Abgerufen am {Datum des Zugriffs}, von https://doi.org/{DOI} oder {URL}*@
7+
@*{Nachname Ersteller}, {Initialen Ersteller}. ({Jahr}). {Titel des Datensatzes} [Datensatz]. {Herausgeber/Organisation}. Abgerufen am {Datum des Zugriffs}, von https://doi.org/{DOI} oder {URL}*@
8+
9+
<script>
10+
function copyDivContentToClipboard(divId) {
11+
const div = document.getElementById(divId);
12+
// You can copy text or HTML content, change as needed
13+
const content = div.innerText; // Use innerHTML if you want to copy HTML formatting
14+
15+
navigator.clipboard.writeText(content)
16+
.then(() => {
17+
alert('Citation copied to clipboard!');
18+
})
19+
.catch(err => {
20+
alert('Error copying citation: ' + err);
21+
});
22+
}
23+
24+
</script>
25+
26+
<style>
27+
#citation-container {
28+
display: flex;
29+
flex: auto;
30+
gap: 10px;
31+
}
32+
33+
#citation-copy {
34+
cursor: pointer;
35+
}
36+
37+
#citation-copy:hover {
38+
color: var(--bexis2-gray-3);
39+
}
40+
41+
</style>

0 commit comments

Comments
 (0)