luci-base: ui.js: show filename after selecting upload file
Fixes: #3286
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 4cc7772ed5
)
This commit is contained in:
parent
1c296f6f95
commit
f78cc97925
1 changed files with 17 additions and 1 deletions
|
@ -2232,7 +2232,23 @@ return L.Class.extend({
|
|||
type: 'file',
|
||||
style: 'display:none',
|
||||
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', {
|
||||
|
|
Loading…
Reference in a new issue