-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmostly-admin.html
60 lines (51 loc) · 1.33 KB
/
mostly-admin.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
<!--
`mostly-admin`
@group Mostly UI
@element mostly-admin
-->
<dom-module id="mostly-admin">
<template>
<template is="dom-if" if="[[visible]]">
<iron-pages selected="{{selected}}" attr-for-selected="name" fallback-selection="error" selected-attribute="visible">
<mostly-slot slot="ADMINISTRATION_PAGES" model="[[actionContext]]"></mostly-slot>
</iron-pages>
</template>
</template>
<script>
Polymer({
is: 'mostly-admin',
behaviors: [Mostly.I18nBehavior],
properties: {
visible: Boolean,
selected: {
type: String,
value: 'analytics',
notify: true,
observer: '_checkError'
},
isAdministrator: {
type: Boolean,
value: false,
reflectToAttribute: true
},
actionContext: {
type: Object,
computed: '_actionContext(user, entity)'
},
entity: Object
},
_actionContext: function() {
return { user: this.user, entity: this.entity };
},
_errorUrl: function() {
return window.location.href;
},
_checkError: function() {
// XXX: removed fallback-selection="error"
if (this.selected === 'error') {
this.fire('error', { code: 404 });
}
}
});
</script>
</dom-module>