From: Jo-Philipp Wich Date: Wed, 21 Nov 2012 18:36:43 +0000 (+0000) Subject: applications/luci-commands: improve dashboard html, remove inline styles, fix layout... X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=3451d533e561b186ed38ff50ff3d5b0c58aede17 applications/luci-commands: improve dashboard html, remove inline styles, fix layout for both openwrt and bootstrap themes, use command basename when naming output download --- diff --git a/applications/luci-commands/luasrc/controller/commands.lua b/applications/luci-commands/luasrc/controller/commands.lua index cd921f9f2..9fbde94c6 100644 --- a/applications/luci-commands/luasrc/controller/commands.lua +++ b/applications/luci-commands/luasrc/controller/commands.lua @@ -195,6 +195,7 @@ function action_run(...) end function action_download(...) + local fs = require "nixio.fs" local argv = parse_cmdline(...) if argv then local fd = io.popen(table.concat(argv, " ") .. " 2>/dev/null") @@ -203,11 +204,11 @@ function action_download(...) local name if chunk:match("[%z\1-\8\14-\31]") then luci.http.header("Content-Disposition", "attachment; filename=%s" - % argv[1]:gsub("%W+", ".") .. ".bin") + % fs.basename(argv[1]):gsub("%W+", ".") .. ".bin") luci.http.prepare_content("application/octet-stream") else luci.http.header("Content-Disposition", "attachment; filename=%s" - % argv[1]:gsub("%W+", ".") .. ".txt") + % fs.basename(argv[1]):gsub("%W+", ".") .. ".txt") luci.http.prepare_content("text/plain") end diff --git a/applications/luci-commands/luasrc/view/commands.htm b/applications/luci-commands/luasrc/view/commands.htm index 888033c27..83792a91f 100644 --- a/applications/luci-commands/luasrc/view/commands.htm +++ b/applications/luci-commands/luasrc/view/commands.htm @@ -10,6 +10,35 @@ You may obtain a copy of the License at -%> +<% css = [[ + +.commandbox { + height: 12em; + width: 30%; + float: left; + height: 12em; + margin: 5px; + position: relative; +} + +.commandbox h3 { + font-size: 1.5em !important; + line-height: 2em !important; + margin: 0 !important; +} + +.commandbox input[type="text"] { + width: 50% !important; +} + +.commandbox div { + position: absolute; + left: 0; + bottom: 1.5em; +} + +]] -%> + <%+header%> @@ -94,7 +123,7 @@ You may obtain a copy of the License at legend.style.display = 'none'; output.parentNode.style.display = 'block'; output.innerHTML = String.format( - '
<%:Access command with%> %s
', + '
<%:Access command with%> %s
', link, link ); @@ -117,13 +146,13 @@ You may obtain a copy of the License at
<% local _, command; for _, command in ipairs(commands) do %> -
+

<%=pcdata(command.name)%>

<%:Command:%> <%=pcdata(command.command)%>

<% if command.param == "1" then %> -

<%:Arguments:%>

+

<%:Arguments:%>

<% end %> -
+
<% if command.public == "1" then %>