-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentry-publication-direct-links.html
80 lines (70 loc) · 2.4 KB
/
entry-publication-direct-links.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
<link rel="import" href="nextprot-elements-shared-styles.html">
<!--
`entry-publication-direct-links`
Entry publication direct links
@demo demo/entry-publication-direct-links-demo.html
-->
<dom-module id="entry-publication-direct-links">
<template>
<style include="nextprot-elements-shared-styles">
:host {
display: block;
}
.annotscope-bg {
background-color: #dedede;
color: #7A7A7A;
border-radius: 5px;
padding: 1px 3px;
font-size: 11px;
}
.annotscope-bg-selected {
background-color: #337ab7;
color: #ffffff;
border-radius: 5px;
padding: 1px 3px;
font-size: 11px;
}
.annotscope-label {
font-size: 13px;
}
</style>
<template is="dom-if" if="[[_hasDlinks(dlinks)]]">
<template is="dom-repeat" items="[[dlinks]]" as="annotscope">
<div>
<span class$="[[_getClassForScope(annotscope.database)]]">[[annotscope.database]]</span>
<template is="dom-if" if="[[!_isUniprotKB(annotscope.database)]]">
[<a class='ext-link' href="[[annotscope.link]]" target="_blank">[[annotscope.accession]]</a>]
</template>
<span class="annotscope-label">[[annotscope.label]]</span>
</div>
</template>
</template>
</template>
<script>
Polymer({
is: 'entry-publication-direct-links',
properties: {
dlinks: {
type: Object
},
selectedScope: {
type: String
}
},
_getClassForScope: function(dbname) {
var scopeClass = 'annotscope-bg';
if (dbname == this.selectedScope) scopeClass += '-selected';
return scopeClass;
},
_hasDlinks: function (linkarr) {
if (linkarr) {
return linkarr.length > 0;
}
return false;
},
_isUniprotKB: function (database) {
return database === "UniProtKB";
}
});
</script>
</dom-module>