-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrolch-wc-notification-card.html
120 lines (105 loc) · 4.14 KB
/
strolch-wc-notification-card.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
119
120
<!-- Components -->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../strolch-wc-styles/strolch-wc-app-style.html">
<link rel="import" href="../strolch-wc-raw-text/strolch-wc-raw-text.html">
<link rel="import" href="./strolch-wc-notifications-behavior.html">
<dom-module id="strolch-wc-notification-card">
<template>
<!-- Style -->
<style is="custom-style" include="strolch-wc-app-style">
:host {
}
paper-card {
padding: 8px;
}
.notification {
margin-bottom: 16px;
}
</style>
<!-- Content -->
<paper-card class="notification" raised="1">
<template is="dom-repeat" items="[[supportedLanguages]]" as="language">
<h3>[[language.name]]: [[_getField('title', language.locale, notification)]]</h3>
<strolch-wc-raw-text
text="[[_getField('text', language.locale, notification)]]"></strolch-wc-raw-text>
<hr/>
</template>
<dl class="g-dl">
<dt>[[localize('enabled')]]</dt>
<dd>[[localize(enabled)]]</dd>
<dt>[[localize('validFrom')]]</dt>
<dd>[[formatDateTimeDashIfEmpty(notification.visibility.visibleFrom)]]</dd>
<dt>[[localize('validTo')]]</dt>
<dd>[[formatDateTimeDashIfEmpty(notification.visibility.visibleTo)]]</dd>
<dt>[[localize('forAll')]]</dt>
<dd>[[localize(forAll)]]</dd>
<dt>[[localize('roles')]]</dt>
<dd>[[notification.visibility.roles]]</dd>
<dt>[[localize('locations')]]</dt>
<dd>[[notification.visibility.locationNames]]</dd>
</dl>
<dl class="g-dl">
<dt>[[localize('updatedBy')]]</dt>
<dd>[[notification.version.updatedBy]]</dd>
<dt>[[localize('updatedAt')]]</dt>
<dd>[[formatDateTimeDashIfEmpty(notification.version.updated)]]</dd>
</dl>
<div class="actions padding actions-right">
<div>
<paper-button on-tap="onTestNotification" raised>
[[localize('test')]]
</paper-button>
<paper-button on-tap="onEditNotification" raised>
[[localize('edit')]]
</paper-button>
<paper-button on-tap="onRemoveNotification" raised>
[[localize('remove')]]
</paper-button>
</div>
</div>
</paper-card>
</template>
<script>
Polymer({
<!-- Settings -->
is: "strolch-wc-notification-card",
<!-- Behaviors -->
behaviors: [
StrolchNotificationsBehavior
],
<!-- Properties -->
properties: {
supportedLanguages: {
type: Array
},
notification: {
type: Object
},
enabled: {
type: String,
computed: "_computeEnabled(notification)"
},
forAll: {
type: String,
computed: "_computeForAll(notification)"
}
},
_computeEnabled: function (notification) {
return notification.visibility.enabled === true ? "true" : "false";
},
_computeForAll: function (notification) {
return notification.visibility.forAll === true ? "true" : "false";
},
<!-- Functions -->
onEditNotification: function (e) {
this.fire("edit", this.notification);
},
onRemoveNotification: function (e) {
this.fire("remove", this.notification);
},
onTestNotification: function (e) {
this.fire("test", this.notification);
},
});
</script>
</dom-module>