diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-11-10 19:45:58 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-11-10 19:45:58 +0100 |
commit | 4cc7772ed510e5a851f69521127471867ac9abd3 (patch) | |
tree | 5d8fd9959e6705417de94937d09281bacbc19f4b /modules/luci-base/htdocs | |
parent | 948c1fe6023a37e72ab2db1d5b1ad7f4436add3e (diff) |
luci-base: ui.js: show filename after selecting upload file
Fixes: #3286
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index ffa36402a..2e360410d 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -2277,7 +2277,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', { |