07d13c9c
isisadmin
polymer catalog
|
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
|
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../catalog-element/catalog-element.html">
<dom-module id="element-action-menu">
<template>
<style>
:host {
@apply(--layout);
@apply(--layout-center);
@apply(--layout-center-justified);
position: absolute;
text-align: center;
padding-top: 15px;
margin-right: 5px;
opacity: 1;
transition: opacity 0.2s;
-webkit-transition: opacity 0.2s;
}
:host(.cards) {
background-color: rgba(255, 255, 255, 0.9);
margin-right: 0px;
}
:host(.hidden) {
pointer-events: none;
opacity: 0;
}
a, iron-icon {
font-size: 12px;
color: #666;
outline: none;
}
a {
margin: 0 5px;
cursor: pointer;
}
span {
width: 40px;
display: block;
}
a:hover,
a:hover iron-icon {
color: black;
}
iron-icon {
--iron-icon-width: 18px;
--iron-icon-height: 18px;
}
cart-item-icon {
--cart-item-icon-label: {
display: block;
width: 40px;
};
}
</style>
<catalog-element name="[[element]]" data="{{_element}}"></catalog-element>
<a tabindex="0" role="button" on-tap="cartAdd">
<cart-item-icon id="cartItemIcon" element="[[element]]" present-label="Remove" absent-label="Add" no-label="[[iconsOnly]]"></cart-item-icon>
</a>
<a tabindex="0" role="button" on-click="navToDocs" aria-label="View Docs">
<iron-icon icon="description" title="View Docs"></iron-icon>
<span hidden$="[[iconsOnly]]">Docs</span>
</a>
<a tabindex="0" role="button" href="[[githubLink(_element.source)]]" target="_blank" title="View Source on GitHub" aria-label="View Source on GitHub">
<iron-icon icon="code"></iron-icon>
<span hidden$="[[iconsOnly]]">Source</span>
</a>
<a tabindex="0" role="button" on-click="navToDemo" hidden$="[[!_element.demo]]" aria-label="View Demo">
<iron-icon icon="visibility" title="View Demo"></iron-icon>
<span hidden$="[[iconsOnly]]">Demo</span>
</a>
</template>
</dom-module>
<script>
Polymer({
is: 'element-action-menu',
properties: {
element: String,
_element: Object,
iconsOnly: {type: Boolean, value: false, reflectToAttribute: true}
},
githubLink: function(source) {
return "https://github.com/" + source;
},
cartAdd: function(e) {
e.stopPropagation();
e.preventDefault();
this.$.cartItemIcon.toggle();
},
navToDocs: function(e) {
e.stopPropagation();
e.preventDefault();
this.fire('nav', {url: '/elements/' + this.element + '?view=docs'});
},
navToDemo: function(e) {
e.stopPropagation();
e.preventDefault();
if (e.currentTarget.hasAttribute('disabled')) return false;
this.fire('nav', {url: '/elements/' + this.element + '?active=' + this._element.active + "&view=demo:" + this._element.demo.path});
}
});
</script>
|