From f78cc97925cf319bacc8ba780a83296eff6ef540 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 10 Nov 2019 19:45:58 +0100 Subject: [PATCH] luci-base: ui.js: show filename after selecting upload file Fixes: #3286 Signed-off-by: Jo-Philipp Wich (cherry picked from commit 4cc7772ed510e5a851f69521127471867ac9abd3) --- .../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 c82b397c19..8dff42b3ba 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -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', { -- 2.30.2