paper-card-controllet.html
6.94 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<link rel="import" href="../../bower_components/polymer/polymer.html"/>
<link rel="import" href="../../bower_components/paper-material/paper-material.html"/>
<link rel="import" href="../../bower_components/paper-fab/paper-fab.html"/>
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html"/>
<dom-module id="paper-card-controllet">
<template>
<link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<style>
:host {
display: inline-block;
margin: 0 8px 8px ;
font-size: 14px;
text-align: justify;
line-height: 10px;
--paper-fab-background: var(--accent-color);
font-family: 'Roboto', sans-serif;
padding-bottom: 30px;
/*Test*/
}
paper-material {
background-color: white;
border-width: 1em;
}
.footer {
position: relative;
height: 21px;
}
.legend {
position: relative;
top: -50px;
background: rgba(0,0,0,0.8);
bottom: 0;
color: white;
height: 50px;
padding: 0 16px;
left: 0; right: 0;
z-index: 1;
}
paper-fab {
position: absolute;
right: 10px;
bottom: -18px;
z-index: 10;
--paper-fab-background:#2196F3;
}
#content ::content {
/*padding: 0 16px 8px;*/
padding: 0 16px 8px;
font-weight: 300;
color: var(--secondary-text-color);
line-height: 24px;
max-height: 400px;
position:relative;
overflow: auto;
}
::content.buttons {
margin-top: 8px;
}
::content paper-button, ::content paper-icon-button {
font-weight: 500;
color: var(--accent-color);
}
#comment{
position:relative;
top: -50px;
min-height: 50px;
height: auto;
padding: 8px 8px 8px 8px;
font-size: 10px;
color: rgba(0,0,0,0.4);
font-family: 'Roboto', sans-serif;
}
.delete{
position: absolute;
top: -12px;
left: -12px;
--iron-icon-height: 18px;
--iron-icon-width: 18px;
width: 24px;
height: 24px;
--paper-fab-background:#cccccc;
}
</style>
<paper-material animated elevation="{{elevation}}" flex>
<paper-fab class="delete" mini icon="delete" on-click="_handleDeleteClick"></paper-fab>
<div class="vertical layout">
<div id="content">
<content></content>
</div>
<template is="dom-if" if="{{cardTitle}}">
<div class="legend horizontal layout center">
<span>{{cardTitle}}</span>
<!-- Adding icon based on card type -->
<template is="dom-if" if="{{checkType(cardType, 'text')}}">
<paper-fab class="modify" mini icon="create" on-click="_handleDetailsClick"></paper-fab>
</template>
<template is="dom-if" if="{{checkType(cardType, 'image')}}">
<paper-fab class="modify" mini icon="perm-media" on-click="_handleDetailsClick"></paper-fab>
</template>
<template is="dom-if" if="{{checkType(cardType, 'datalet')}}">
<paper-fab class="modify" mini icon="assessment" on-click="_handleDetailsClick"></paper-fab>
</template>
<template is="dom-if" if="{{checkType(cardType, 'link')}}">
<paper-fab class="modify" mini icon="link" on-click="_handleDetailsClick"></paper-fab>
</template>
</div>
</template>
<div class="footer">
<template is="dom-if" if="{{comment}}">
<div id="comment">{{comment}}</div>
</template>
</div>
</div>
</paper-material>
</template>
<script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
<script>
Polymer({
is: "paper-card-controllet",
properties: {
width: {
type: Number,
observer: "_changeWidth",
},
height: {
type: Number,
observer: "_changeHeight",
},
cardType:{
type: String,
value: "text"
},
comment:{
cardType: String,
value: ""
},
cardTitle:{
type: String,
value: ""
},
elevation:{
type: Number,
value: 3
}
},
ready: function(){
if(this.cardType == "text"){
this.$.content.style.backgroundColor = "#ffc";
}
},
_changeWidth: function(data){
this.style.width = data + "px";
//this.$.content.style.width = data + "px";
//$(this.$.content).perfectScrollbar();
},
_changeHeight: function(data){
this.style.height = (data) + "px";
this.$.content.style.height = data + "px";
this.style.height = (this.height + ((this.text != "") ? 50 : 0)) + "px";
$(this.$.content).perfectScrollbar();
},
checkType: function(type, check){
return (type == check);
},
_handleDetailsClick: function(e){
this.fire('paper-card-controllet_details-clicked', {data : this});
},
_handleDeleteClick: function(e){
this.fire('paper-card-controllet_delete-clicked', {data : this});
}
})
</script>
</dom-module>