luci-base: add cbi tsection error msg option 2642/head
authorFlorian Eckert <fe@dev.tdt.de>
Tue, 15 Jan 2019 14:07:27 +0000 (15:07 +0100)
committerFlorian Eckert <fe@dev.tdt.de>
Fri, 29 Mar 2019 08:27:04 +0000 (09:27 +0100)
In some situation it is usefull to inform the use that this section
could not get delete, because this config is referenced or is in use.

Example pseudo code:

function s.remove(self, sid)
<check if secation could get deleted>
if output == nil then
self.error_msg = translatef("Unable to remove this section")
return nil
end
end

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
modules/luci-base/luasrc/view/cbi/tsection.htm

index 547a793329489614e2bb62c3b91f7c08befc34d2..8f3b7f0ffb599d65cbc59ac5eece89561bd2e92c 100644 (file)
@@ -2,6 +2,11 @@
        <% if self.title and #self.title > 0 then -%>
                <legend><%=self.title%></legend>
        <%- end %>
+       <% if self.error_msg and #self.error_msg > 0 then -%>
+               <div class="cbi-section-error">
+                       <%=self.error_msg%>
+               </div>
+       <%- end %>
        <% if self.description and #self.description > 0 then -%>
                <div class="cbi-section-descr"><%=self.description%></div>
        <%- end %>