Skip to content
This repository was archived by the owner on May 25, 2023. It is now read-only.

Commit dbfc819

Browse files
committed
Use CSS media queries to define file name display.
Improve responsive table layout.
1 parent 6d1dd9b commit dbfc819

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

css/jquery.fileupload-ui.css

+14-7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@
3131
.files video {
3232
max-width: 300px;
3333
}
34+
.files .name {
35+
word-wrap: break-word;
36+
overflow-wrap: anywhere;
37+
-webkit-hyphens: auto;
38+
hyphens: auto;
39+
}
40+
.files button {
41+
margin-bottom: 5px;
42+
}
3443
.toggle[type='checkbox'] {
3544
transform: scale(2);
3645
margin-left: 10px;
@@ -46,16 +55,14 @@
4655
.files .btn span {
4756
display: none;
4857
}
49-
.files .name {
50-
width: 80px;
51-
word-wrap: break-word;
52-
}
5358
.files audio,
5459
.files video {
5560
max-width: 80px;
5661
}
57-
.files img,
58-
.files canvas {
59-
max-width: 100%;
62+
}
63+
64+
@media (max-width: 480px) {
65+
.files .image td:nth-child(2) {
66+
display: none;
6067
}
6168
}

index.html

+10-14
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,12 @@ <h3 class="title"></h3>
213213
<!-- The template to display files available for upload -->
214214
<script id="template-upload" type="text/x-tmpl">
215215
{% for (var i=0, file; file=o.files[i]; i++) { %}
216-
<tr class="template-upload fade">
216+
<tr class="template-upload fade{%=o.options.loadImageFileTypes.test(file.type)?' image':''%}">
217217
<td>
218218
<span class="preview"></span>
219219
</td>
220220
<td>
221-
{% if (window.innerWidth > 480 || !o.options.loadImageFileTypes.test(file.type)) { %}
222-
<p class="name">{%=file.name%}</p>
223-
{% } %}
221+
<p class="name">{%=file.name%}</p>
224222
<strong class="error text-danger"></strong>
225223
</td>
226224
<td>
@@ -253,7 +251,7 @@ <h3 class="title"></h3>
253251
<!-- The template to display files available for download -->
254252
<script id="template-download" type="text/x-tmpl">
255253
{% for (var i=0, file; file=o.files[i]; i++) { %}
256-
<tr class="template-download fade">
254+
<tr class="template-download fade{%=file.thumbnailUrl?' image':''%}">
257255
<td>
258256
<span class="preview">
259257
{% if (file.thumbnailUrl) { %}
@@ -262,15 +260,13 @@ <h3 class="title"></h3>
262260
</span>
263261
</td>
264262
<td>
265-
{% if (window.innerWidth > 480 || !file.thumbnailUrl) { %}
266-
<p class="name">
267-
{% if (file.url) { %}
268-
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
269-
{% } else { %}
270-
<span>{%=file.name%}</span>
271-
{% } %}
272-
</p>
273-
{% } %}
263+
<p class="name">
264+
{% if (file.url) { %}
265+
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
266+
{% } else { %}
267+
<span>{%=file.name%}</span>
268+
{% } %}
269+
</p>
274270
{% if (file.error) { %}
275271
<div><span class="label label-danger">Error</span> {%=file.error%}</div>
276272
{% } %}

0 commit comments

Comments
 (0)