liquid_feedback_frontend
view 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 | 
 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" or
    16                   not current_tab and i == 1 and "selected" or
    17                   ""
    18                 )
    19               },
    20               module = request.get_module(),
    21               view = request.get_view(),
    22               id = param.get_id_cgi(),
    23               text = tab.label,
    24               params = params
    25             }
    26           end
    27         end
    28       }
    29       for i, tab in ipairs(tabs) do
    30         if tab.name == current_tab or not current_tab and i == 1 then
    31           ui.container{
    32             attr = { class = "ui_tabs_content" },
    33             content = tab.content
    34           }
    35         end
    36       end
    37     end
    38   }
    39 end
