|
1 | 1 | <link rel="import" href="../polymer/polymer.html">
|
2 | 2 | <link rel="import" href="../overlay-container/animated-overlay-behavior.html">
|
3 | 3 | <link rel="import" href="../app-localize-behavior/app-localize-behavior.html">
|
| 4 | +<link rel="import" href="../iron-image/iron-image.html"> |
4 | 5 | <link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
|
5 | 6 |
|
6 | 7 | <!--
|
|
33 | 34 | }
|
34 | 35 | }
|
35 | 36 |
|
| 37 | + .header { |
| 38 | + @apply(--layout-horizontal); |
| 39 | + @apply(--layout-center); |
| 40 | + } |
| 41 | + |
| 42 | + .header__title { |
| 43 | + @apply(--layout-flex); |
| 44 | + font-size: 18px; |
| 45 | + } |
| 46 | + |
| 47 | + .header__close { |
| 48 | + color: var(--paper-grey-500); |
| 49 | + cursor: pointer; |
| 50 | + padding: 8px; |
| 51 | + } |
| 52 | + |
| 53 | + .files { |
| 54 | + @apply(--layout-horizontal); |
| 55 | + @apply(--layout-wrap); |
| 56 | + } |
| 57 | + |
| 58 | + .file { |
| 59 | + height: 80px; |
| 60 | + width: 50%; |
| 61 | + } |
| 62 | + |
| 63 | + .file__iron-image { |
| 64 | + height: 100%; |
| 65 | + width: 100%; |
| 66 | + } |
36 | 67 | </style>
|
37 | 68 |
|
38 | 69 | <div id="container">
|
| 70 | + <div class="header"> |
| 71 | + <div class="header__title">[[_computeHeaderTitle(files, localize)]]</div> |
| 72 | + <iron-icon class="header__close" icon="close"></iron-icon> |
| 73 | + </div> |
| 74 | + |
| 75 | + <div class="files"> |
| 76 | + <template is="dom-repeat" items="[[uploadedFiles]]"> |
| 77 | + <div class="file"> |
| 78 | + <iron-image |
| 79 | + class="file__iron-image" |
| 80 | + src="[[_computeThumbnail(file)]]" |
| 81 | + sizing="cover"></iron-image> |
| 82 | + </div> |
| 83 | + </template> |
| 84 | + </div> |
39 | 85 | </div>
|
40 | 86 |
|
41 | 87 | </template>
|
|
50 | 96 | is: 'file-uploader-completed-overlay',
|
51 | 97 |
|
52 | 98 | properties: {
|
| 99 | + |
| 100 | + files: { |
| 101 | + type: Array, |
| 102 | + observer: '_filesChanged' |
| 103 | + }, |
| 104 | + |
| 105 | + _filteredFiles: Array, |
| 106 | + |
| 107 | + resources: { |
| 108 | + value: _ => { |
| 109 | + return { |
| 110 | + 'en': { |
| 111 | + 'HeaderTitle': '{length} items uploaded' |
| 112 | + }, |
| 113 | + 'es': { |
| 114 | + 'HeaderTitle': 'Se han subido {length} elementos' |
| 115 | + } |
| 116 | + }; |
| 117 | + } |
| 118 | + } |
| 119 | + |
53 | 120 | },
|
54 | 121 |
|
55 | 122 | behaviors: [
|
56 | 123 | AnimatedOverlayBehavior,
|
57 | 124 | Polymer.AppLocalizeBehavior
|
58 |
| - ] |
| 125 | + ], |
| 126 | + |
| 127 | + _filesChanged(files) { |
| 128 | + if (Array.isArray(files)) { |
| 129 | + this._filteredFiles = files.splice(0, 5); |
| 130 | + } |
| 131 | + }, |
| 132 | + |
| 133 | + _computeHeaderTitle(files) { |
| 134 | + return this.localize('HeaderTitle', 'length', files.length); |
| 135 | + }, |
| 136 | + |
| 137 | + _computeThumbnail(file) { |
| 138 | + const isImage = /image\/.*/.exec(currentFile.type); |
| 139 | + |
| 140 | + if (isImage) { |
| 141 | + return URL.createObjectURL(currentFile); |
| 142 | + } |
| 143 | + } |
59 | 144 |
|
60 | 145 | });
|
61 | 146 |
|
|
0 commit comments