Repository navigation
Expand file tree
/
Copy pathmostly-selection-toolbar.html
More file actions
160 lines (137 loc) · 4.63 KB
/
Copy pathmostly-selection-toolbar.html
File metadata and controls
160 lines (137 loc) · 4.63 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
153
154
155
156
157
158
159
160
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../paper-button/paper-button.html">
<link rel="import" href="../../paper-dialog-scrollable/paper-dialog-scrollable.html">
<link rel="import" href="../behaviors/mostly-i18n-behavior.html">
<link rel="import" href="../mostly-thumbnail/mostly-thumbnail.html">
<link rel="import" href="../widgets/mostly-dialog.html">
<!--
### Styling
The following custom properties and mixins are available for styling:
Custom property | Description | Default
----------------------------------------|------------------------------------|-----------------------
`--mostly-selection-toolbar-background` | Background color | #000
`--mostly-selection-toolbar-text` | Text color | #fff
`--mostly-selection-toolbar-link` | Link color | #fff
`--mostly-selection-toolbar-link-hover` | Link hover color | #000
`--mostly-selection-toolbar` | Mixin applied to the toolbar | `{}`
`mostly-selection-toolbar`
@group Mostly UI
@element mostly-selection-toolbar
-->
<dom-module id="mostly-selection-toolbar">
<template>
<style is="iron-flex iron-flex-alignment mostly-styles">
:host {
font-family: var(--mostly-app-font);
}
.toolbar {
@apply --layout-horizontal;
@apply --layout-center;
@apply --layout-fit;
height: 60px;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 201;
padding: 0 2em;
font-weight: 300;
box-shadow: 0 0 3px rgba(0,0,0,0.4);
background: var(--mostly-selection-toolbar-background, #000);
color: var(--mostly-selection-toolbar-text, #fff);
@apply --mostly-selection-toolbar;
}
.actions {
@apply --layout-horizontal;
@apply --layout-center;
@apply --layout-flex;
@apply --layout-end-justified;
}
.count {
font-weight: 600;
}
#selectedItemsPopup {
margin-top: 196px;
}
.horizontal {
@apply --layout-flex;
@apply --layout-horizontal;
}
/* links */
a, a:active, a:visited, a:focus {
display: inline-block;
vertical-align: bottom;
text-decoration: underline;
margin-left: 1em;
color: var(--mostly-selection-toolbar-link, #fff);
cursor: pointer;
}
a:hover {
color: var(--mostly-selection-toolbar-link-hover, #000);
}
</style>
<div class="horizontal center layout" id="content">
<div id="selectionToolbar" class="toolbar">
<div class="selection">
<span class="count">[[i18n('selectionToolbar.selected.items', selectedItems.length)]]</span>
<a class="selectionLink" on-tap="toogleSelectedItemsPopup">
<span>[[i18n('selectionToolbar.display.selection')]]</span>
</a>
<a class="selectionLink" on-tap="clearSelection">
<span>[[i18n('command.clear')]]</span>
</a>
</div>
<div class="actions">
<slot></slot>
</div>
</div>
</div>
<mostly-dialog id="selectedItemsPopup" no-auto-focus with-backdrop>
<h2>[[i18n('selectionToolbar.dialog.heading')]]</h2>
<paper-dialog-scrollable>
<template is="dom-repeat" items="[[selectedItems]]">
<div class="layout horizontal center">
<mostly-thumbnail url="[[item.metadata.thumbnail.url]]"></mostly-thumbnail><div>[[item.title]]</div>
</div>
</template>
</paper-dialog-scrollable>
<div class="buttons">
<paper-button dialog-dismiss>[[i18n('command.close')]]</paper-button>
</div>
</mostly-dialog>
</template>
<script>
Polymer({
is: 'mostly-selection-toolbar',
behaviors: [Mostly.I18nBehavior],
properties: {
hidden: {
type: Boolean,
value: false,
reflectToAttribute: true
},
selectedItems: {
type: Object,
value: [],
notify: true
},
_isDisplayToolbar: {
type: Boolean,
value: false
}
},
observers: [
'_observeSelectedItems(selectedItems)'
],
_observeSelectedItems: function() {
this.hidden = !this.selectedItems || (this.selectedItems.length === 0);
},
toogleSelectedItemsPopup: function() {
this.$$('#selectedItemsPopup').toggle();
},
clearSelection: function() {
this.fire('clear-selected-items');
}
});
</script>
</dom-module>