-
Notifications
You must be signed in to change notification settings - Fork 2
/
entry-view-reference.html
51 lines (48 loc) · 1.42 KB
/
entry-view-reference.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
<link rel="import" href="nextprot-elements-shared-styles.html">
<!--
`entry-view-reference`
Entry view reference
@demo demo/entry-view-reference-demo.html
-->
<dom-module id="entry-view-reference">
<template>
<style include="nextprot-elements-shared-styles">
:host {
display: block;
}
.cited-for {
color: #7A7A7A;
font-size: 11px;
font-weight: bold;
}
</style>
<template is="dom-if" if="[[_isCited(refs)]]">
<span class="cited-for">CITED FOR: </span>
<template is="dom-repeat" items="[[_toArray(refs)]]" as="cited">
<a href="[[cited.1]]" target='_blank'>[[cited.0]]</a>
</template>
</template>
</template>
<script>
Polymer({
is: 'entry-view-reference',
properties: {
refs: {
type: Object
}
},
_isCited: function (refs) {
if (refs) {
return Object.keys(refs).length > 0;
}
return false;
},
_toArray: function (obj) {
var citedArr = Object.keys(obj).map(function (key, value) {
return [key, obj[key]];
});
return citedArr;
}
});
</script>
</dom-module>