liquid_feedback_frontend
view env/ui/order.lua @ 0:3bfb2fcf7ab9
Version alpha1
| author | bsw/jbe | 
|---|---|
| date | Wed Nov 18 12:00:00 2009 +0100 (2009-11-18) | 
| parents | |
| children | afd9f769c7ae | 
 line source
     1 function ui.order(args)
     2   local name = args.name or "order"
     3   local current_order = atom.string:load(cgi.params[name]) or args.options[1].name
     4   local id     = param.get_id_cgi()
     5   local params = param.get_all_cgi()
     6   ui.container{
     7     attr = { class = "ui_order" },
     8     content = function()
     9       ui.container{
    10         attr = { class = "ui_order_head" },
    11         content = function()
    12           slot.put(_"Order by")
    13           slot.put(": ")
    14           for i, option in ipairs(args.options) do
    15             params[name] = option.name
    16             local attr = {}
    17             if current_order == option.name then
    18               attr.class = "active"
    19               args.selector:add_order_by(option.order_by)
    20             end
    21             ui.link{
    22               attr    = attr,
    23               module  = request.get_module(),
    24               view    = request.get_view(),
    25               id      = id,
    26               params  = params,
    27               content = option.label
    28             }
    29           end
    30         end
    31       }
    32       ui.container{
    33         attr = { class = "ui_order_content" },
    34         content = function()
    35           args.content()
    36         end
    37       }
    38     end
    39   }
    40 end
