-
Notifications
You must be signed in to change notification settings - Fork 2
/
publication.html
101 lines (94 loc) · 4.17 KB
/
publication.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<link rel="import" href="nextprot-elements-shared-styles.html">
<link rel="import" href="publication-title.html">
<link rel="import" href="publication-authors-and-journal.html">
<link rel="import" href="publication-abstract.html">
<!--
`publication`
Publication item demo
@demo demo/publication-demo.html
-->
<dom-module id="np-publication">
<template>
<style include="nextprot-elements-shared-styles">
:host {
display: block;
}
</style>
<template is="dom-if" if="[[publication]]">
<!-- Online resources -->
<template is="dom-if" if="[[_testType(publication.publicationType, 'ONLINE_PUBLICATION')]]">
<b>[[publication.publicationLocatorName]]</b>
<template is="dom-if" if="[[!_testView(view, 'summary')]]">
<p>
<template is="dom-if" if="[[publication.title]]">
[[publication.title]]
</template>
<template is="dom-repeat" items="[[publication.dbXrefs]]" as="xref">
[[[_formatXrefLabel(xref.databaseName)]]:
<a href="[[xref.resolvedUrl]]" class="ext-link" target='_blank'>[[xref.accession]]</a>]
</template>
</p>
</template>
<template is="dom-if" if="[[_testView(view, 'summary')]]">
<p>
<template is="dom-if" if="[[publication.title]]">
[[publication.title]]
</template>
</p>
</template>
</template>
<template is="dom-if" if="[[!_testType(publication.publicationType, 'ONLINE_PUBLICATION')]]">
<!-- Title -->
<template is="dom-if" if="[[!_testView(view, 'standard')]]">
<publication-title title="[[publication.title]]"
link-id="[[publication.publicationId]]"></publication-title>
</template>
<template is="dom-if" if="[[_testView(view, 'standard')]]">
<publication-title title="[[publication.title]]"></publication-title>
</template>
<!-- Authors -->
<publication-authors-and-journal publication="[[publication]]"
summary$="[[_testView(view, 'summary')]]"></publication-authors-and-journal>
<!-- Abstract -->
<template is="dom-if" if="[[_testType(publication.publicationType, 'ARTICLE')]]">
<template is="dom-if" if="[[!_testView(view, 'summary')]]">
<publication-abstract abstract="[[publication.abstractText]]"
interactive$="[[_testView(view, 'detailed')]]"></publication-abstract>
</template>
</template>
</template>
</template>
</template>
<script>
Polymer({
// https://www.webcomponents.org/community/articles/how-should-i-name-my-element
is: 'np-publication',
properties: {
publication: {
type: Object,
value: {}
},
view: {
type: String,
value: "standard" // detailed, summary
}
},
_formatXrefLabel: function (name) {
return name.replace("DOI", "Full text").replace("WEBINFO", "View web page");
},
_formatInitials: function (name) {
return (name.replace(new RegExp(/\./, 'g'), "").split('').join('.') + '.').replace("-.", "");
},
_checkIfLast: function (array, index) {
if (array.length - 1 === index) return true;
return false;
},
_testView: function (type, test) {
return type === test;
},
_testType: function (type, test) {
return type === test;
}
});
</script>
</dom-module>