luci-theme-openwrt-2020: honor CSS definitions passed by views

Legacy Lua views might declare a global `css` variable to inject custom
styles into the template header. Support this mechanism in the OpenWrt 2020
theme as well.

Ref: https://github.com/openwrt/luci/issues/4972
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit c5ff3244e9)
This commit is contained in:
Jo-Philipp Wich 2021-04-09 14:25:51 +02:00
parent 7bb2fc4913
commit 6137c9ff33

View file

@ -28,6 +28,10 @@
<script type="text/javascript" src="<%=url('admin/translations', luci.i18n.context.lang)%><%# ?v=PKG_VERSION %>"></script>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
<% if css then %><style title="text/css">
<%= css %>
</style>
<% end -%>
</head>
<body class="lang_<%=luci.i18n.context.lang%>" data-page="<%= pcdata(path) %>">