From 4cc7772ed510e5a851f69521127471867ac9abd3 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 10 Nov 2019 19:45:58 +0100 Subject: luci-base: ui.js: show filename after selecting upload file Fixes: #3286 Signed-off-by: Jo-Philipp Wich --- modules/luci-base/htdocs/luci-static/resources/ui.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index ffa36402a6..2e360410df 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', { -- cgit v1.2.3