liquid_feedback_frontend
annotate env/ui/tabs.lua @ 3:768faea1096d
Version alpha4
Members interested in an issue or supporting an initiative have a weight information attached. Browsing the members causing that weight is possible.
Initiatives may provide a link to an external discussion platform
Direct link on every initiative page to create an alternative initiative
Bugfix: No error when clicking "neutral", when "neutral" is currently selected
Members interested in an issue or supporting an initiative have a weight information attached. Browsing the members causing that weight is possible.
Initiatives may provide a link to an external discussion platform
Direct link on every initiative page to create an alternative initiative
Bugfix: No error when clicking "neutral", when "neutral" is currently selected
| author | bsw | 
|---|---|
| date | Mon Nov 30 12:00:00 2009 +0100 (2009-11-30) | 
| parents | 3bfb2fcf7ab9 | 
| children | 80c215dbf076 | 
| rev | line source | 
|---|---|
| bsw/jbe@0 | 1 function ui.tabs(tabs) | 
| bsw/jbe@0 | 2 ui.container{ | 
| bsw/jbe@0 | 3 attr = { class = "ui_tabs" }, | 
| bsw/jbe@0 | 4 content = function() | 
| bsw/jbe@0 | 5 local params = param.get_all_cgi() | 
| bsw/jbe@0 | 6 local current_tab = params["tab"] | 
| bsw/jbe@0 | 7 ui.container{ | 
| bsw/jbe@0 | 8 attr = { class = "ui_tabs_links" }, | 
| bsw/jbe@0 | 9 content = function() | 
| bsw/jbe@0 | 10 for i, tab in ipairs(tabs) do | 
| bsw/jbe@0 | 11 params["tab"] = i > 1 and tab.name or nil | 
| bsw/jbe@0 | 12 ui.link{ | 
| bsw/jbe@0 | 13 attr = { | 
| bsw/jbe@0 | 14 class = ( | 
| bsw/jbe@0 | 15 tab.name == current_tab and "selected" or | 
| bsw/jbe@0 | 16 not current_tab and i == 1 and "selected" or | 
| bsw/jbe@0 | 17 "" | 
| bsw/jbe@0 | 18 ) | 
| bsw/jbe@0 | 19 }, | 
| bsw/jbe@0 | 20 module = request.get_module(), | 
| bsw/jbe@0 | 21 view = request.get_view(), | 
| bsw/jbe@0 | 22 id = param.get_id_cgi(), | 
| bsw/jbe@0 | 23 text = tab.label, | 
| bsw/jbe@0 | 24 params = params | 
| bsw/jbe@0 | 25 } | 
| bsw/jbe@0 | 26 end | 
| bsw/jbe@0 | 27 end | 
| bsw/jbe@0 | 28 } | 
| bsw/jbe@0 | 29 for i, tab in ipairs(tabs) do | 
| bsw/jbe@0 | 30 if tab.name == current_tab or not current_tab and i == 1 then | 
| bsw/jbe@0 | 31 ui.container{ | 
| bsw/jbe@0 | 32 attr = { class = "ui_tabs_content" }, | 
| bsw/jbe@0 | 33 content = tab.content | 
| bsw/jbe@0 | 34 } | 
| bsw/jbe@0 | 35 end | 
| bsw/jbe@0 | 36 end | 
| bsw/jbe@0 | 37 end | 
| bsw/jbe@0 | 38 } | 
| bsw/jbe@0 | 39 end | 
| bsw/jbe@0 | 40 |