luci-base: do not render section description tag when description is empty
[project/luci.git] / modules / luci-base / luasrc / view / cbi / tsection.htm
1 <fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
2         <% if self.title and #self.title > 0 then -%>
3                 <legend><%=self.title%></legend>
4         <%- end %>
5         <% if self.description and #self.description > 0 then -%>
6                 <div class="cbi-section-descr"><%=self.description%></div>
7         <%- end %>
8         <% local isempty = true for i, k in ipairs(self:cfgsections()) do -%>
9                 <% if self.addremove then -%>
10                         <div class="cbi-section-remove right">
11                                 <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" onclick="this.form.cbi_state='del-section'; return true" value="<%:Delete%>" class="cbi-button" />
12                         </div>
13                 <%- end %>
14
15                 <%- section = k; isempty = false -%>
16
17                 <% if not self.anonymous then -%>
18                         <h3><%=section:upper()%></h3>
19                 <%- end %>
20
21                 <%+cbi/tabmenu%>
22
23                 <fieldset class="cbi-section-node<% if self.tabs then %> cbi-section-node-tabbed<% end %>" id="cbi-<%=self.config%>-<%=section%>">
24                         <%+cbi/ucisection%>
25                 </fieldset>
26                 <br />
27         <%- end %>
28
29         <% if isempty then -%>
30                 <em><%:This section contains no values yet%><br /><br /></em>
31         <%- end %>
32
33         <% if self.addremove then -%>
34                 <% if self.template_addremove then include(self.template_addremove) else -%>
35                 <div class="cbi-section-create">
36                         <% if self.anonymous then -%>
37                                 <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
38                         <%- else -%>
39                                 <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
40                                 <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" />
41                                 <script type="text/javascript">cbi_validate_field('cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>', true, 'uciname');</script>
42                                 <input type="submit" class="cbi-button cbi-button-add" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" />
43                                 <% if self.invalid_cts then -%>
44                                         <br /><%:Invalid%></div>
45                                 <%- end %>
46                         <%- end %>
47                 </div>
48                 <%- end %>
49         <%- end %>
50 </fieldset>