-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaying-browser.html
More file actions
152 lines (125 loc) · 3.74 KB
/
Copy pathplaying-browser.html
File metadata and controls
152 lines (125 loc) · 3.74 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
<link rel="import" href="playing-browser/playing-breadcrumb.html">
<!--
`playing-browser`
@group Playing UI
@element playing-browser
-->
<dom-module id="playing-browser">
<template>
<style include="mostly-styles">
/* document actions */
.document-actions {
@apply --layout-horizontal;
@apply --layout-end-justified;
padding: 0 0 16px;
}
.document-actions paper-icon-button {
@apply --mostly-action;
}
.document-actions paper-icon-button:hover {
@apply --mostly-action-hover;
}
/* document views items (pills) */
#documentViewsItems {
@apply --layout-horizontal;
--paper-listbox-background-color: transparent;
}
@media (max-width: 1024px) {
paper-listbox {
padding-right: 7rem;
}
}
</style>
<!-- Main content -->
<mostly-page class="main">
<div slot="header">
<playing-breadcrumb document="[[document]]"></playing-breadcrumb>
<paper-listbox id="documentViewsItems" selected="{{selectedTab}}" attr-for-selected="name">
<mostly-slot slot="DOCUMENT_VIEWS_ITEMS" model="[[viewsContext]]"></mostly-slot>
</paper-listbox>
</div>
<div>
<template is="dom-if" if="[[!isTrashed(document)]]">
<div class="document-actions">
<mostly-slot slot="DOCUMENT_ACTIONS" model="[[actionContext]]"></mostly-slot>
</div>
</template>
<div id="nxContent">
<iron-pages selected="[[selectedTab]]" attr-for-selected="name" selected-attribute="visible">
<mostly-slot slot="DOCUMENT_VIEWS_PAGES" model="[[viewsContext]]"></mostly-slot>
</iron-pages>
</div>
</div>
</mostly-page>
</template>
<script>
Polymer({
is: 'playing-browser',
behaviors: [Mostly.RoutingBehavior, Mostly.I18nBehavior, Mostly.FiltersBehavior],
properties: {
document: {
type: Object,
observer: '_documentChanged'
},
selectedTab: {
type: String,
value: 'view',
notify: true
},
cvParams: {
type: Object,
notify: true
},
toto: {
type: String
},
clipboard: {
type: Object,
value: null
},
actionContext: {
type: Object,
computed: '_actionContext(document, clipboard)'
},
viewsContext: {
type: Object,
computed: '_viewsContext(document)'
}
},
listeners: {
'aceupdated': '_documentUpdated',
'acedeleted': '_documentUpdated',
'added-to-collection': '_documentUpdated',
'removed-from-collection': '_documentUpdated'
},
_documentChanged: function(newVal, oldVal) {
console.log('browser:_documentChanged', newVal, oldVal);
},
_documentUpdated: function() {
this.fire('document-updated');
},
download: function() {
location.href = this.document.file.url;
},
get _metadata() {
if (this.document) {
return this.document.metadata;
}
},
get _canReadChildren() {
return this._metadata && this._metadata.permissions.indexOf('ReadChildren') !== -1;
},
_actionContext: function() {
console.log('browser:_actionContext', this.document);
return { document: this.document, clipboard: this.clipboard };
},
_viewsContext: function() {
console.log('browser:_viewsContext', this.document);
return { document: this.document };
},
_navigateToView: function() {
this.navigateTo('browse', this.document.path);
}
});
</script>
</dom-module>