luci-base: ui.js: show filename after selecting upload file
Fixes: #3286 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
948c1fe602
commit
4cc7772ed5
1 changed files with 17 additions and 1 deletions
|
@ -2277,7 +2277,23 @@ return L.Class.extend({
|
||||||
type: 'file',
|
type: 'file',
|
||||||
style: 'display:none',
|
style: 'display:none',
|
||||||
change: function(ev) {
|
change: function(ev) {
|
||||||
L.dom.parent(ev.target, '.modal').querySelector('.cbi-button-action.important').disabled = false;
|
var modal = L.dom.parent(ev.target, '.modal'),
|
||||||
|
body = modal.querySelector('p'),
|
||||||
|
upload = modal.querySelector('.cbi-button-action.important'),
|
||||||
|
file = ev.currentTarget.files[0];
|
||||||
|
|
||||||
|
if (file == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
L.dom.content(body, [
|
||||||
|
E('ul', {}, [
|
||||||
|
E('li', {}, [ '%s: %s'.format(_('Name'), file.name.replace(/^.*[\\\/]/, '')) ]),
|
||||||
|
E('li', {}, [ '%s: %1024mB'.format(_('Size'), file.size) ])
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
|
||||||
|
upload.disabled = false;
|
||||||
|
upload.focus();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
E('button', {
|
E('button', {
|
||||||
|
|
Loading…
Reference in a new issue