-
Notifications
You must be signed in to change notification settings - Fork 2
/
publication-abstract.html
118 lines (109 loc) · 3.86 KB
/
publication-abstract.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<link rel="import" href="nextprot-elements-shared-styles.html">
<!--
`publication-abstract`
Publication abstract demo
@demo demo/publication-abstract-demo.html
-->
<dom-module id="publication-abstract">
<template>
<style include="nextprot-elements-shared-styles">
:host {
display: block;
}
iron-collapse {
margin-top: 2px;
}
span[pushed] .pubDisplayStatus:before {
content: "Hide";
display: inline-block;
}
span .pubDisplayStatus:before {
content: "Show";
}
.abstractHeader {
color: #666;
padding: 2px 0;
}
.abstract-button {
background-color: #337ab7;
color: white;
border-radius: 2px;
cursor: pointer;
}
#collapseAbstract {
text-align: justify;
}
</style>
<template is="dom-if" if="[[abstract]]">
<template is="dom-if" if="[[!interactive]]">
<div class="abstractHeader">Abstract</div>
[[abstract]]
</template>
<template is="dom-if" if="[[interactive]]">
<span id="collapseButton" class="colored-label abstract-button button-thin" on-tap="_toggleAbstract">
<span class="pubDisplayStatus"> </span>abstract
</span>
<iron-collapse id="collapseAbstract" opened="[[showAbstract]]">
<template is="dom-if" if="[[abstract]]">
<div id="abstractHeader" hidden>Abstract</div>
</template>
[[abstract]]
</iron-collapse>
</template>
</template>
<template is="dom-if" if="[[!abstract]]">
No Abstract available
</template>
</template>
<script>
Polymer({
is: 'publication-abstract',
behaviors: [Polymer.NeonAnimationRunnerBehavior],
properties: {
abstract: {
type: String,
value: ""
},
interactive: {
type: Boolean,
value: false
},
showAbstract: {
type: Boolean,
value: false
},
animationConfig: {
value: function () {
return {
"showAbstract": {
name: "fade-in-animation",
node: this.$.collapseAbstract,
timing: {
duration: 1200
}
},
"hideAbstract": {
name: "fade-out-animation",
node: this.$.collapseAbstract,
timing: {
duration: 200
}
}
}
}
}
},
_toggleAbstract: function () {
this.$$("#collapseAbstract").opened ?
this.playAnimation("hideAbstract") : this.playAnimation("showAbstract");
this.$$("#collapseAbstract").toggle();
this._toggleButton();
},
_toggleButton: function () {
this.$$("#collapseAbstract").opened ?
this.$$("#collapseButton").setAttribute("pushed", null) :
this.$$("#collapseButton").removeAttribute("pushed");
}
});
</script>
</dom-module>