-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.tag
39 lines (29 loc) · 1008 Bytes
/
message.tag
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
'use strict';
<message>
<div if="{ text != '' && !dismissed }" class="alert alert-{ type } { alert-dismissible: dismissible }" style="{ style }">
<button if="{ dismissible }" type="button" class="close" aria-label="Close"><span aria-hidden="true" onclick="{ dismiss }">×</span></button>
<raw content="{ text }" />
</div>
<script>
var self = this;
self.plugin = opts.plugin || console.error('no plugin set');
self.name = opts.name;
self.text = opts.text || '';
self.type = opts.type || '';
self.dismissible = opts.dismissible || false;
self.style = opts.style || '';
self.dismissed = false;
self.plugin.on('set-message', function(text, type, name) {
if ((name != undefined && name != self.name) || (name == undefined && self.name != undefined)) {
return; // not for this instance
}
self.text = text;
self.type = type;
self.dismissed = false;
self.update();
});
self.dismiss = function(e) {
self.dismissed = true;
}
</script>
</message>