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