liquid_feedback_frontend
view env/ui/tabs.lua @ 286:c587d8762e62
Registration process updated for Core 2.0, lockable member fields, notification settings
author | bsw |
---|---|
date | Sat Feb 25 11:51:37 2012 +0100 (2012-02-25) |
parents | fecd4c13054a |
children | 44f9a09ea51c |
line source
1 function ui.tabs(tabs)
2 local attr = tabs.attr or {}
3 attr.class = (attr.class and attr.class .. " " or "") .. "ui_tabs"
4 ui.container{
5 attr = attr,
6 content = function()
7 local params = param.get_all_cgi()
8 local current_tab = params["tab"]
9 ui.container{
10 attr = { class = "ui_tabs_links" },
11 content = function()
12 for i, tab in ipairs(tabs) do
13 params["tab"] = i > 1 and tab.name or nil
14 ui.link{
15 attr = {
16 class = (
17 tab.name == current_tab and "selected" .. (tab.class and (" " .. tab.class) or "") or
18 not current_tab and i == 1 and "selected" .. (tab.class and (" " .. tab.class) or "") or
19 "" .. (tab.class and (" " .. tab.class) or "")
20 )
21 },
22 module = request.get_module(),
23 view = request.get_view(),
24 id = param.get_id_cgi(),
25 content = tab.label,
26 params = params
27 }
28 slot.put(" ")
29 end
30 end
31 }
32 for i, tab in ipairs(tabs) do
33 if tab.name == current_tab and i > 1 then
34 app.html_title.prefix = tab.label
35 end
36 if tab.name == current_tab or not current_tab and i == 1 then
37 ui.container{
38 attr = { class = "ui_tabs_content" },
39 content = function()
40 if tab.content then
41 tab.content()
42 else
43 execute.view{
44 module = tab.module,
45 view = tab.view,
46 id = tab.id,
47 params = tab.params,
48 }
49 end
50 end
51 }
52 end
53 end
54 end
55 }
56 end