-
Notifications
You must be signed in to change notification settings - Fork 0
/
comment-element.html
43 lines (39 loc) · 1.08 KB
/
comment-element.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
<link rel="import" href="../bower_components/iron-input/iron-input.html"><dom-module id="comment-element"><template><style>
:host {
display: flex;
align-items: baseline;
}
textarea {
width: 100%;
height: 60px;
}
</style><textarea value="{{comment::input}}" placeholder="comment"></textarea> <button on-click="remove">x</button></template></dom-module><script>
"use strict";
var Comment = new Polymer({
is: "comment-element",
properties: {
comment: {
type: String,
value: ""
},
parent_: Object,
index: Number // zur Verwaltung in Listen
},
factoryImpl: function(parent_, index) {
this.parent_ = parent_;
this.index = index;
},
remove: function() {
//this.remove(); // kommt man nicht so wirklich ran, sich selbst rauszuwerfen ist nicht drin (oder ich weiß nicht wie, deswegen der umweg)
this.parent_.removeComment(this.index);
},
setText: function(text) {
this.comment = text;
},
fromXML: function(xml) { // nicht nötig
},
toXML: function() {
return '<Comment>' + this.comment + '</Comment>';
}
});
</script>