liquid_feedback_frontend

diff app/main/lf2/_areas.lua @ 212:3e4ad069847a

Some more work at 2nd generation frontend code
author bsw
date Thu Mar 03 18:39:00 2011 +0100 (2011-03-03)
parents 4993b71b383f
children 1dab81353eb1
line diff
     1.1 --- a/app/main/lf2/_areas.lua	Wed Mar 02 20:06:26 2011 +0100
     1.2 +++ b/app/main/lf2/_areas.lua	Thu Mar 03 18:39:00 2011 +0100
     1.3 @@ -1,19 +1,31 @@
     1.4  local areas = param.get("areas_selector", "table"):exec()
     1.5 +local current_area_id = param.get("current_area_id", atom.integer)
     1.6  local head_content = param.get("head_content", "function")
     1.7  
     1.8 -ui.box{ class = "areas", row_count = #areas, content = function()
     1.9 +if #areas == 0 then
    1.10 +  return
    1.11 +end
    1.12 +
    1.13 +areas:load("membership_for_member", { member_id = app.session.member_id}, "membership")
    1.14 +
    1.15 +ui.box{ class = "areas", row_count = #areas + 1, content = function()
    1.16    if head_content then
    1.17 -    ui.box_row{ class = "head", content = function() ui.box_col{ content = head_content } end }
    1.18 +    ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function()
    1.19 +      ui.link{ content = head_content, module = "lf2", view = "index" }
    1.20 +    end } end }
    1.21    end
    1.22  
    1.23    for i, area in ipairs(areas) do
    1.24      local delegation = Delegation:by_pk(app.session.member_id, area.id)
    1.25      
    1.26 +    local class = "area"
    1.27 +    if (current_area_id and area.id == current_area_id) 
    1.28 +      or (not current_area_id and area.membership)
    1.29 +    then
    1.30 +      class = class .. " active"
    1.31 +    end
    1.32      ui.box_row{ 
    1.33 -      class = "area", 
    1.34 -      toggle_content = function() 
    1.35 -        ui.image{ static = "lf2/icon_search_crossed.png" } 
    1.36 -      end,
    1.37 +      class = class, 
    1.38        content = function()
    1.39          ui.box_col{ class = "name", content = function()
    1.40            if delegation then
    1.41 @@ -26,4 +38,4 @@
    1.42      
    1.43    end
    1.44  
    1.45 -end }
    1.46 \ No newline at end of file
    1.47 +end }

Impressum / About Us