summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-radicale/luasrc/view/radicale/tabmap_nsections.htm
blob: 45fe60cc80f182a480816d1a9d1ccbffd4093906 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<%- if firstmap and messages then local msg; for _, msg in ipairs(messages) do -%>
	<div class="errorbox"><%=pcdata(msg)%></div>
<%- end end -%>

<%-+cbi/apply_xhr-%>

<div class="cbi-map" id="cbi-<%=self.config%>">
	<% if self.title and #self.title > 0 then %><h2 name="content"><%=self.title%></h2><% end %>
	<% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
	<%- if firstmap and applymap then cbi_apply_xhr(self.config, parsechain, redirect) end -%>

	<% if self.tabbed then %>
		<ul class="cbi-tabmenu map">
			<%- self.selected_tab = luci.http.formvalue("tab.m-" .. self.config) %>
			<% for i, section in ipairs(self.children) do %>
				<%- if not self.selected_tab then self.selected_tab = section.sectiontype end %>
				<li id="tab.m-<%=self.config%>.<%=section.section or section.sectiontype%>" class="cbi-tab<%=(section.sectiontype == self.selected_tab) and '' or '-disabled'%>">
					<a onclick="this.blur(); return cbi_t_switch('m-<%=self.config%>', '<%=section.section or section.sectiontype%>')" href="<%=REQUEST_URI%>?tab.m-<%=self.config%>=<%=section.section or section.sectiontype%>"><%=section.title or section.section or section.sectiontype %></a>
					<% if section.sectiontype == self.selected_tab then %><input type="hidden" id="tab.m-<%=self.config%>" name="tab.m-<%=self.config%>" value="<%=section.section or section.sectiontype%>" /><% end %>
				</li>
			<% end %>
		</ul>
		<br />
		<% for i, section in ipairs(self.children) do %>
			<div class="cbi-tabcontainer" id="container.m-<%=self.config%>.<%=section.section or section.sectiontype%>"<% if section.sectiontype ~= self.selected_tab then %> style="display:none"<% end %>>
				<% section:render() %>
			</div>
			<script type="text/javascript">cbi_t_add('m-<%=self.config%>', '<%=section.section or section.sectiontype%>')</script>
		<% end %>

	<% else %>
		<%- self:render_children() %>
	<% end %>

	<% if not self.save then -%>
		<div class="cbi-section-error">
			<% for _, section in ipairs(self.children) do %>
				<% if section.error and section.error[section.section] then -%>
					<ul><li>
						<%:One or more missing/invalid fields on tab%>:&nbsp;<%=section.title or section.section or section.sectiontype%>
					</li></ul>
				<%- end %>
			<% end %>
		</div>
	<%- end %>

	<br />

</div>